]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
10 months agogh-128014: Fix passing default='' to the tkinter method wm_iconbitmap() (GH-128015)
Zhikang Yan [Thu, 2 Jan 2025 15:51:57 +0000 (23:51 +0800)] 
gh-128014:  Fix passing default='' to the tkinter method wm_iconbitmap() (GH-128015)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
10 months agoRevert "Doc: Show object descriptions in the table of contents (#125757)" (#128406)
Hugo van Kemenade [Thu, 2 Jan 2025 14:35:00 +0000 (16:35 +0200)] 
Revert "Doc: Show object descriptions in the table of contents (#125757)" (#128406)

10 months agogh-128404: Remove ``asyncio`` from ``test_builtin`` (#128403)
Thomas Grainger [Thu, 2 Jan 2025 13:00:26 +0000 (13:00 +0000)] 
gh-128404: Remove ``asyncio`` from ``test_builtin`` (#128403)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
10 months agogh-126624: Expose error code ``XML_ERROR_NOT_STARTED`` of Expat >=2.6.4 (#126625)
Sebastian Pipping [Thu, 2 Jan 2025 12:54:38 +0000 (13:54 +0100)] 
gh-126624: Expose error code ``XML_ERROR_NOT_STARTED`` of Expat >=2.6.4 (#126625)

Expose error code ``XML_ERROR_NOT_STARTED`` in `xml.parsers.expat.errors` which was
introduced in Expat 2.6.4.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
10 months agogh-124130: Fix a bug in matching regular expression \B in empty string (GH-127007)
Serhiy Storchaka [Thu, 2 Jan 2025 12:11:21 +0000 (14:11 +0200)] 
gh-124130: Fix a bug in matching regular expression \B in empty string (GH-127007)

10 months agogh-123925: Fix building curses on platforms without libncursesw (GH-128405)
Serhiy Storchaka [Thu, 2 Jan 2025 11:38:21 +0000 (13:38 +0200)] 
gh-123925: Fix building curses on platforms without libncursesw (GH-128405)

10 months agogh-95371: Add support for other image formats(e.g. PNG) to the turtle… (#95378)
Shin-myoung-serp [Thu, 2 Jan 2025 09:45:07 +0000 (18:45 +0900)] 
gh-95371: Add support for other image formats(e.g. PNG) to the turtle… (#95378)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
10 months agogh-128349: Use `.. data::` instead of `.. class::` for pre-defined decimal `Context...
abkmystery [Thu, 2 Jan 2025 07:20:31 +0000 (01:20 -0600)] 
gh-128349: Use `.. data::` instead of `.. class::` for pre-defined decimal `Context` objects (#128379)

10 months agogh-126469: remove unnecessary error-checking branch in `lexer.c` (#126473)
qqwqqw689 [Wed, 1 Jan 2025 22:11:29 +0000 (06:11 +0800)] 
gh-126469: remove unnecessary error-checking branch in `lexer.c` (#126473)

10 months agoFix while statements with non-bool conditions in `_pyrepl` (#127509)
RUANG (James Roy) [Wed, 1 Jan 2025 20:39:28 +0000 (04:39 +0800)] 
Fix while statements with non-bool conditions in `_pyrepl` (#127509)

Fix non-bool value conditions

10 months agogh-128277: remove unnecessary critical section from `socket.close` (#128305)
Kumar Aditya [Wed, 1 Jan 2025 12:30:47 +0000 (18:00 +0530)] 
gh-128277: remove unnecessary critical section from `socket.close`  (#128305)

Remove unnecessary critical section from `socket.close` as it now uses relaxed atomics for `sock_fd`.

10 months agogh-121676: Raise a ``DeprecationWarning`` if the Python implementation of ``functools...
Kirill Podoprigora [Wed, 1 Jan 2025 11:36:47 +0000 (13:36 +0200)] 
gh-121676: Raise a ``DeprecationWarning`` if the Python implementation of ``functools.reduce`` is called with `function` or `sequence` as a keyword args (#121677)

Python implementation of `functools` allows calling `reduce`
with `function` or `sequence` as keyword args. This doesn't
match behavior of our C accelerator and our documentation
for `functools.reduce` states that `function`and `sequence`
are positional-only arguments.

Now calling a Python implementation of `functools.reduce`
with `function` or `sequence` as keyword args would raise
a `DeprecationWarning` and is planned to be prohibited in
Python 3.16.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
10 months agoReword `about.rst` to not limit Sphinx (#128325)
Stan Ulbrych [Tue, 31 Dec 2024 21:22:33 +0000 (21:22 +0000)] 
Reword `about.rst` to not limit Sphinx (#128325)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
10 months agogh-128277: make globals variables thread safe in socket module (#128286)
Kumar Aditya [Tue, 31 Dec 2024 13:40:06 +0000 (19:10 +0530)] 
gh-128277: make globals variables thread safe in socket module (#128286)

10 months agogh-88834: Unify the instance check for typing.Union and types.UnionType (GH-128363)
Serhiy Storchaka [Tue, 31 Dec 2024 08:02:58 +0000 (10:02 +0200)] 
gh-88834: Unify the instance check for typing.Union and types.UnionType (GH-128363)

Union now uses the instance checks against its parameters instead of
the subclass checks.

10 months agogh-128277: use relaxed atomics for `sock_fd` (#128304)
Kumar Aditya [Tue, 31 Dec 2024 06:20:35 +0000 (11:50 +0530)] 
gh-128277: use relaxed atomics for `sock_fd` (#128304)

10 months agogh-128262: Allow specialization of calls to classes with __slots__ (GH-128263)
Ken Jin [Tue, 31 Dec 2024 04:24:17 +0000 (12:24 +0800)] 
gh-128262: Allow specialization of calls to classes with __slots__ (GH-128263)

10 months agogh-128342: Specify timeout unit in subprocess docstrings (GH-128343)
n-l-i [Mon, 30 Dec 2024 20:52:04 +0000 (21:52 +0100)] 
gh-128342: Specify timeout unit in subprocess docstrings (GH-128343)

Specify timeout unit (seconds) in subprocess docstrings

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
10 months agogh-128100: Use atomic dictionary load in `_PyObject_GenericGetAttrWithDict` (GH-128297)
Bogdan Romanyuk [Mon, 30 Dec 2024 20:38:49 +0000 (23:38 +0300)] 
gh-128100: Use atomic dictionary load in `_PyObject_GenericGetAttrWithDict` (GH-128297)

10 months agogh-119786: Mention `InternalDocs/interpreter.md` instead of non-existing `adaptive...
Yan Yanchii [Mon, 30 Dec 2024 18:38:09 +0000 (19:38 +0100)] 
gh-119786: Mention `InternalDocs/interpreter.md` instead of non-existing `adaptive.md` (#128329)

`Python/specialize.c`: Mention `InternalDocs/interpreter.md` instead of non-existing `adaptive.md`

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
10 months agogh-128317: Document `calendar.TextCalendar.formatweek` (#128353)
Hugo van Kemenade [Mon, 30 Dec 2024 17:25:39 +0000 (19:25 +0200)] 
gh-128317: Document `calendar.TextCalendar.formatweek` (#128353)

10 months agogh-128118: Speed up copy.copy with fast lookup for atomic and container types (#128119)
Pieter Eendebak [Mon, 30 Dec 2024 17:18:42 +0000 (18:18 +0100)] 
gh-128118: Speed up copy.copy with fast lookup for atomic and container types (#128119)

10 months agogh-119180: Set the name of the param to __annotate__ to "format" (#124730)
Jelle Zijlstra [Mon, 30 Dec 2024 16:19:38 +0000 (08:19 -0800)] 
gh-119180: Set the name of the param to __annotate__ to "format" (#124730)

10 months agoDocs: correctly markup sys.monitoring "What's New" entry (#128346)
Erlend E. Aasland [Mon, 30 Dec 2024 12:53:40 +0000 (13:53 +0100)] 
Docs: correctly markup sys.monitoring "What's New" entry (#128346)

The sys.monitoring entry was added with commit d2f1d917e.

10 months agogh-128321: Set LIBS instead of LDFLAGS when checking sqlite3 requirements (#128322)
Zanie Blue [Mon, 30 Dec 2024 08:55:14 +0000 (02:55 -0600)] 
gh-128321: Set LIBS instead of LDFLAGS when checking sqlite3 requirements (#128322)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
10 months agoGH-127381: pathlib ABCs: remove uncommon `PurePathBase` methods (#127853)
Barney Gale [Sun, 29 Dec 2024 22:07:12 +0000 (22:07 +0000)] 
GH-127381: pathlib ABCs: remove uncommon `PurePathBase` methods (#127853)

Remove `PurePathBase.relative_to()` and `is_relative_to()` because they
don't account for *other* being an entirely different kind of path, and
they can't use `__eq__()` because it's not on the `PurePathBase` interface.

Remove `PurePathBase.drive`, `root`, `is_absolute()` and `as_posix()`.
These are all too specific to local filesystems.

10 months agoGH-127381: pathlib ABCs: remove `PathBase.stat()` (#128334)
Barney Gale [Sun, 29 Dec 2024 21:42:07 +0000 (21:42 +0000)] 
GH-127381: pathlib ABCs: remove `PathBase.stat()` (#128334)

Remove the `PathBase.stat()` method. Its use of the `os.stat_result` API,
with its 10 mandatory fields and low-level types, makes it an awkward fit
for virtual filesystems.

We'll look to add a `PathBase.info` attribute later - see GH-125413.

10 months agogh-123424: add `ZipInfo._for_archive` to set suitable default properties (#123429)
Bénédikt Tran [Sun, 29 Dec 2024 18:30:53 +0000 (19:30 +0100)] 
gh-123424: add `ZipInfo._for_archive` to set suitable default properties (#123429)

---------

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
10 months agogh-128192: mark new tests with skips based on hashlib algorithm availability (gh...
Gregory P. Smith [Sun, 29 Dec 2024 06:32:32 +0000 (22:32 -0800)] 
gh-128192: mark new tests with skips based on hashlib algorithm availability (gh-128324)

Puts the _hashlib get_fips_mode logic check into test.support rather than spreading it out among other tests.

10 months agoexpand the `asyncio.run_coroutine_threadsafe` recipes (#127576)
Thomas Grainger [Sun, 29 Dec 2024 06:22:29 +0000 (06:22 +0000)] 
expand the `asyncio.run_coroutine_threadsafe` recipes (#127576)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
10 months agogh-128192: support HTTP sha-256 digest authentication as per RFC-7617 (GH-128193)
Calvin Bui [Sat, 28 Dec 2024 21:05:34 +0000 (08:05 +1100)] 
gh-128192: support HTTP sha-256 digest authentication as per RFC-7617 (GH-128193)

support sha-256 digest authentication

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
10 months agogh-128279: Enhance the NetBSD compatibility for thread naming (#128280)
Furkan Onder [Sat, 28 Dec 2024 18:49:45 +0000 (21:49 +0300)] 
gh-128279: Enhance the NetBSD compatibility for thread naming (#128280)

Enhance NetBSD compatibility for thread naming in _threadmodule.c.

10 months agogh-119786: Fix typos in `InternalDocs/parser.md` (#128314)
Yan Yanchii [Sat, 28 Dec 2024 15:05:00 +0000 (16:05 +0100)] 
gh-119786: Fix typos in `InternalDocs/parser.md` (#128314)

10 months agogh-128265: Support WASI/Emscripten on PDB tests, by removing asyncio from pdb tests...
Thomas Grainger [Sat, 28 Dec 2024 14:59:49 +0000 (14:59 +0000)] 
gh-128265: Support WASI/Emscripten on PDB tests, by removing asyncio from pdb tests (#128264)

A part of `Lib/test/test_pdb.py` was previously unable to run on WASI/Emscripten
platforms because it lacked support for `asyncio`.
In fact, these tests could be rewritten without the `asyncio` framework because
`test_pdb` tests the behavior of coroutines, which are not part of `asyncio`.

Now reliance on the availability of `asyncio` has been removed and
part of `test_pdb` that deals with coroutines working on WASI/Emscripten platforms.

10 months agogh-127586: multiprocessing.Pool does not properly restore blocked signals (try 2...
Stephen Hansen [Fri, 27 Dec 2024 22:09:01 +0000 (17:09 -0500)] 
gh-127586: multiprocessing.Pool does not properly restore blocked signals (try 2) (GH-128011)

Correct pthread_sigmask in resource_tracker to restore old signals

Using SIG_UNBLOCK to remove blocked "ignored signals" may accidentally
cause side effects if the calling parent already had said signals
blocked to begin with and did not intend to unblock them when
creating a pool. Use SIG_SETMASK instead with the previous mask of
blocked signals to restore the original blocked set.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
10 months agogh-127949: make deprecation of policy system more prominent (#128290)
Kumar Aditya [Fri, 27 Dec 2024 15:13:41 +0000 (20:43 +0530)] 
gh-127949: make deprecation of policy system more prominent (#128290)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
10 months agogh-127089: Add missing description for codes in `http.HTTPStatus` (#127100)
donBarbos [Fri, 27 Dec 2024 14:12:25 +0000 (18:12 +0400)] 
gh-127089: Add missing description for codes in `http.HTTPStatus` (#127100)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
10 months agoMention loop_factory argument in docstring for asyncio.run() (#128288)
Andrew Svetlov [Fri, 27 Dec 2024 13:58:35 +0000 (14:58 +0100)] 
Mention loop_factory argument in docstring for asyncio.run() (#128288)

10 months agogh-125887: Update PyObject_HasAttr exception behavior (#125907)
Damien [Fri, 27 Dec 2024 01:57:55 +0000 (09:57 +0800)] 
gh-125887: Update PyObject_HasAttr exception behavior (#125907)

Update PyObject_HasAttr exception behavior

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
10 months agogh-127537: Add __class_getitem__ to the python implementation of functools.partial...
CF Bolz-Tereick [Fri, 27 Dec 2024 01:03:47 +0000 (02:03 +0100)] 
gh-127537: Add __class_getitem__ to the python implementation of functools.partial (#127537)

10 months agoRemove incorrect imports rationale comment in `http.server` (#128278)
Moshe Kaplan [Thu, 26 Dec 2024 21:53:37 +0000 (16:53 -0500)] 
Remove incorrect imports rationale comment in `http.server` (#128278)

Remove reference to gethostbyaddr(), because it's not actually used within this code.

10 months agogh-126868: Add freelist for compact ints to `_PyLong_New` (#128181)
Pieter Eendebak [Thu, 26 Dec 2024 15:17:22 +0000 (16:17 +0100)] 
gh-126868: Add freelist for compact ints to `_PyLong_New` (#128181)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
10 months agogh-87138: convert blake2b/2s types to heap types (#127669)
Bénédikt Tran [Thu, 26 Dec 2024 15:03:57 +0000 (16:03 +0100)] 
gh-87138: convert blake2b/2s types to heap types (#127669)

10 months agogh-124761: add `socket.SO_REUSEPORT_LB` (#124961)
Thomas Grainger [Thu, 26 Dec 2024 14:50:20 +0000 (14:50 +0000)] 
gh-124761: add `socket.SO_REUSEPORT_LB` (#124961)

10 months agoClean up redundant ifdef in list getitem (#128257)
da-woods [Thu, 26 Dec 2024 14:40:48 +0000 (14:40 +0000)] 
Clean up redundant ifdef in list getitem (#128257)

It's already inside a `Py_GIL_DISABLED` block so the `#else` clause is always unused.

10 months agoDocs: Fix comment out in `c-api/typeobj.rst` (#128266)
Yuki Kobayashi [Thu, 26 Dec 2024 14:39:44 +0000 (23:39 +0900)] 
Docs: Fix comment out in `c-api/typeobj.rst` (#128266)

10 months agogh-119786: Fix typos in `InternalDocs/frames.md` (#128275)
Yan Yanchii [Thu, 26 Dec 2024 14:39:15 +0000 (15:39 +0100)] 
gh-119786: Fix typos in `InternalDocs/frames.md` (#128275)

Fix typos in `InternalDocs/frames.md`

10 months agogh-127949: add docs for asyncio policy deprecation (#128269)
Kumar Aditya [Thu, 26 Dec 2024 14:32:23 +0000 (20:02 +0530)] 
gh-127949: add docs for asyncio policy deprecation (#128269)

10 months agogh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199)
Yan Yanchii [Wed, 25 Dec 2024 17:42:04 +0000 (18:42 +0100)] 
gh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199)

10 months agogh-128234: support emscripten and wasi in async contextlib tests by removing asyncio...
Thomas Grainger [Wed, 25 Dec 2024 13:23:44 +0000 (13:23 +0000)] 
gh-128234: support emscripten and wasi in async contextlib tests by removing asyncio from contextlib async tests (#95888)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
10 months agogh-128002: use internal llist implementation for asyncio tasks (#128256)
Kumar Aditya [Wed, 25 Dec 2024 12:21:27 +0000 (17:51 +0530)] 
gh-128002: use internal llist implementation for asyncio tasks  (#128256)

10 months agogh-128201: Fix ``DeprecationWarning`` in ``test_pdb`` (#128202)
Kirill Podoprigora [Wed, 25 Dec 2024 07:26:51 +0000 (09:26 +0200)] 
gh-128201: Fix ``DeprecationWarning`` in ``test_pdb`` (#128202)

10 months agogh-128035: Add ssl.HAS_PHA to detect libssl PHA support (GH-128036)
Will Childs-Klein [Tue, 24 Dec 2024 18:29:27 +0000 (12:29 -0600)] 
gh-128035: Add ssl.HAS_PHA to detect libssl PHA support (GH-128036)

* Add ssl.HAS_PHA to detect libssl Post-Handshake-Auth support

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
10 months agogh-128227: Regenerate `Doc/requirements-oldest-sphinx.txt` (#128228)
Bogdan Romanyuk [Tue, 24 Dec 2024 18:00:24 +0000 (21:00 +0300)] 
gh-128227: Regenerate `Doc/requirements-oldest-sphinx.txt` (#128228)

10 months agogh-127847: Fix position in the special-cased zipfile seek (#127856)
Dima Ryazanov [Tue, 24 Dec 2024 15:56:42 +0000 (07:56 -0800)] 
gh-127847: Fix position in the special-cased zipfile seek (#127856)

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
10 months agogh-127949: deprecate `asyncio.set_event_loop` (#128218)
Kumar Aditya [Tue, 24 Dec 2024 13:54:28 +0000 (19:24 +0530)] 
gh-127949: deprecate `asyncio.set_event_loop` (#128218)

Deprecate `asyncio.set_event_loop` to be removed in Python 3.16.

10 months agogh-128217: Validate the normalized_environment variable instead of the similarly...
Sergey Muraviov [Tue, 24 Dec 2024 13:06:41 +0000 (16:06 +0300)] 
gh-128217: Validate the normalized_environment variable instead of the similarly named function (GH-128220)

10 months agoAdd Windows version comments to the python manifest. (GH-127439)
AraHaan [Tue, 24 Dec 2024 13:01:21 +0000 (08:01 -0500)] 
Add Windows version comments to the python manifest. (GH-127439)

10 months agogh-127949: deprecate asyncio policy classes (#128216)
Kumar Aditya [Tue, 24 Dec 2024 12:00:26 +0000 (17:30 +0530)] 
gh-127949: deprecate asyncio policy classes (#128216)

10 months agogh-127949: fix `DeprecationWarning` in test_inspect.py (#128215)
Thomas Grainger [Tue, 24 Dec 2024 09:43:31 +0000 (09:43 +0000)] 
gh-127949: fix `DeprecationWarning` in test_inspect.py (#128215)

10 months agogh-128195: Add `_REPLACE_WITH_TRUE` to the tier2 optimizer (GH-128203)
Yan Yanchii [Mon, 23 Dec 2024 21:17:47 +0000 (22:17 +0100)] 
gh-128195: Add `_REPLACE_WITH_TRUE` to the tier2 optimizer (GH-128203)

Add `_REPLACE_WITH_TRUE` to the tier2 optimizer

10 months agopathlib tests: create test hierarchy without using class under test (#128200)
Barney Gale [Mon, 23 Dec 2024 17:22:15 +0000 (17:22 +0000)] 
pathlib tests: create test hierarchy without using class under test (#128200)

In the pathlib tests, avoid using the path class under test (`self.cls`) in
test setup. Instead we use `os` functions in `test_pathlib`, and direct
manipulation of `DummyPath` internal data in `test_pathlib_abc`.

10 months agogh-115999: Update test_opcache to test with nested method (gh-128166)
Donghee Na [Mon, 23 Dec 2024 17:08:34 +0000 (02:08 +0900)] 
gh-115999: Update test_opcache to test with nested method (gh-128166)

gh-115999: Update test_opcace to test with nested method

10 months agogh-114203: Optimise simple recursive critical sections (#128126)
T. Wouters [Mon, 23 Dec 2024 12:31:33 +0000 (04:31 -0800)] 
gh-114203: Optimise simple recursive critical sections (#128126)

Add a fast path to (single-mutex) critical section locking _iff_ the mutex
is already held by the currently active, top-most critical section of this
thread. This can matter a lot for indirectly recursive critical sections
without intervening critical sections.

10 months agogh-126180: Remove getopt and optparse deprecation notices (GH-126227)
Alyssa Coghlan [Mon, 23 Dec 2024 04:17:19 +0000 (14:17 +1000)] 
gh-126180: Remove getopt and optparse deprecation notices (GH-126227)

* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
  rather than as an upgrade guide

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
10 months agogh-100384: Error on `unguarded-availability` in macOS builds (#128155)
Zanie Blue [Sun, 22 Dec 2024 19:01:45 +0000 (13:01 -0600)] 
gh-100384: Error on `unguarded-availability` in macOS builds (#128155)

Generate a build error on ``unguarded-availability`` in portable macOS builds (i.e. using MACOSX_DEPLOYMENT_TARGET), preventing invalid use of symbols that are not available in older versions of the OS.

10 months agogh-119786: Fix typos in `InternalDocs/interpreter.md` (#128174)
Yan Yanchii [Sun, 22 Dec 2024 16:34:16 +0000 (17:34 +0100)] 
gh-119786: Fix typos in `InternalDocs/interpreter.md` (#128174)

10 months agogh-127949: fix resource warnings in `test_tasks.py` (#128172)
Thomas Grainger [Sun, 22 Dec 2024 12:46:02 +0000 (12:46 +0000)] 
gh-127949: fix resource warnings in `test_tasks.py` (#128172)

10 months agogh-126664: revert: Use `else` instead of `finally` in docs explaining "with" (#128169)
Gregory P. Smith [Sun, 22 Dec 2024 09:47:41 +0000 (01:47 -0800)] 
gh-126664: revert: Use `else` instead of `finally` in docs explaining "with" (#128169)

Revert "gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)"

This reverts commit 25257d61cfccc3b4189f96390a5c4db73fd5302c.

10 months agoGH-127807: pathlib ABCs: move private copying methods to dedicated class (#127810)
Barney Gale [Sun, 22 Dec 2024 02:22:08 +0000 (02:22 +0000)] 
GH-127807: pathlib ABCs: move private copying methods to dedicated class (#127810)

Move 9 private `PathBase` attributes and methods into a new `CopyWorker`
class. Change `PathBase.copy` from a method to a `CopyWorker` instance.

The methods remain private in the `CopyWorker` class. In future we might
make some/all of them public so that user subclasses of `PathBase` can
customize the copying process (in particular reading/writing of metadata,)
but we'd need to make `PathBase` public first.

10 months agoGH-127807: pathlib ABCs: remove a few private attributes (#127851)
Barney Gale [Sun, 22 Dec 2024 01:41:38 +0000 (01:41 +0000)] 
GH-127807: pathlib ABCs: remove a few private attributes (#127851)

From `PurePathBase` delete `_globber`, `_stack` and `_pattern_str`, and
from `PathBase` delete `_glob_selector`. This helps avoid an unpleasant
surprise for a users who try to use these names.

10 months agoGH-127807: pathlib ABCs: remove `PurePathBase._raw_paths` (#127883)
Barney Gale [Sun, 22 Dec 2024 01:17:59 +0000 (01:17 +0000)] 
GH-127807: pathlib ABCs: remove `PurePathBase._raw_paths` (#127883)

Remove the `PurePathBase` initializer, and make `with_segments()` and
`__str__()` abstract. This allows us to drop the `_raw_paths` attribute,
and also the `Parser.join()` protocol method.

10 months agogh-112328: Make EnumDict usable on its own and document it (GH-123669)
Petr Viktorin [Fri, 20 Dec 2024 19:40:58 +0000 (20:40 +0100)] 
gh-112328: Make EnumDict usable on its own and document it (GH-123669)

Co-authored-by: Rafi <rafi.promit@gmail.com>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
10 months agogh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup...
Nico-Posada [Fri, 20 Dec 2024 19:20:31 +0000 (13:20 -0600)] 
gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (#128079)

10 months agoPython Tutorial typo fix (#128077)
shallow-beach [Fri, 20 Dec 2024 17:09:56 +0000 (09:09 -0800)] 
Python Tutorial typo fix (#128077)

10 months agoGH-127705: Add debug mode for `_PyStackRef`s inspired by HPy debug mode (GH-128121)
Mark Shannon [Fri, 20 Dec 2024 16:52:20 +0000 (16:52 +0000)] 
GH-127705: Add debug mode for `_PyStackRef`s inspired by HPy debug mode (GH-128121)

10 months agogh-127295: ctypes: Switch field accessors to fixed-width integers (GH-127297)
Petr Viktorin [Fri, 20 Dec 2024 13:28:18 +0000 (14:28 +0100)] 
gh-127295: ctypes: Switch field accessors to fixed-width integers (GH-127297)

This should be a pure refactoring, without user-visible behaviour changes.

Before this change, ctypes uses traditional native C types, usually identified
by [`struct` format characters][struct-chars] when a short (and
identifier-friendly) name is needed:
- `signed char` (`b`) / `unsigned char` (`B`)
- `short` (`h`) / `unsigned short` (`h`)
- `int` (`i`) / `unsigned int` (`i`)
- `long` (`l`) / `unsigned long` (`l`)
- `long long` (`q`) / `unsigned long long` (`q`)

These map to C99 fixed-width types, which this PR switches to: -
- `int8_t`/`uint8_t`
- `int16_t`/`uint16_t`
- `int32_t`/`uint32_t`
- `int64_t`/`uint64_t`

The C standard doesn't guarantee that the “traditional” types must map to the
fixints. But, [`ctypes` currently requires it][swapdefs], so the assumption won't
break anything.

By “map” I mean that the *size* of the types matches. The *alignment*
requirements might not. This needs to be kept in mind but is not an issue in
`ctypes` accessors, which [explicitly handle unaligned memory][memcpy] for the
integer types.

Note that there are 5 “traditional” C type sizes, but 4 fixed-width ones. Two of
the former are functionally identical to one another; which ones they are is
platform-specific (e.g. `int`==`long`==`int32_t`.) This means that one of the
[current][current-impls-1] [implementations][current-impls-2] is redundant on
any given platform.

The fixint types are parametrized by the number of bytes/bits, and one bit for
signedness. This makes it easier to autogenerate code for them or to write
generic macros (though generic API like
[`PyLong_AsNativeBytes`][PyLong_AsNativeBytes] is problematic for performance
reasons -- especially compared to a `memcpy` with compile-time-constant size).

When one has a *different* integer type, determining the corresponding fixint
means a `sizeof` and signedness check. This is easier and more robust than the
current implementations (see [`wchar_t`][sizeof-wchar_t] or
[`_Bool`][sizeof-bool]).

[swapdefs]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L420-L444
[struct-chars]: https://docs.python.org/3/library/struct.html#format-characters
[current-impls-1]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L470-L653
[current-impls-2]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L703-L944
[memcpy]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L613
[PyLong_AsNativeBytes]: https://docs.python.org/3/c-api/long.html#c.PyLong_AsNativeBytes
[sizeof-wchar_t]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L1547-L1555
[sizeof-bool]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L1562-L1572

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
10 months agogh-127946: Use a critical section for `CFuncPtr` attributes (GH-128109)
Peter Bierma [Fri, 20 Dec 2024 13:02:46 +0000 (08:02 -0500)] 
gh-127946: Use a critical section for `CFuncPtr` attributes (GH-128109)

10 months agogh-128116: Skip test_socket VSOCK testStream() on PermissionError (#128120)
Victor Stinner [Fri, 20 Dec 2024 12:38:00 +0000 (13:38 +0100)] 
gh-128116: Skip test_socket VSOCK testStream() on PermissionError (#128120)

10 months agogh-109959: Log the current directory in test_glob.test_selflink() (#128122)
Victor Stinner [Fri, 20 Dec 2024 12:37:20 +0000 (13:37 +0100)] 
gh-109959: Log the current directory in test_glob.test_selflink() (#128122)

10 months agoGH-122548: Correct magic number comment (GH-128115)
Mark Shannon [Fri, 20 Dec 2024 11:57:44 +0000 (11:57 +0000)] 
GH-122548: Correct magic number comment (GH-128115)

Correct magic number comment

10 months agogh-128030: Avoid error from PyModule_GetFilenameObject for non-module (#128047)
Shantanu [Fri, 20 Dec 2024 08:22:26 +0000 (00:22 -0800)] 
gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (#128047)

I missed the extra `PyModule_Check` in #127660 because I was looking at
3.12 as the base implementation for import from. This meant that I
missed the `PyModuleCheck` introduced in #112661.

10 months agogh-128058: Fix test_builtin ImmortalTests (#128068)
Victor Stinner [Fri, 20 Dec 2024 07:50:18 +0000 (08:50 +0100)] 
gh-128058: Fix test_builtin ImmortalTests (#128068)

On 32-bit Free Threading systems, immortal reference count
is 5 << 28, instead of 7 << 28.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
10 months agogh-112328: Document EnumDict in docs and release notes (GH-121720)
Md Rokibul Islam [Thu, 19 Dec 2024 23:38:42 +0000 (00:38 +0100)] 
gh-112328: Document EnumDict in docs and release notes (GH-121720)

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
10 months agogh-128080: remove unnecessary `__init__` method from Enum (GH-128081)
Stephen Morton [Thu, 19 Dec 2024 22:07:17 +0000 (14:07 -0800)] 
gh-128080: remove unnecessary `__init__` method from Enum (GH-128081)

remove unnecessary __init__ method from Enum

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
10 months agogh-127274: Defer nested methods (#128012)
mpage [Thu, 19 Dec 2024 21:03:14 +0000 (13:03 -0800)] 
gh-127274: Defer nested methods (#128012)

Methods (functions defined in class scope) are likely to be cleaned
up by the GC anyway.

Add a new code flag, `CO_METHOD`, that is set for functions defined
in a class scope. Use that when deciding to defer functions.

10 months agogh-128062: Fix the font size and shortcut display of the turtledemo menu (#128063)
Zhikang Yan [Thu, 19 Dec 2024 20:24:47 +0000 (04:24 +0800)] 
gh-128062: Fix the font size and shortcut display of the turtledemo menu (#128063)

Leave the font of the menu bar the default to keep it consistent with the rest of the world. Display the shortcut keys in the right way, using the 'accelerator' option.
---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
10 months agogh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)
Neil Schemenauer [Thu, 19 Dec 2024 18:21:17 +0000 (10:21 -0800)] 
gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)

* Add `_PyDictKeys_StringLookupSplit` which does locking on dict keys and
  use in place of `_PyDictKeys_StringLookup`.

* Change `_PyObject_TryGetInstanceAttribute` to use that function
  in the case of split keys.

* Add `unicodekeys_lookup_split` helper which allows code sharing
  between `_Py_dict_lookup` and `_PyDictKeys_StringLookupSplit`.

* Fix locking for `STORE_ATTR_INSTANCE_VALUE`.  Create
  `_GUARD_TYPE_VERSION_AND_LOCK` uop so that object stays locked and
  `tp_version_tag` cannot change.

* Pass `tp_version_tag` to `specialize_dict_access()`, ensuring
  the version we store on the cache is the correct one (in case of
  it changing during the specalize analysis).

* Split `analyze_descriptor` into `analyze_descriptor_load` and
  `analyze_descriptor_store` since those don't share much logic.
  Add `descriptor_is_class` helper function.

* In `specialize_dict_access`, double check `_PyObject_GetManagedDict()`
  in case we race and dict was materialized before the lock.

* Avoid borrowed references in `_Py_Specialize_StoreAttr()`.

* Use `specialize()` and `unspecialize()` helpers.

* Add unit tests to ensure specializing happens as expected in FT builds.

* Add unit tests to attempt to trigger data races (useful for running under TSAN).

* Add `has_split_table` function to `_testinternalcapi`.

10 months agoGH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564)
Mark Shannon [Thu, 19 Dec 2024 16:59:51 +0000 (16:59 +0000)] 
GH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564)

10 months agogh-128008: Add `PyWeakref_IsDead()` (GH-128009)
Sam Gross [Thu, 19 Dec 2024 15:17:15 +0000 (10:17 -0500)] 
gh-128008: Add `PyWeakref_IsDead()` (GH-128009)

The `PyWeakref_IsDead()` function tests if a weak reference is dead
without any side effects. Although you can also detect if a weak
reference is dead using `PyWeakref_GetRef()`, that function returns a
strong reference that must be `Py_DECREF()`'d, which can introduce side
effects if the last reference is concurrently dropped (at least in the
free threading build).

10 months agogh-127951: Add build option to enable pystats on Windows (GH-127952)
Pieter Eendebak [Thu, 19 Dec 2024 14:45:34 +0000 (15:45 +0100)] 
gh-127951: Add build option to enable pystats on Windows (GH-127952)

10 months agogh-128083: Fix macro redefinition warning in clinic. (GH-127950)
Peter Bierma [Thu, 19 Dec 2024 14:00:30 +0000 (09:00 -0500)] 
gh-128083: Fix macro redefinition warning in clinic. (GH-127950)

10 months agogh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module (GH-127689)
RUANG (James Roy) [Thu, 19 Dec 2024 13:51:21 +0000 (21:51 +0800)] 
gh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module (GH-127689)

10 months agogh-122706: fix docs for asyncio ssl sockets (#128092)
Kumar Aditya [Thu, 19 Dec 2024 12:45:36 +0000 (18:15 +0530)] 
gh-122706: fix docs for asyncio ssl sockets (#128092)

10 months agogh-128013: fix data race in `PyUnicode_AsUTF8AndSize` on free-threading (#128021)
Kumar Aditya [Thu, 19 Dec 2024 11:38:32 +0000 (17:08 +0530)] 
gh-128013: fix data race in `PyUnicode_AsUTF8AndSize` on free-threading (#128021)

10 months agogh-128069: brew link --overwrite tcl-tk@8 to prevent conflict with GitHub image's...
Victor Stinner [Thu, 19 Dec 2024 10:27:29 +0000 (11:27 +0100)] 
gh-128069: brew link --overwrite tcl-tk@8 to prevent conflict with GitHub image's version (#128090)

brew link --overwrite tcl-tk@8 to prevent conflict with GitHub image's version

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
10 months agogh-115999: Enable BINARY_SUBSCR_GETITEM for free-threaded build (gh-127737)
Donghee Na [Thu, 19 Dec 2024 02:08:17 +0000 (11:08 +0900)] 
gh-115999: Enable BINARY_SUBSCR_GETITEM for free-threaded build (gh-127737)

10 months agogh-128013: Convert unicodeobject.c macros to functions (#128061)
Victor Stinner [Wed, 18 Dec 2024 15:34:31 +0000 (16:34 +0100)] 
gh-128013: Convert unicodeobject.c macros to functions (#128061)

Convert unicodeobject.c macros to static inline functions.

* Add _PyUnicode_SET_UTF8() and _PyUnicode_SET_UTF8_LENGTH() macros.
* Add PyUnicode_HASH() and PyUnicode_SET_HASH() macros.
* Remove unused _PyUnicode_KIND() and _PyUnicode_GET_LENGTH() macros.

10 months agogh-128033: change `PyMutex_LockFast` to take `PyMutex` as argument (#128054)
Kumar Aditya [Wed, 18 Dec 2024 15:19:00 +0000 (20:49 +0530)] 
gh-128033: change `PyMutex_LockFast` to take `PyMutex` as argument (#128054)

Change `PyMutex_LockFast` to take `PyMutex` as argument.

10 months agogh-121621: clear running loop early in asyncio (#128004)
Kumar Aditya [Wed, 18 Dec 2024 14:25:03 +0000 (19:55 +0530)] 
gh-121621: clear running loop early in asyncio (#128004)