]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-110088: Fix asyncio test_prompt_cancellation() (#110157)
Victor Stinner [Sat, 30 Sep 2023 20:40:10 +0000 (22:40 +0200)] 
gh-110088: Fix asyncio test_prompt_cancellation() (#110157)

Don't measure the CI performance: don't test the maximum elapsed
time. The check failed on a slow CI.

2 years agogh-110014: Include explicitly <unistd.h> header (#110155)
Victor Stinner [Sat, 30 Sep 2023 20:06:45 +0000 (22:06 +0200)] 
gh-110014: Include explicitly <unistd.h> header (#110155)

* Remove unused <locale.h> includes.
* Remove unused <fcntl.h> include in traceback.h.
* Remove redundant <assert.h> and <stddef.h> includes. They  are already
  included by "Python.h".
* Remove <object.h> include in faulthandler.c. Python.h already includes it.
* Add missing <stdbool.h> in pycore_pythread.h if HAVE_PTHREAD_STUBS
  is defined.
* Fix also warnings in pthread_stubs.h: don't redefine macros if they
  are already defined, like the __NEED_pthread_t macro.

2 years agogh-109748: Fix again venv test_zippath_from_non_installed_posix() (#110149)
Victor Stinner [Sat, 30 Sep 2023 18:23:26 +0000 (20:23 +0200)] 
gh-109748: Fix again venv test_zippath_from_non_installed_posix() (#110149)

Call also copy_python_src_ignore() on listdir() names.

shutil.copytree(): replace set() with an empty tuple. An empty tuple
becomes a constant in the compiler and checking if an item is in an
empty tuple is cheap.

2 years agogh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage (#110139)
Victor Stinner [Sat, 30 Sep 2023 17:25:54 +0000 (19:25 +0200)] 
gh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage (#110139)

* pycore_pythread.h is now the central place to make sure that
  _POSIX_THREADS and _POSIX_SEMAPHORES macros are defined if
  available.
* Make sure that pycore_pythread.h is included when _POSIX_THREADS
  and _POSIX_SEMAPHORES macros are tested.
* PY_TIMEOUT_MAX is now defined as a constant, since its value
  depends on _POSIX_THREADS, instead of being defined as a macro.
* Prevent integer overflow in the preprocessor when computing
  PY_TIMEOUT_MAX_VALUE on Windows:
  replace "0xFFFFFFFELL * 1000 < LLONG_MAX"
  with "0xFFFFFFFELL < LLONG_MAX / 1000".
* Document the change and give hints how to fix affected code.
* Add an exception for PY_TIMEOUT_MAX  name to smelly.py
* Add PY_TIMEOUT_MAX to the stable ABI

2 years agogh-107954: Refactor initconfig.c: add CONFIG_SPEC (#110146)
Victor Stinner [Sat, 30 Sep 2023 17:24:06 +0000 (19:24 +0200)] 
gh-107954: Refactor initconfig.c: add CONFIG_SPEC (#110146)

Add a specification of the PyConfig structure to factorize the code.

2 years agoGH-89812: Add `pathlib._PathBase` (#106337)
Barney Gale [Sat, 30 Sep 2023 14:45:01 +0000 (15:45 +0100)] 
GH-89812: Add `pathlib._PathBase` (#106337)

Add private `pathlib._PathBase` class. This will be used by an experimental PyPI package to incubate a `tarfile.TarPath` class.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agoGH-101100: Fix reference warnings for ``gettext`` (#110115)
Adam Turner [Sat, 30 Sep 2023 11:10:07 +0000 (12:10 +0100)] 
GH-101100: Fix reference warnings for ``gettext`` (#110115)

2 years agoGH-101100: Fix reference warnings for ``namedtuple`` (#110113)
Adam Turner [Sat, 30 Sep 2023 06:32:35 +0000 (07:32 +0100)] 
GH-101100: Fix reference warnings for ``namedtuple`` (#110113)

2 years agoAdd example for linear_regression() with proportional=True. (gh-110133)
Raymond Hettinger [Sat, 30 Sep 2023 04:18:12 +0000 (23:18 -0500)] 
Add example for linear_regression() with proportional=True. (gh-110133)

2 years agogh-107888: Fix test_mmap PROT_EXEC comment (#110125)
Victor Stinner [Fri, 29 Sep 2023 21:56:19 +0000 (23:56 +0200)] 
gh-107888: Fix test_mmap PROT_EXEC comment (#110125)

2 years agogh-110119: Temporarily skip test_cppext on --disable-gil builds. (#110123)
Sam Gross [Fri, 29 Sep 2023 20:50:51 +0000 (20:50 +0000)] 
gh-110119: Temporarily skip test_cppext on --disable-gil builds. (#110123)

The current version of pip does not support "t" in the ABI flags. Skip
the test in `--disable-gil` builds until we can update pip.

2 years agogh-109566: regrtest --fast-ci no longer enables --nowindows (#110121)
Victor Stinner [Fri, 29 Sep 2023 19:49:39 +0000 (21:49 +0200)] 
gh-109566: regrtest --fast-ci no longer enables --nowindows (#110121)

The --nowindows option is deprecated and does nothing but logs a
warning.

2 years agogh-109566: Remove make testall (#110122)
Victor Stinner [Fri, 29 Sep 2023 19:36:03 +0000 (21:36 +0200)] 
gh-109566: Remove make testall (#110122)

Remove "make testall" target: use "make buildbottest" instead.

2 years agogh-109047: concurrent.futures catches PythonFinalizationError (#109810)
Victor Stinner [Fri, 29 Sep 2023 19:31:19 +0000 (21:31 +0200)] 
gh-109047: concurrent.futures catches PythonFinalizationError (#109810)

concurrent.futures: The *executor manager thread* now catches
exceptions when adding an item to the *call queue*. During Python
finalization, creating a new thread can now raise RuntimeError. Catch
the exception and call terminate_broken() in this case.

Add test_python_finalization_error() to test_concurrent_futures.

concurrent.futures._ExecutorManagerThread changes:

* terminate_broken() no longer calls shutdown_workers() since the
  call queue is no longer working anymore (read and write ends of
  the queue pipe are closed).
* terminate_broken() now terminates child processes, not only
  wait until they complete.
* _ExecutorManagerThread.terminate_broken() now holds shutdown_lock
  to prevent race conditons with ProcessPoolExecutor.submit().

multiprocessing.Queue changes:

* Add _terminate_broken() method.
* _start_thread() sets _thread to None on exception to prevent
  leaking "dangling threads" even if the thread was not started
  yet.

2 years agogh-109566: PCbuild/rt.bat now uses --fast-ci (#110120)
Victor Stinner [Fri, 29 Sep 2023 19:16:29 +0000 (21:16 +0200)] 
gh-109566: PCbuild/rt.bat now uses --fast-ci (#110120)

Replace "--fail-env-changed --fail-rerun" with "--fast-ci".

Tools/buildbot/test.bat pass --slow-ci which has the priority over
--fast-ci.

2 years agogh-66143: Allow copying and pickling of CodecInfo object (GH-109235)
Furkan Onder [Fri, 29 Sep 2023 17:07:09 +0000 (20:07 +0300)] 
gh-66143: Allow copying and pickling of CodecInfo object (GH-109235)

Co-authored-by: Robert Lehmann <mail@robertlehmann.de>
2 years agogh-109495: Remove unused slots from the Python implementation of datetime (GH-109494)
James Hilton-Balfe [Fri, 29 Sep 2023 16:57:32 +0000 (17:57 +0100)] 
gh-109495: Remove unused slots from the Python implementation of datetime (GH-109494)

2 years agogh-109615: Look for 'Modules' as landmark for test_copy_python_src_ignore (GH-110108)
Steve Dower [Fri, 29 Sep 2023 15:24:38 +0000 (16:24 +0100)] 
gh-109615: Look for 'Modules' as landmark for test_copy_python_src_ignore (GH-110108)

2 years agogh-110024: Fix Pointer Type Warnings (gh-110053)
Eric Snow [Fri, 29 Sep 2023 15:20:23 +0000 (09:20 -0600)] 
gh-110024: Fix Pointer Type Warnings (gh-110053)

The warnings were introduced by gh-109794 (for gh-109793).

2 years agogh-109592: test_eintr tolerates 20 ms when comparing timings (#110102)
Victor Stinner [Fri, 29 Sep 2023 13:20:59 +0000 (15:20 +0200)] 
gh-109592: test_eintr tolerates 20 ms when comparing timings (#110102)

2 years agogh-110031: Skip test_threading fork tests if ASAN (#110100)
Victor Stinner [Fri, 29 Sep 2023 12:41:33 +0000 (14:41 +0200)] 
gh-110031: Skip test_threading fork tests if ASAN (#110100)

Skip test_threading tests using thread+fork if Python is built with
Address Sanitizer (ASAN).

2 years agogh-109974: Fix more threading lock_tests race conditions (#110089)
Victor Stinner [Fri, 29 Sep 2023 12:21:18 +0000 (14:21 +0200)] 
gh-109974: Fix more threading lock_tests race conditions (#110089)

* Add context manager on Bunch class.
* Bunch now catchs exceptions on executed functions and re-raise them
  at __exit__() as an ExceptionGroup.
* Rewrite BarrierProxy.test_default_timeout(). Use a single thread.
  Only check that barrier.wait() blocks for at least default timeout
  seconds.
* test_with(): inline _with() function.

2 years agogh-105323: Update readline module to detect apple editline variant (gh-108665)
Donghee Na [Fri, 29 Sep 2023 12:18:18 +0000 (21:18 +0900)] 
gh-105323: Update readline module to detect apple editline variant (gh-108665)

2 years agogh-110088, gh-109878: Fix test_asyncio timeouts (#110092)
Victor Stinner [Fri, 29 Sep 2023 11:49:30 +0000 (13:49 +0200)] 
gh-110088, gh-109878: Fix test_asyncio timeouts (#110092)

Fix test_asyncio timeouts: don't measure the maximum duration, a test
should not measure a CI performance. Only measure the minimum
duration when a task has a timeout or delay. Add CLOCK_RES to
test_asyncio.utils.

2 years agogh-109634: Fix `:samp:` syntax (GH-110073)
Jacob Coffee [Fri, 29 Sep 2023 11:21:34 +0000 (06:21 -0500)] 
gh-109634: Fix `:samp:` syntax (GH-110073)

2 years agogh-108716: make regen-global-objects no longer builds deepfreeze.c (#110078)
Victor Stinner [Fri, 29 Sep 2023 10:17:49 +0000 (12:17 +0200)] 
gh-108716: make regen-global-objects no longer builds deepfreeze.c (#110078)

Remove more references to now unused Python/deepfreeze/deepfreeze.c.

2 years agogh-110079: Remove extern "C" { ...} in C code (#110080)
Victor Stinner [Fri, 29 Sep 2023 08:56:49 +0000 (10:56 +0200)] 
gh-110079: Remove extern "C" { ...} in C code (#110080)

2 years agogh-101100: Fix references to ``URLError`` and ``HTTPError`` in ``howto/urllib2.rst...
Yuki K [Fri, 29 Sep 2023 08:35:29 +0000 (17:35 +0900)] 
gh-101100: Fix references to ``URLError`` and ``HTTPError`` in ``howto/urllib2.rst`` (#107966)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-101100: Fix Sphinx warnings in `tutorial/controlflow.rst` (#109424)
Maciej Olko [Fri, 29 Sep 2023 08:27:43 +0000 (10:27 +0200)] 
gh-101100: Fix Sphinx warnings in `tutorial/controlflow.rst` (#109424)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agogh-109961: Use proper `module` for `copy` method docs (#110027)
Nikita Sobolev [Fri, 29 Sep 2023 08:26:55 +0000 (11:26 +0300)] 
gh-109961: Use proper `module` for `copy` method docs (#110027)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agogh-101100: Fix sphinx warnings in `library/difflib.rst` (#110074)
Nikita Sobolev [Fri, 29 Sep 2023 08:03:59 +0000 (11:03 +0300)] 
gh-101100: Fix sphinx warnings in `library/difflib.rst` (#110074)

2 years agogh-109868: Skip deepcopy memo check for empty memo (GH-109869)
Pieter Eendebak [Fri, 29 Sep 2023 07:28:01 +0000 (09:28 +0200)] 
gh-109868: Skip deepcopy memo check for empty memo (GH-109869)

2 years agogh-110045: Update symtable module for PEP 695 (#110066)
Jelle Zijlstra [Fri, 29 Sep 2023 02:08:04 +0000 (19:08 -0700)] 
gh-110045: Update symtable module for PEP 695 (#110066)

2 years agogh-110052: Fix faulthandler for freed tstate (#110069)
Victor Stinner [Fri, 29 Sep 2023 02:04:06 +0000 (04:04 +0200)] 
gh-110052: Fix faulthandler for freed tstate (#110069)

faulthandler now detected freed interp and freed tstate, and no
longer dereference them.

2 years agogh-109566: regrtest _add_python_opts() handles KeyboardInterrupt (#110062)
Victor Stinner [Fri, 29 Sep 2023 00:51:22 +0000 (02:51 +0200)] 
gh-109566: regrtest _add_python_opts() handles KeyboardInterrupt (#110062)

In the subprocess code path, wait until the child process completes
with a timeout of EXIT_TIMEOUT seconds.

Fix create_worker_process() regression: use start_new_session=True if
USE_PROCESS_GROUP is true.

WorkerThread.wait_stopped() uses a timeout of 60 seconds, instead of
30 seconds.

2 years agogh-110036: multiprocessing Popen.terminate() catches PermissionError (#110037)
Victor Stinner [Fri, 29 Sep 2023 00:41:12 +0000 (02:41 +0200)] 
gh-110036: multiprocessing Popen.terminate() catches PermissionError (#110037)

On Windows, multiprocessing Popen.terminate() now catchs
PermissionError and get the process exit code. If the process is
still running, raise again the PermissionError. Otherwise, the
process terminated as expected: store its exit code.

2 years agogh-109974: Fix threading lock_tests race conditions (#110057)
Victor Stinner [Fri, 29 Sep 2023 00:34:27 +0000 (02:34 +0200)] 
gh-109974: Fix threading lock_tests race conditions (#110057)

Fix race conditions in test_threading lock tests. Wait until a
condition is met rather than using time.sleep() with a hardcoded
number of seconds.

* Replace sleeping loops with support.sleeping_retry() which raises
  an exception on timeout.
* Add wait_threads_blocked(nthread) which computes a sleep depending
  on the number of threads. Remove _wait() function.
* test_set_and_clear(): use a way longer Event.wait() timeout.
* BarrierTests.test_repr(): wait until the 2 threads are waiting for
  the barrier. Use a way longer timeout for Barrier.wait() timeout.
* test_thread_leak() no longer needs to count
  len(threading.enumerate()): Bunch uses
  threading_helper.wait_threads_exit() internally which does it in
  wait_for_finished().
* Add BaseLockTests.wait_phase() which implements a timeout.
  test_reacquire() and test_recursion_count() use wait_phase().

2 years agogh-109960: Remove test_pty timeout of 10 seconds (#110058)
Victor Stinner [Fri, 29 Sep 2023 00:01:24 +0000 (02:01 +0200)] 
gh-109960: Remove test_pty timeout of 10 seconds (#110058)

In 2003, test_pty got a hardcoded timeout of 10 seconds to prevent
hanging on AIX & HPUX "if run after test_openpty":
commit 7d8145268ee282f14d6adce9305dc3c1c7ffec14. Since 2003, test_pty
was no longer reported to hang on AIX. But today, the test can fail
simply because a CI is busy running other tests in parallel.
The timeout of 10 seconds is no longer needed, just remove it.
Moreover, regrtest now has multiple built-in generic timeout
mecanisms.

2 years agogh-109991: Remove obsolete NEWS entries for OpenSSL 3.0.10 (GH-110055)
Zachary Ware [Thu, 28 Sep 2023 22:58:49 +0000 (17:58 -0500)] 
gh-109991: Remove obsolete NEWS entries for OpenSSL 3.0.10 (GH-110055)

2 years agogh-109991: Update Windows build to use OpenSSL 3.0.11 (GH-110054)
Zachary Ware [Thu, 28 Sep 2023 22:58:13 +0000 (17:58 -0500)] 
gh-109991: Update Windows build to use OpenSSL 3.0.11 (GH-110054)

2 years agogh-109889: fix compiler's redundant NOP detection to look past NOPs with no lineno...
Irit Katriel [Thu, 28 Sep 2023 19:33:28 +0000 (20:33 +0100)] 
gh-109889: fix compiler's redundant NOP detection to look past NOPs with no lineno when looking for the next instruction's lineno (#109987)

2 years agogh-110038: KqueueSelector must count all read/write events (#110039)
Davide Rizzo [Thu, 28 Sep 2023 17:25:10 +0000 (19:25 +0200)] 
gh-110038: KqueueSelector must count all read/write events (#110039)

2 years agogh-110033: Fix signal test_interprocess_signal() (#110035)
Victor Stinner [Thu, 28 Sep 2023 17:12:11 +0000 (19:12 +0200)] 
gh-110033: Fix signal test_interprocess_signal() (#110035)

Fix test_interprocess_signal() of test_signal. Make sure that the
subprocess.Popen object is deleted before the test raising an
exception in a signal handler. Otherwise, Popen.__del__() can get the
exception which is logged as "Exception ignored in: ...." and the
test fails.

2 years agogh-109972: Enhance test_gdb (#110026)
Victor Stinner [Thu, 28 Sep 2023 17:04:01 +0000 (19:04 +0200)] 
gh-109972: Enhance test_gdb (#110026)

* Split test_pycfunction.py: add test_cfunction_full.py.
  Split the function into the following 6 functions. In verbose
  mode, these "pycfunction" tests now log each tested call.

  * test_pycfunction_noargs()
  * test_pycfunction_o()
  * test_pycfunction_varargs()
  * test_pycfunction_varargs_keywords()
  * test_pycfunction_fastcall()
  * test_pycfunction_fastcall_keywords()

* Move get_gdb_repr() to PrettyPrintTests.
* Replace DebuggerTests.get_sample_script() with SAMPLE_SCRIPT.
* Rename checkout_hook_path to CHECKOUT_HOOK_PATH.
* Rename gdb_version to GDB_VERSION_TEXT.
* Replace (gdb_major_version, gdb_minor_version) with GDB_VERSION.
* run_gdb() uses "backslashreplace" error handler instead of "replace".
* Add check_gdb() function to util.py.
* Enhance support.check_cflags_pgo(): check also for sysconfig
  PGO_PROF_USE_FLAG (if available) in compiler flags.
* Move some SkipTest checks to test_gdb/__init__.py.
* Elaborate why gdb cannot be tested on Windows: gdb doesn't support
  PDB debug symbol files.

2 years agoWhitespace fix in asyncio-stream.rst (#110015)
Davide Rizzo [Thu, 28 Sep 2023 16:34:35 +0000 (18:34 +0200)] 
Whitespace fix in asyncio-stream.rst (#110015)

2 years agogh-109782: Ensure `os.path.isdir` has the same signature on all platforms (GH-109790)
Amin Alaee [Thu, 28 Sep 2023 15:17:30 +0000 (17:17 +0200)] 
gh-109782: Ensure `os.path.isdir` has the same signature on all platforms (GH-109790)

2 years agogh-110020: Fix unused variable warnings in bytecodes.c (GH-110023)
Nikita Sobolev [Thu, 28 Sep 2023 14:31:32 +0000 (17:31 +0300)] 
gh-110020: Fix unused variable warnings in bytecodes.c (GH-110023)

2 years agogh-109594: Fix concurrent.futures test_timeout() (#110018)
Victor Stinner [Thu, 28 Sep 2023 13:21:15 +0000 (15:21 +0200)] 
gh-109594: Fix concurrent.futures test_timeout() (#110018)

Fix test_timeout() of test_concurrent_futures.test_wait. Remove the
future which may or may not complete depending if it takes longer
than the timeout ot not. Keep the second future which does not
complete before wait(). Make also the test faster: 0.5 second instead
of 6 seconds, so remove @support.requires_resource('walltime')
decorator.

2 years agogh-109961: Docs: Fix incorrect rendering of `__replace__` in `copy.rst` (#109968)
Nikita Sobolev [Thu, 28 Sep 2023 11:51:33 +0000 (14:51 +0300)] 
gh-109961: Docs: Fix incorrect rendering of `__replace__` in `copy.rst` (#109968)

2 years agogh-109972: Split test_gdb.py into test_gdb package (#109977)
Victor Stinner [Thu, 28 Sep 2023 11:24:15 +0000 (13:24 +0200)] 
gh-109972: Split test_gdb.py into test_gdb package (#109977)

Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().

2 years agogh-109991: Update macOS installer to use OpenSSL 3.0.10. (GH-110003)
Ned Deily [Thu, 28 Sep 2023 06:08:39 +0000 (02:08 -0400)] 
gh-109991: Update macOS installer to use OpenSSL 3.0.10. (GH-110003)

2 years agogh-109991: Update GitHub CI workflows to use OpenSSL 3.0.11 and multissltests to...
Ned Deily [Thu, 28 Sep 2023 04:45:13 +0000 (00:45 -0400)] 
gh-109991: Update GitHub CI workflows to use OpenSSL 3.0.11 and multissltests to use 1.1.1w, 3.0.11, and 3.1.3. (gh-110002)

2 years agoGH-109190: Copyedit 3.12 What's New: Bytecode (#109821)
Adam Turner [Thu, 28 Sep 2023 04:40:59 +0000 (05:40 +0100)] 
GH-109190: Copyedit 3.12 What's New: Bytecode (#109821)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-109812: Fix phrasing for `collections.Counter` (gh-109813)
Jacob Coffee [Thu, 28 Sep 2023 02:29:39 +0000 (21:29 -0500)] 
gh-109812: Fix phrasing for `collections.Counter` (gh-109813)

2 years agogh-109818: `reprlib.recursive_repr` copies `__type_params__` (#109819)
Nikita Sobolev [Thu, 28 Sep 2023 02:26:42 +0000 (05:26 +0300)] 
gh-109818: `reprlib.recursive_repr` copies `__type_params__` (#109819)

2 years agogh-104909: Split some more insts into ops (#109943)
Guido van Rossum [Wed, 27 Sep 2023 22:27:44 +0000 (15:27 -0700)] 
gh-104909: Split some more insts into ops (#109943)

These are the most popular specializations of `LOAD_ATTR` and `STORE_ATTR`
that weren't already viable uops:

* Split LOAD_ATTR_METHOD_WITH_VALUES
* Split LOAD_ATTR_METHOD_NO_DICT
* Split LOAD_ATTR_SLOT
* Split STORE_ATTR_SLOT
* Split STORE_ATTR_INSTANCE_VALUE

Also:

* Add `-v` flag to code generator which prints a list of non-viable uops
  (easter-egg: it can print execution counts -- see source)
* Double _Py_UOP_MAX_TRACE_LENGTH to 128

I had dropped one of the DEOPT_IF() calls! :-(

2 years agogh-109955 : Update state transition comments for asyncio.Task (#109910)
Kristján Valur Jónsson [Wed, 27 Sep 2023 22:24:10 +0000 (22:24 +0000)] 
gh-109955 : Update state transition comments for asyncio.Task (#109910)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agogh-109793: Allow Switching Interpreters During Finalization (gh-109794)
Eric Snow [Wed, 27 Sep 2023 19:41:06 +0000 (13:41 -0600)] 
gh-109793: Allow Switching Interpreters During Finalization (gh-109794)

Essentially, we should check the thread ID rather than the thread state pointer.

2 years agoEnhance TypedDict docs around required/optional keys (#109547)
Jelle Zijlstra [Wed, 27 Sep 2023 17:35:46 +0000 (10:35 -0700)] 
Enhance TypedDict docs around required/optional keys (#109547)

As discussed in comments to #109544, the semantics of this attribute
are somewhat confusing. Add a note explaining its limitations and
steering users towards __required_keys__ and __optional_keys__ instead.

2 years agogh-109461: Update logging module lock to use context manager (#109462)
Dale Collison [Wed, 27 Sep 2023 16:26:41 +0000 (17:26 +0100)] 
gh-109461: Update logging module lock to use context manager (#109462)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years agogh-109615: Fix support test_copy_python_src_ignore() on WASM (#109970)
Victor Stinner [Wed, 27 Sep 2023 15:29:20 +0000 (17:29 +0200)] 
gh-109615: Fix support test_copy_python_src_ignore() on WASM (#109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.

2 years agogh-109740: Use 't' in `--disable-gil` SOABI (#109922)
Sam Gross [Wed, 27 Sep 2023 15:24:12 +0000 (11:24 -0400)] 
gh-109740: Use 't' in `--disable-gil` SOABI (#109922)

Shared libraries for CPython 3.13 are now marked with a 't' for
threading. For example, `binascii.cpython-313t-darwin.so`.

2 years agoGH-109190: Copyedit 3.12 What's New: Release highlights (#109770)
Adam Turner [Wed, 27 Sep 2023 14:31:55 +0000 (15:31 +0100)] 
GH-109190: Copyedit 3.12 What's New: Release highlights (#109770)

2 years agogh-109566: regrtest doesn't enable --rerun if --python is used (#109969)
Victor Stinner [Wed, 27 Sep 2023 14:09:23 +0000 (16:09 +0200)] 
gh-109566: regrtest doesn't enable --rerun if --python is used (#109969)

regrtest: --fast-ci and --slow-ci options no longer enable --rerun if
the --python option is used.

2 years agogh-101100: Fix sphinx warnings in `library/devmode.rst` (#109963)
Nikita Sobolev [Wed, 27 Sep 2023 13:07:28 +0000 (16:07 +0300)] 
gh-101100: Fix sphinx warnings in `library/devmode.rst` (#109963)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agogh-109923: set line number on the POP_TOP that follows a RETURN_GENERATOR (#109924)
Irit Katriel [Wed, 27 Sep 2023 12:24:33 +0000 (13:24 +0100)] 
gh-109923: set line number on the POP_TOP that follows a RETURN_GENERATOR (#109924)

2 years agogh-109615: Fix support test_copy_python_src_ignore() (#109958)
Victor Stinner [Wed, 27 Sep 2023 10:32:12 +0000 (12:32 +0200)] 
gh-109615: Fix support test_copy_python_src_ignore() (#109958)

Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".

2 years agogh-109566: Fix regrtest Python options for WASM/WASI (#109954)
Victor Stinner [Wed, 27 Sep 2023 10:01:16 +0000 (12:01 +0200)] 
gh-109566: Fix regrtest Python options for WASM/WASI (#109954)

WASM and WASI buildbots use multiple PYTHON environment variables
such as PYTHONPATH and _PYTHON_HOSTRUNNER. Don't use -E if the
--python=COMMAND option is used.

2 years agogh-109565: Fix concurrent.futures test_future_times_out() (#109949)
Victor Stinner [Wed, 27 Sep 2023 08:51:44 +0000 (10:51 +0200)] 
gh-109565: Fix concurrent.futures test_future_times_out() (#109949)

as_completed() uses a timeout of 100 ms instead of 10 ms. Windows
monotonic clock resolution is around 15.6 ms.

2 years agogh-109615: Fix test_tools.test_freeze SRCDIR (#109935)
Victor Stinner [Wed, 27 Sep 2023 08:18:39 +0000 (10:18 +0200)] 
gh-109615: Fix test_tools.test_freeze SRCDIR (#109935)

Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.

2 years agoGH-109190: Copyedit 3.12 What's New: Deprecations (``os`` fix) (#109927)
Adam Turner [Wed, 27 Sep 2023 04:59:42 +0000 (05:59 +0100)] 
GH-109190: Copyedit 3.12 What's New: Deprecations (``os`` fix)  (#109927)

Merge the two ``os`` entries

2 years agoRemove loop from docstring for asyncio.streams.open_connection (#108528)
Tom Gillespie [Wed, 27 Sep 2023 03:34:15 +0000 (23:34 -0400)] 
Remove loop from docstring for asyncio.streams.open_connection (#108528)

2 years agogh-101100: Fix Sphinx warnings in Doc/using/configure.rst (#109931)
Victor Stinner [Wed, 27 Sep 2023 00:01:48 +0000 (02:01 +0200)] 
gh-101100: Fix Sphinx warnings in Doc/using/configure.rst (#109931)

2 years agogh-109098: Fuzz re module instead of internal sre (#109911)
Ammar Askar [Tue, 26 Sep 2023 22:35:49 +0000 (18:35 -0400)] 
gh-109098: Fuzz re module instead of internal sre (#109911)

* gh-109098: Fuzz re module instead of internal sre
* Fix c-analyzer globals test failure
* Put globals exception in ignored.tsv

2 years agogh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (#109928)
Victor Stinner [Tue, 26 Sep 2023 22:26:34 +0000 (00:26 +0200)] 
gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (#109928)

2 years agogh-109566: Fix regrtest code adding Python options (#109926)
Victor Stinner [Tue, 26 Sep 2023 21:59:11 +0000 (23:59 +0200)] 
gh-109566: Fix regrtest code adding Python options (#109926)

* On Windows, use subprocess.run() instead of os.execv().
* Only add needed options
* Rename reexec parameter to _add_python_opts.
* Rename --no-reexec option to --dont-add-python-opts.

2 years agoGH-109190: Copyedit 3.12 What's New: Deprecations (#109766)
Adam Turner [Tue, 26 Sep 2023 21:24:44 +0000 (22:24 +0100)] 
GH-109190: Copyedit 3.12 What's New: Deprecations (#109766)

2 years agoFix argument ordering of embuilder command documented in `Tools/wasm/README.md` ...
OmniTroid [Tue, 26 Sep 2023 20:22:00 +0000 (22:22 +0200)] 
Fix argument ordering of embuilder command documented in `Tools/wasm/README.md` (GH-109863)

2 years agogh-109845: Make test_ftplib more stable under load (GH-109912)
Serhiy Storchaka [Tue, 26 Sep 2023 19:58:46 +0000 (22:58 +0300)] 
gh-109845: Make test_ftplib more stable under load (GH-109912)

recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.

2 years agogh-109276, gh-109508: Fix libregrtest stdout (#109903)
Victor Stinner [Tue, 26 Sep 2023 19:34:50 +0000 (21:34 +0200)] 
gh-109276, gh-109508: Fix libregrtest stdout (#109903)

Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.

2 years agoRemove concurrent.futures deadcode: process_result_item() (#109906)
Victor Stinner [Tue, 26 Sep 2023 19:33:59 +0000 (21:33 +0200)] 
Remove concurrent.futures deadcode: process_result_item() (#109906)

process_result_item() cannot be called with an int anymore, the
protocol changed.

2 years agogh-109566: regrtest reexecutes the process (#109909)
Victor Stinner [Tue, 26 Sep 2023 18:46:52 +0000 (20:46 +0200)] 
gh-109566: regrtest reexecutes the process (#109909)

When --fast-ci or --slow-ci option is used, regrtest now replaces the
current process with a new process to add "-u -W default -bb -E"
options to Python.

Changes:

* PCbuild/rt.bat and Tools/scripts/run_tests.py no longer need to add
  "-u -W default -bb -E" options to Python: it's now done by
  regrtest.
* Fix Tools/scripts/run_tests.py: flush stdout before replacing the
  process. Previously, buffered messages were lost.

2 years agoGH-109187: Improve symlink loop handling in `pathlib.Path.resolve()` (GH-109192)
Barney Gale [Tue, 26 Sep 2023 16:57:17 +0000 (17:57 +0100)] 
GH-109187: Improve symlink loop handling in `pathlib.Path.resolve()` (GH-109192)

Treat symlink loops like other errors: in strict mode, raise `OSError`, and
in non-strict mode, do not raise any exception.

2 years agogh-109566, regrtest: Add --fast-ci and --slow-ci options (#109570)
Victor Stinner [Tue, 26 Sep 2023 15:22:50 +0000 (17:22 +0200)] 
gh-109566, regrtest: Add --fast-ci and --slow-ci options (#109570)

* Add --fast-ci and --slow-ci options to libregrtest:

  * --fast-ci uses a default timeout of 10 minutes and "-u all,-cpu"
    (skip slowest tests).
  * --slow-ci uses a default timeout of 20 minues and "-u all" (run
    all tests).

* regrtest header now lists test resources.
* Makefile changes:

  * "make test", "make hostrunnertest" and "make coverage-report" now
    use --fast-ci option and TESTTIMEOUT variable.
  * "make buildbottest" now uses "--slow-ci". Remove options which
    became redundant with "--slow-ci".
  * "make testall" and "make testuniversal" now use --slow-ci option
    and TESTTIMEOUT variable.
  * "make testall" now uses "find -exec rm ..." instead of
    "find ... -print|xargs rm ...", same as "make clean".

* GitHub Actions workflow:

  * Ubuntu and Address Sanitizer jobs now use "make test". Remove
    options which became redundant with "--fast-ci".
  * Windows jobs now use --fast-ci option.
  * Use -j0 to detect the number of CPUs.

* Set Makefile TESTTIMEOUT default to an empty string, since
  --slow-ci and --fast-ci use different default timeout. It's now
  accepted to pass "--timeout=" to regrtest: treated as not timeout.
* Tools/scripts/run_tests.py now uses --fast-ci option.
* Tools/buildbot/test.bat now uses --slow-ci option. Remove
  --timeout=1200 option, redundant with --slow-ci.

2 years agoMore informative docstrings in the random module (gh-109745)
Raymond Hettinger [Tue, 26 Sep 2023 13:20:17 +0000 (08:20 -0500)] 
More informative docstrings in the random module (gh-109745)

2 years agono-issue: Fix a typo in the parameter name of random.expovariate. (gh-109902)
lohaswinner [Tue, 26 Sep 2023 13:12:32 +0000 (22:12 +0900)] 
no-issue: Fix a typo in the parameter name of random.expovariate. (gh-109902)

2 years agogh-109593: Fix reentrancy issue in multiprocessing resource_tracker (#109629)
Antoine Pitrou [Tue, 26 Sep 2023 11:57:25 +0000 (13:57 +0200)] 
gh-109593: Fix reentrancy issue in multiprocessing resource_tracker (#109629)

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-109832: concurrent.futures test_deadlock restores sys.stderr (#109887)
Victor Stinner [Tue, 26 Sep 2023 10:43:45 +0000 (12:43 +0200)] 
gh-109832: concurrent.futures test_deadlock restores sys.stderr (#109887)

test_error_at_task_unpickle() and
test_error_during_result_unpickle_in_result_handler() now restore
sys.stderr which is overriden by _raise_error_ignore_stderr().

2 years agogh-109631: Allow interruption of short repeated regex matches (GH-109867)
Serhiy Storchaka [Tue, 26 Sep 2023 07:56:33 +0000 (10:56 +0300)] 
gh-109631: Allow interruption of short repeated regex matches (GH-109867)

Counting for signal checking now continues in new match from the point where
it ended in the previous match instead of starting from 0.

2 years agogh-101100: Fix Sphinx warnings in `Doc/library/weakref.rst` (#109881)
Nikita Sobolev [Tue, 26 Sep 2023 07:46:09 +0000 (10:46 +0300)] 
gh-101100: Fix Sphinx warnings in `Doc/library/weakref.rst` (#109881)

2 years agogh-109370: Fix unexpected traceback output in test_concurrent_futures (GH-109780)
Serhiy Storchaka [Tue, 26 Sep 2023 07:06:07 +0000 (10:06 +0300)] 
gh-109370: Fix unexpected traceback output in test_concurrent_futures (GH-109780)

Follow-up of gh-107219.

* Only close the connection writer on Windows.
* Also use existing constant _winapi.ERROR_OPERATION_ABORTED instead of
  WSA_OPERATION_ABORTED.

2 years agogh-109739: regrtest disables load tracker if refleak (#109871)
Victor Stinner [Tue, 26 Sep 2023 01:05:07 +0000 (03:05 +0200)] 
gh-109739: regrtest disables load tracker if refleak (#109871)

regrtest: Fix reference leak check on Windows. Disable the load
tracker on Windows in the reference leak check mode (-R option).

2 years agogh-109401: Fix threading barrier test_default_timeout() (#109875)
Victor Stinner [Tue, 26 Sep 2023 00:07:12 +0000 (02:07 +0200)] 
gh-109401: Fix threading barrier test_default_timeout() (#109875)

Increase timeouts. Barrier default timeout should be long enough to
spawn 4 threads on a slow CI.

2 years agogh-88233: zipfile: refactor _strip_extra (#102084)
Jason R. Coombs [Mon, 25 Sep 2023 23:46:58 +0000 (19:46 -0400)] 
gh-88233: zipfile: refactor _strip_extra (#102084)

* Refactor zipfile._strip_extra to use higher level abstractions for extras instead of a heavy-state loop.

* Add blurb

* Remove _strip_extra and use _Extra.strip directly.

* Use memoryview to avoid unnecessary copies while splitting Extras.

2 years agogh-109748: Fix venv test_zippath_from_non_installed_posix() (#109872)
Victor Stinner [Mon, 25 Sep 2023 23:16:30 +0000 (01:16 +0200)] 
gh-109748: Fix venv test_zippath_from_non_installed_posix() (#109872)

Fix test_zippath_from_non_installed_posix() of test_venv: don't copy
__pycache__/ sub-directories, because they can be modified by other
Python tests running in parallel.

2 years agogh-109823: Adjust labels in compiler when removing an empty basic block which is...
Irit Katriel [Mon, 25 Sep 2023 18:25:05 +0000 (19:25 +0100)] 
gh-109823: Adjust labels in compiler when removing an empty basic block which is a jump target (#109839)

2 years agogh-109599: Add types.CapsuleType (#109600)
Antoine Pitrou [Mon, 25 Sep 2023 17:50:39 +0000 (19:50 +0200)] 
gh-109599: Add types.CapsuleType (#109600)

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-89363: Skip threading test_is_alive_after_fork() if ASAN (#109835)
Victor Stinner [Mon, 25 Sep 2023 16:02:04 +0000 (18:02 +0200)] 
gh-89363: Skip threading test_is_alive_after_fork() if ASAN (#109835)

Skip test_is_alive_after_fork() of test_threading if Python is built
with Address Sanitizer (ASAN).

2 years agogh-109795: `_thread.start_new_thread`: allocate thread bootstate using raw memory...
Radislav Chugunov [Mon, 25 Sep 2023 15:38:06 +0000 (18:38 +0300)] 
gh-109795: `_thread.start_new_thread`: allocate thread bootstate using raw memory allocator (#109808)

2 years agoCode: Update Donghee Na's name (#109744)
Hugo van Kemenade [Mon, 25 Sep 2023 15:17:34 +0000 (09:17 -0600)] 
Code: Update Donghee Na's name (#109744)