]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-109653: Reduce the import time of `random` by 60% (#110221)
Alex Waygood [Mon, 2 Oct 2023 22:56:31 +0000 (23:56 +0100)] 
gh-109653: Reduce the import time of `random` by 60% (#110221)

2 years agogh-110241: Add missing error check to `record_eval` in `_testinternalcapi` (#110242)
Nikita Sobolev [Mon, 2 Oct 2023 21:19:32 +0000 (00:19 +0300)] 
gh-110241: Add missing error check to `record_eval` in `_testinternalcapi` (#110242)

2 years agogh-76785: Module-level Fixes for test.support.interpreters (gh-110236)
Eric Snow [Mon, 2 Oct 2023 20:47:41 +0000 (14:47 -0600)] 
gh-76785: Module-level Fixes for test.support.interpreters (gh-110236)

* add RecvChannel.close() and SendChannel.close()
* make RecvChannel and SendChannel shareable
* expose ChannelEmptyError and ChannelNotEmptyError

2 years agoEnable ruff on `Lib/test/test_typing.py` (#110179)
Alex Waygood [Mon, 2 Oct 2023 20:13:48 +0000 (21:13 +0100)] 
Enable ruff on `Lib/test/test_typing.py` (#110179)

2 years agogh-105716: Support Background Threads in Subinterpreters Consistently (gh-109921)
Eric Snow [Mon, 2 Oct 2023 20:12:12 +0000 (14:12 -0600)] 
gh-105716: Support Background Threads in Subinterpreters Consistently (gh-109921)

The existence of background threads running on a subinterpreter was preventing interpreters from getting properly destroyed, as well as impacting the ability to run the interpreter again. It also affected how we wait for non-daemon threads to finish.

We add PyInterpreterState.threads.main, with some internal C-API functions.

2 years agogh-109853: Fix sys.path[0] For Subinterpreters (gh-109994)
Eric Snow [Mon, 2 Oct 2023 19:59:05 +0000 (13:59 -0600)] 
gh-109853: Fix sys.path[0] For Subinterpreters (gh-109994)

This change makes sure sys.path[0] is set properly for subinterpreters. Before, it wasn't getting set at all. This PR does not address the broader concerns from gh-109853.

2 years agogh-107073: Make PyObject_VisitManagedDict() public (#108763)
Victor Stinner [Mon, 2 Oct 2023 17:24:08 +0000 (19:24 +0200)] 
gh-107073: Make PyObject_VisitManagedDict() public (#108763)

Make PyObject_VisitManagedDict() and PyObject_ClearManagedDict()
functions public in Python 3.13 C API.

* Rename _PyObject_VisitManagedDict() to PyObject_VisitManagedDict().
* Rename _PyObject_ClearManagedDict() to PyObject_ClearManagedDict().
* Document these functions.

2 years agogh-108494: Document how to add a project in PCbuild/readme.txt (#110077)
Victor Stinner [Mon, 2 Oct 2023 16:53:38 +0000 (18:53 +0200)] 
gh-108494: Document how to add a project in PCbuild/readme.txt (#110077)

Add _testclinic_limited to Tools/msi/test/test_files.wxs.

2 years agogh-110014: Remove PY_TIMEOUT_MAX from limited C API (#110217)
Victor Stinner [Mon, 2 Oct 2023 16:07:56 +0000 (18:07 +0200)] 
gh-110014: Remove PY_TIMEOUT_MAX from limited C API (#110217)

If the timeout is greater than PY_TIMEOUT_MAX,
PyThread_acquire_lock_timed() uses a timeout of PY_TIMEOUT_MAX
microseconds, which is around 280.6 years. This case is unlikely and
limiting a timeout to 280.6 years sounds like a reasonable trade-off.

The constant PY_TIMEOUT_MAX is not used in PyPI top 5,000 projects.

2 years agogh-110178: Use fewer weakrefs in test_typing.py (#110194)
Jelle Zijlstra [Mon, 2 Oct 2023 15:03:53 +0000 (08:03 -0700)] 
gh-110178: Use fewer weakrefs in test_typing.py (#110194)

Confirmed that without the C changes from #108517, this test still segfaults with only 10 weakrefs.

2 years ago3.12 What's New: Remove duplicate "up to" (#110219)
numbermaniac [Mon, 2 Oct 2023 13:13:44 +0000 (00:13 +1100)] 
3.12 What's New: Remove duplicate "up to" (#110219)

2 years agogh-83180: Made launcher treat shebang 'python' tags as low priority so that active...
Steve Dower [Mon, 2 Oct 2023 12:22:55 +0000 (13:22 +0100)] 
gh-83180: Made launcher treat shebang 'python' tags as low priority so that active virtual environments are preferred (GH-108101)

2 years agoGH-109190: Announce final release in What's New in Python 3.12 (#110117)
Adam Turner [Mon, 2 Oct 2023 11:15:58 +0000 (12:15 +0100)] 
GH-109190: Announce final release in What's New in Python 3.12 (#110117)

Prepare What's New in Python 3.12 for final release

2 years agogh-108963: using random to generate unique string in sys.intern test (#109491)
AN Long [Mon, 2 Oct 2023 11:07:56 +0000 (19:07 +0800)] 
gh-108963: using random to generate unique string in sys.intern test (#109491)

2 years agoGH-92584: Move installation schemes overview to sysconfig docs (#108018)
Adam Turner [Mon, 2 Oct 2023 10:40:03 +0000 (11:40 +0100)] 
GH-92584: Move installation schemes overview to sysconfig docs (#108018)

* Add new installation path functions subsection

* Add content from install/index to sysconfig

* Fix table

* Update note about installers

* Clean up the list of schemes, remove references to Distutils

2 years agoDocs: bump Pygments to fix contrast ratios to meet WCAG AA guidelines (#110208)
Hugo van Kemenade [Mon, 2 Oct 2023 10:31:23 +0000 (04:31 -0600)] 
Docs: bump Pygments to fix contrast ratios to meet WCAG AA guidelines (#110208)

2 years agogh-109590: Update shutil.which on Windows to prefer a PATHEXT extension on executable...
Charles Machalow [Mon, 2 Oct 2023 08:27:30 +0000 (01:27 -0700)] 
gh-109590: Update shutil.which on Windows to prefer a PATHEXT extension on executable files (GH-109995)

The default arguments for shutil.which() request an executable file, but extensionless files are not executable on Windows and should be ignored.

2 years agofix misaligned versionchanged blocks in sqlite3 docs (GH-110191)
Ned Batchelder [Mon, 2 Oct 2023 03:34:09 +0000 (23:34 -0400)] 
fix misaligned versionchanged blocks in sqlite3 docs (GH-110191)

2 years agogh-110164: regrtest disables random if SOURCE_DATE_EPOCH (#110168)
Victor Stinner [Sun, 1 Oct 2023 20:41:03 +0000 (22:41 +0200)] 
gh-110164: regrtest disables random if SOURCE_DATE_EPOCH (#110168)

If the SOURCE_DATE_EPOCH environment variable is defined, regrtest
now disables randomization of tests.

2 years agogh-110138: Improve grammar in idiomatic usage of ``__main__.py`` (#110142)
Quentin Agren [Sun, 1 Oct 2023 18:32:43 +0000 (14:32 -0400)] 
gh-110138: Improve grammar in idiomatic usage of ``__main__.py`` (#110142)

2 years agogh-101100: Fix sphinx warnings in `library/site.rst` (#110144)
Nikita Sobolev [Sun, 1 Oct 2023 17:18:19 +0000 (20:18 +0300)] 
gh-101100: Fix sphinx warnings in `library/site.rst` (#110144)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agobuild(deps): bump hypothesis from 6.84.0 to 6.87.1 in /Tools (#110174)
dependabot[bot] [Sun, 1 Oct 2023 16:25:29 +0000 (17:25 +0100)] 
build(deps): bump hypothesis from 6.84.0 to 6.87.1 in /Tools (#110174)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.84.0 to 6.87.1.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.84.0...hypothesis-python-6.87.1)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agogh-110180: Remove unused `_PickleUsingNameMixin` class from `typing` (#110181)
Alex Waygood [Sun, 1 Oct 2023 15:28:02 +0000 (16:28 +0100)] 
gh-110180: Remove unused `_PickleUsingNameMixin` class from `typing` (#110181)

2 years agoGH-107465: Add `pathlib.Path.from_uri()` classmethod. (#107640)
Barney Gale [Sun, 1 Oct 2023 15:14:02 +0000 (16:14 +0100)] 
GH-107465: Add `pathlib.Path.from_uri()` classmethod. (#107640)

This method supports file URIs (including variants) as described in RFC 8089, such as URIs generated by `pathlib.Path.as_uri()` and `urllib.request.pathname2url()`.

The method is added to `Path` rather than `PurePath` because it uses `os.fsdecode()`, and so its results vary from system to system. I intend to deprecate `PurePath.as_uri()` and move it to `Path` for the same reason.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agogh-110160: Fix flaky `test_find_periodic_pattern` in `string_tests` (#110170)
Nikita Sobolev [Sun, 1 Oct 2023 14:20:01 +0000 (17:20 +0300)] 
gh-110160: Fix flaky `test_find_periodic_pattern` in `string_tests` (#110170)

2 years agoPEG generator: bump types-setuptools from 68.1.0.1 to 68.2.0.0 (#110175)
dependabot[bot] [Sun, 1 Oct 2023 11:38:46 +0000 (12:38 +0100)] 
PEG generator: bump types-setuptools from 68.1.0.1 to 68.2.0.0 (#110175)

build(deps-dev): bump types-setuptools in /Tools

Bumps [types-setuptools](https://github.com/python/typeshed) from 68.1.0.1 to 68.2.0.0.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-setuptools
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agogh-110150: Fix base case handling in quantiles() (gh-110151)
Raymond Hettinger [Sun, 1 Oct 2023 04:35:54 +0000 (23:35 -0500)] 
gh-110150: Fix base case handling in quantiles() (gh-110151)

2 years agogh-109649: Use os.process_cpu_count() (#110165)
Victor Stinner [Sun, 1 Oct 2023 01:14:57 +0000 (03:14 +0200)] 
gh-109649: Use os.process_cpu_count() (#110165)

Replace os.cpu_count() with os.process_cpu_count() in modules:

* compileall
* concurrent.futures
* multiprocessing

Replace os.cpu_count() with os.process_cpu_count() in programs:

* _decimal deccheck.py test
* freeze.py
* multissltests.py
* python -m test (regrtest)
* wasm_build.py

Other changes:

* test.pythoninfo logs os.process_cpu_count().
* regrtest gets os.process_cpu_count() / os.cpu_count() in headers.

2 years agogh-110152: regrtest handles cross compilation and HOSTRUNNER (#110156)
Victor Stinner [Sat, 30 Sep 2023 22:37:23 +0000 (00:37 +0200)] 
gh-110152: regrtest handles cross compilation and HOSTRUNNER (#110156)

* _add_python_opts() now handles cross compilation and HOSTRUNNER.
* display_header() now tells if Python is cross-compiled, display
  HOSTRUNNER, and get the host platform.
* Remove Tools/scripts/run_tests.py script.
* Remove "make hostrunnertest": use "make buildbottest"
  or "make test" instead.

2 years agogh-110014: Fix bootstrap_hash.c: remove debug code (#110161)
Victor Stinner [Sat, 30 Sep 2023 22:21:20 +0000 (00:21 +0200)] 
gh-110014: Fix bootstrap_hash.c: remove debug code (#110161)

Oops, I commited debug code by mistake, sorry about that.

2 years agogh-109649: Add os.process_cpu_count() function (#109907)
Victor Stinner [Sat, 30 Sep 2023 22:12:51 +0000 (00:12 +0200)] 
gh-109649: Add os.process_cpu_count() function (#109907)

* Refactor os_sched_getaffinity_impl(): move variable definitions to
  their first assignment.
* Fix test_posix.test_sched_getaffinity(): restore the old CPU mask
  when the test completes!
* Doc: Specify that os.cpu_count() counts *logicial* CPUs.
* Doc: Specify that os.sched_getaffinity(0) is related to the calling
  thread.

2 years agogh-109276: regrtest: add WORKER_FAILED state (#110148)
Victor Stinner [Sat, 30 Sep 2023 20:48:26 +0000 (22:48 +0200)] 
gh-109276: regrtest: add WORKER_FAILED state (#110148)

Rename WORKER_ERROR to WORKER_BUG. Add WORKER_FAILED state: it does
not stop the manager, whereas WORKER_BUG does.

Change also TestResults.display_result() order: display failed tests
at the end, the important important information.

WorkerThread now tries to get the signal name for negative exit code.

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.