Skip to content

Commit ae75b23

Browse files
authored
Merge branch 'main' into pythongh-121462
2 parents cd96328 + 8ad6067 commit ae75b23

14 files changed

+40
-27
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Include/internal/pycore_freelist.h @ericsnowcurrently
7272
Include/internal/pycore_global_objects.h @ericsnowcurrently
7373
Include/internal/pycore_obmalloc.h @ericsnowcurrently
7474
Include/internal/pycore_pymem.h @ericsnowcurrently
75+
Include/internal/pycore_stackref.h @Fidget-Spinner
7576
Modules/main.c @ericsnowcurrently
7677
Programs/_bootstrap_python.c @ericsnowcurrently
7778
Programs/python.c @ericsnowcurrently

Doc/library/os.path.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ the :mod:`glob` module.)
389389
that contains symbolic links. On Windows, it converts forward slashes to
390390
backward slashes. To normalize case, use :func:`normcase`.
391391

392-
.. note::
392+
.. note::
393393
On POSIX systems, in accordance with `IEEE Std 1003.1 2013 Edition; 4.13
394394
Pathname Resolution <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>`_,
395395
if a pathname begins with exactly two slashes, the first component

Lib/asyncio/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def run(self):
116116
if err := check():
117117
raise RuntimeError(err)
118118
except Exception as e:
119-
console.interact(banner="", exitmsg=exit_message)
119+
console.interact(banner="", exitmsg="")
120120
else:
121121
try:
122122
run_multiline_interactive_console(console=console)

Lib/test/crashers/README

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,3 @@ what the variables are.
1515
Once the crash is fixed, the test case should be moved into an appropriate test
1616
(even if it was originally from the test suite). This ensures the regression
1717
doesn't happen again. And if it does, it should be easier to track down.
18-
19-
Also see Lib/test_crashers.py which exercises the crashers in this directory.
20-
In particular, make sure to add any new infinite loop crashers to the black
21-
list so it doesn't try to run them.

Lib/test/test_list.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,15 @@ def __eq__(self, other):
299299
lst = [X(), X()]
300300
X() in lst
301301

302+
def test_tier2_invalidates_iterator(self):
303+
# GH-121012
304+
for _ in range(100):
305+
a = [1, 2, 3]
306+
it = iter(a)
307+
for _ in it:
308+
pass
309+
a.append(4)
310+
self.assertEqual(list(it), [])
302311

303312
if __name__ == "__main__":
304313
unittest.main()

Lib/test/test_pathlib/test_pathlib.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,6 @@ def test_open_unbuffered(self):
656656
def test_copy_file_preserve_metadata(self):
657657
base = self.cls(self.base)
658658
source = base / 'fileA'
659-
if hasattr(os, 'setxattr'):
660-
os.setxattr(source, b'user.foo', b'42')
661659
if hasattr(os, 'chmod'):
662660
os.chmod(source, stat.S_IRWXU | stat.S_IRWXO)
663661
if hasattr(os, 'chflags') and hasattr(stat, 'UF_NODUMP'):
@@ -670,12 +668,19 @@ def test_copy_file_preserve_metadata(self):
670668
target_st = target.stat()
671669
self.assertLessEqual(source_st.st_atime, target_st.st_atime)
672670
self.assertLessEqual(source_st.st_mtime, target_st.st_mtime)
673-
if hasattr(os, 'getxattr'):
674-
self.assertEqual(os.getxattr(target, b'user.foo'), b'42')
675671
self.assertEqual(source_st.st_mode, target_st.st_mode)
676672
if hasattr(source_st, 'st_flags'):
677673
self.assertEqual(source_st.st_flags, target_st.st_flags)
678674

675+
@os_helper.skip_unless_xattr
676+
def test_copy_file_preserve_metadata_xattrs(self):
677+
base = self.cls(self.base)
678+
source = base / 'fileA'
679+
os.setxattr(source, b'user.foo', b'42')
680+
target = base / 'copyA'
681+
source.copy(target, preserve_metadata=True)
682+
self.assertEqual(os.getxattr(target, b'user.foo'), b'42')
683+
679684
@needs_symlinks
680685
def test_copy_link_preserve_metadata(self):
681686
base = self.cls(self.base)

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from unittest.mock import patch
1212
from test.support import force_not_colorized
1313
from test.support import SHORT_TIMEOUT
14+
from test.support.import_helper import import_module
1415
from test.support.os_helper import unlink
1516

1617
from .support import (
@@ -902,6 +903,9 @@ def test_python_basic_repl(self):
902903
self.assertNotIn("Traceback", output)
903904

904905
def test_not_wiping_history_file(self):
906+
# skip, if readline module is not available
907+
import_module('readline')
908+
905909
hfile = tempfile.NamedTemporaryFile(delete=False)
906910
self.addCleanup(unlink, hfile.name)
907911
env = os.environ.copy()

Makefile.pre.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,7 +2652,7 @@ inclinstall:
26522652
$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(INCLUDEPY)/internal; \
26532653
else true; \
26542654
fi
2655-
@if test "$(INSTALL_MIMALLOC)" == "yes"; then \
2655+
@if test "$(INSTALL_MIMALLOC)" = "yes"; then \
26562656
if test ! -d $(DESTDIR)$(INCLUDEPY)/internal/mimalloc/mimalloc; then \
26572657
echo "Creating directory $(DESTDIR)$(INCLUDEPY)/internal/mimalloc/mimalloc"; \
26582658
$(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(INCLUDEPY)/internal/mimalloc/mimalloc; \
@@ -2673,7 +2673,7 @@ inclinstall:
26732673
echo $(INSTALL_DATA) $$i $(INCLUDEPY)/internal; \
26742674
$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY)/internal; \
26752675
done
2676-
@if test "$(INSTALL_MIMALLOC)" == "yes"; then \
2676+
@if test "$(INSTALL_MIMALLOC)" = "yes"; then \
26772677
echo $(INSTALL_DATA) $(srcdir)/Include/internal/mimalloc/mimalloc.h $(DESTDIR)$(INCLUDEPY)/internal/mimalloc/mimalloc.h; \
26782678
$(INSTALL_DATA) $(srcdir)/Include/internal/mimalloc/mimalloc.h $(DESTDIR)$(INCLUDEPY)/internal/mimalloc/mimalloc.h; \
26792679
for i in $(srcdir)/Include/internal/mimalloc/mimalloc/*.h; \
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a Makefile bug that prevented mimalloc header files from being installed.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Tier 2 execution now ensures that list iterators remain exhausted, once they
2+
become exhausted.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
Add support for ``all`` as an valid ``action`` for :func:`warnings.simplefilter`
2-
and :func:`warnings.filterswarnings`.
3-
2+
and :func:`warnings.filterwarnings`.

Python/bytecodes.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2967,7 +2967,10 @@ dummy_func(
29672967
assert(Py_TYPE(iter_o) == &PyListIter_Type);
29682968
PyListObject *seq = it->it_seq;
29692969
EXIT_IF(seq == NULL);
2970-
EXIT_IF((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq));
2970+
if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
2971+
it->it_index = -1;
2972+
EXIT_IF(1);
2973+
}
29712974
}
29722975

29732976
op(_ITER_NEXT_LIST, (iter -- iter, next)) {

Python/ceval.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -730,15 +730,6 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
730730
* so consume 3 units of C stack */
731731
#define PY_EVAL_C_STACK_UNITS 2
732732

733-
#if defined(_MSC_VER) && defined(_Py_USING_PGO)
734-
/* gh-111786: _PyEval_EvalFrameDefault is too large to optimize for speed with
735-
PGO on MSVC. Disable that optimization temporarily. If this is fixed
736-
upstream, we should gate this on the version of MSVC.
737-
*/
738-
# pragma optimize("t", off)
739-
/* This setting is reversed below following _PyEval_EvalFrameDefault */
740-
#endif
741-
742733
PyObject* _Py_HOT_FUNCTION
743734
_PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
744735
{
@@ -1158,7 +1149,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11581149
# pragma GCC diagnostic pop
11591150
#elif defined(_MSC_VER) /* MS_WINDOWS */
11601151
# pragma warning(pop)
1161-
# pragma optimize("", on)
11621152
#endif
11631153

11641154
static void

Python/executor_cases.c.h

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)