]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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)

10 months agogh-127949: deprecate `asyncio.get_event_loop_policy` (#128053)
Kumar Aditya [Wed, 18 Dec 2024 12:34:20 +0000 (18:04 +0530)] 
gh-127949: deprecate `asyncio.get_event_loop_policy` (#128053)

This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.

10 months agogh-126639: Add ResourceWarning to NamedTemporaryFile (#126677)
Thomas Grainger [Wed, 18 Dec 2024 10:12:24 +0000 (10:12 +0000)] 
gh-126639: Add ResourceWarning to NamedTemporaryFile (#126677)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
10 months agogh-126742: add NEWS entry for fix of localized error messages (GH-128025)
Bénédikt Tran [Wed, 18 Dec 2024 08:59:37 +0000 (09:59 +0100)] 
gh-126742: add NEWS entry for fix of localized error messages (GH-128025)

10 months agogh-126742: Avoid checking for library filename in test_ctypes (#128034)
Bénédikt Tran [Wed, 18 Dec 2024 08:25:42 +0000 (09:25 +0100)] 
gh-126742: Avoid checking for library filename in test_ctypes (#128034)

Avoid checking for library filename in `dlerror()` error messages of test_ctypes.

10 months agogh-127174: add docs for asyncio.get_event_loop replacements (#127640)
Thomas Grainger [Wed, 18 Dec 2024 08:20:05 +0000 (08:20 +0000)] 
gh-127174: add docs for asyncio.get_event_loop replacements (#127640)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
10 months agogh-127897: fix HACL* build on macOS/Catalina (GH-127932)
aeiouaeiouaeiouaeiouaeiouaeiou [Wed, 18 Dec 2024 06:14:16 +0000 (09:14 +0300)] 
gh-127897: fix HACL* build on macOS/Catalina (GH-127932)

gh-127897: Update HACL* module from upstream sources to get:

- Lib_Memzero0.c: don't use memset_s() on macOS <10.9
- Use _mm_malloc() for KRML_ALIGNED_MALLOC on macOS <10.15
- Add LEGACY_MACOS macros, use _mm_free() for KRML_ALIGNED_FREE on macOS <10.15

10 months agogh-127949: deprecate `asyncio.set_event_loop_policy` (#128024)
Kumar Aditya [Wed, 18 Dec 2024 06:05:29 +0000 (11:35 +0530)] 
gh-127949: deprecate `asyncio.set_event_loop_policy` (#128024)

First step towards deprecating the asyncio policy system.
This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.

10 months agogh-127060: Disable traceback colors in IDLE (#128028)
Victor Stinner [Wed, 18 Dec 2024 05:35:05 +0000 (06:35 +0100)] 
gh-127060: Disable traceback colors in IDLE (#128028)

Set TERM environment variable to "dumb" to disable traceback colors
in IDLE, since IDLE doesn't understand ANSI escape sequences.

10 months agogh-127146: Emscripten Include compiler version in _PYTHON_HOST_PLATFORM (#127992)
Hood Chatham [Tue, 17 Dec 2024 23:17:09 +0000 (00:17 +0100)] 
gh-127146: Emscripten Include compiler version in _PYTHON_HOST_PLATFORM (#127992)

Modifies _PYTHON_HOST_PLATFORM to include the compiler version under
Emscripten. The Emscripten compiler version is the platform version
compatibility identifier.

10 months agoMerge branch 'main' of https://github.com/python/cpython
Hugo van Kemenade [Tue, 17 Dec 2024 16:06:36 +0000 (18:06 +0200)] 
Merge branch 'main' of https://github.com/python/cpython

10 months agoPost 3.14.0a3
Hugo van Kemenade [Tue, 17 Dec 2024 15:52:43 +0000 (17:52 +0200)] 
Post 3.14.0a3

10 months agogh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746)
Bénédikt Tran [Tue, 17 Dec 2024 11:12:45 +0000 (12:12 +0100)] 
gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746)

- Add a helper to set an error from locale-encoded `char*`
- Use the helper for gdbm & dlerror messages

Co-authored-by: Victor Stinner <vstinner@python.org>
10 months agoPython 3.14.0a3 v3.14.0a3
Hugo van Kemenade [Tue, 17 Dec 2024 09:49:37 +0000 (11:49 +0200)] 
Python 3.14.0a3

10 months agogh-127085: Add a test skip if multiprocessing isn't available (#128019)
Russell Keith-Magee [Tue, 17 Dec 2024 08:18:33 +0000 (16:18 +0800)] 
gh-127085: Add a test skip if multiprocessing isn't available (#128019)

Add a test skip if multiprocessing isn't available.

10 months agogh-127146: Emscripten clean up test suite (#127984)
Hood Chatham [Tue, 17 Dec 2024 07:48:23 +0000 (08:48 +0100)] 
gh-127146: Emscripten clean up test suite (#127984)

Removed test skips that are no longer required as a result of Emscripten updates.

10 months agoFree arena on _PyCompile_AstOptimize failure in Py_CompileStringObject (GH-127910)
Berker Peksag [Mon, 16 Dec 2024 20:59:36 +0000 (22:59 +0200)] 
Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject (GH-127910)

After commit 10a91d7e9 introduced arena cleanup, commit 2dfbd4f36
removed the free call when _PyCompile_AstOptimize fails.

10 months agogh-126907: make `atexit` thread safe in free-threading (#127935)
Peter Bierma [Mon, 16 Dec 2024 19:31:44 +0000 (14:31 -0500)] 
gh-126907: make `atexit` thread safe in free-threading (#127935)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
10 months agogh-127085: fix some data races in memoryview in free-threading (#127412)
Edward Xu [Mon, 16 Dec 2024 19:12:19 +0000 (03:12 +0800)] 
gh-127085: fix some data races in memoryview in free-threading (#127412)

10 months agoRevert "gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587...
Hugo van Kemenade [Mon, 16 Dec 2024 18:18:02 +0000 (20:18 +0200)] 
Revert "gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)" (#127983)

This reverts commit 46006a1b355f75d06c10e7b8086912c483b34487.

10 months agoFix typo in itertools docs (gh-127995)
Gugubo [Mon, 16 Dec 2024 17:08:25 +0000 (18:08 +0100)] 
Fix typo in itertools docs (gh-127995)

10 months agogh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878)
Tomas R. [Mon, 16 Dec 2024 16:57:18 +0000 (17:57 +0100)] 
gh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878)

10 months agogh-127896: Add missing documentation of `PySequence_In` (GH-127979)
Yuki Kobayashi [Mon, 16 Dec 2024 13:56:04 +0000 (22:56 +0900)] 
gh-127896: Add missing documentation of `PySequence_In` (GH-127979)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
10 months agogh-111178: fix UBSan failures in `_elementtree.c` (#127982)
Bénédikt Tran [Mon, 16 Dec 2024 13:40:26 +0000 (14:40 +0100)] 
gh-111178: fix UBSan failures in `_elementtree.c` (#127982)

10 months agogh-125588: Allow to regenerate the parser with Python < 3.12 (#127969)
Pablo Galindo Salgado [Sun, 15 Dec 2024 23:17:01 +0000 (23:17 +0000)] 
gh-125588: Allow to regenerate the parser with Python < 3.12 (#127969)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
10 months agoGH-126985: Don't override venv detection with PYTHONHOME (#127968)
Filipe Laíns 🇵🇸 [Sun, 15 Dec 2024 21:12:13 +0000 (21:12 +0000)] 
GH-126985: Don't override venv detection with PYTHONHOME (#127968)

10 months agogh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)
Stephen Hansen [Sun, 15 Dec 2024 19:53:22 +0000 (14:53 -0500)] 
gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)

* 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.

* Adding resource_tracker blocked signals test

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
10 months agogh-119786: Fix miscellaneous typos in `InternalDocs/interpreter_definition.md` (...
Stan Ulbrych [Sun, 15 Dec 2024 17:11:50 +0000 (17:11 +0000)] 
gh-119786: Fix miscellaneous typos in `InternalDocs/interpreter_definition.md` (#127957)

10 months agogetpath: Add comments highlighing details of the pyvenv.cfg detection (#127966)
Filipe Laíns 🇵🇸 [Sun, 15 Dec 2024 15:40:19 +0000 (15:40 +0000)] 
getpath: Add comments highlighing details of the pyvenv.cfg detection (#127966)

10 months agogh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL...
Ed Nutting [Sun, 15 Dec 2024 13:51:03 +0000 (14:51 +0100)] 
gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (#127717)

Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.

10 months agoClarify ast docs to use a less confusing example for `ast.ParamSpec` (#127955)
Steve C [Sun, 15 Dec 2024 12:28:43 +0000 (07:28 -0500)] 
Clarify ast docs to use a less confusing example for `ast.ParamSpec` (#127955)

Fix typo in ast docs: ParamSpec defaults

10 months agogh-127353: Allow to force color output on Windows V2 (#127926)
Andrey Efremov [Sat, 14 Dec 2024 15:25:49 +0000 (22:25 +0700)] 
gh-127353: Allow to force color output on Windows V2 (#127926)

10 months agogh-127852: add remark about ',' separator (#127854)
Sergey B Kirpichev [Sat, 14 Dec 2024 13:28:26 +0000 (16:28 +0300)] 
gh-127852: add remark about ',' separator (#127854)

Specify that it is valid for floats and ints with 'd' presentation and an error otherwise.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
10 months agoFix typo in docstring: quadruple double quotes (#127913)
Totosuki [Sat, 14 Dec 2024 07:38:54 +0000 (16:38 +0900)] 
Fix typo in docstring: quadruple double quotes (#127913)

10 months agogh-127747: Resolve BytesWarning in test.support.strace_helper (#127849)
Cody Maloney [Sat, 14 Dec 2024 07:36:47 +0000 (23:36 -0800)] 
gh-127747: Resolve BytesWarning in test.support.strace_helper (#127849)

The strace_helper code has a _make_error function to simplify making
StraceResult objects in error cases. That takes a details parameter
which is either a caught OSError or `bytes`. If it's bytes, _make_error
would implicitly coerce that to a str inside of a f-string, resulting in
 a BytesWarning.

It's useful to see if it's an OSError or bytes when debugging, resolve
by changing to format with repr().

This is an error message on an internal helper.

A non-zero exit code occurs if the strace binary isn't found, and no
events will be parsed in that case (there is no output). Handle that
case by checking exit code before checking for events.

Still asserting around events rather than returning false, so that
hopefully if there's some change to `strace` that breaks the parsing,
will see that as a test failure rather than silently loosing strace
tests because they are auto-disabled.

10 months agogh-115999: Specialize loading attributes from modules in free-threaded builds (#127711)
mpage [Fri, 13 Dec 2024 18:17:16 +0000 (10:17 -0800)] 
gh-115999: Specialize loading attributes from modules in free-threaded builds (#127711)

We use the same approach that was used for specialization of LOAD_GLOBAL in free-threaded builds:

_CHECK_ATTR_MODULE is renamed to _CHECK_ATTR_MODULE_PUSH_KEYS; it pushes the keys object for the following _LOAD_ATTR_MODULE_FROM_KEYS (nee _LOAD_ATTR_MODULE). This arrangement avoids having to recheck the keys version.

_LOAD_ATTR_MODULE is renamed to _LOAD_ATTR_MODULE_FROM_KEYS; it loads the value from the keys object pushed by the preceding _CHECK_ATTR_MODULE_PUSH_KEYS at the cached index.

10 months agoMinor readability improvements for the itertools recipes (gh-127928)
Raymond Hettinger [Fri, 13 Dec 2024 18:12:49 +0000 (12:12 -0600)] 
Minor readability improvements for the itertools recipes (gh-127928)

10 months agogh-126024: unicodeobject: optimize find_first_nonascii (GH-127790)
Inada Naoki [Fri, 13 Dec 2024 16:21:46 +0000 (01:21 +0900)] 
gh-126024: unicodeobject: optimize find_first_nonascii (GH-127790)

Remove 1 branch.

10 months agogh-127691: add type checks when using `PyUnicodeError` objects (GH-127694)
Bénédikt Tran [Fri, 13 Dec 2024 16:16:22 +0000 (17:16 +0100)] 
gh-127691: add type checks when using `PyUnicodeError` objects (GH-127694)

10 months agogh-102471, PEP 757: Add PyLong import and export API (#121339)
Victor Stinner [Fri, 13 Dec 2024 13:24:48 +0000 (14:24 +0100)] 
gh-102471, PEP 757: Add PyLong import and export API (#121339)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
10 months agogh-127906: Test the limited C API in test_cppext (#127916)
Victor Stinner [Fri, 13 Dec 2024 13:23:20 +0000 (14:23 +0100)] 
gh-127906: Test the limited C API in test_cppext (#127916)

10 months agogh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872)
Victor Stinner [Fri, 13 Dec 2024 12:53:47 +0000 (13:53 +0100)] 
gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872)

10 months agoGH-126833: Dumps graphviz representation of executor graph. (GH-126880)
Mark Shannon [Fri, 13 Dec 2024 11:00:00 +0000 (11:00 +0000)] 
GH-126833: Dumps graphviz representation of executor graph. (GH-126880)

10 months agogh-126868: Add freelist for compact int objects (GH-126865)
Pieter Eendebak [Fri, 13 Dec 2024 10:06:26 +0000 (11:06 +0100)] 
gh-126868: Add freelist for compact int objects (GH-126865)

10 months agoGH-125174: Don't use `UINT32_MAX` in header file (GH-127863)
Mark Shannon [Fri, 13 Dec 2024 09:54:59 +0000 (09:54 +0000)] 
GH-125174: Don't use `UINT32_MAX` in header file (GH-127863)

10 months agolink to the correct output method in documentation (#127857)
Viktor Kálmán [Fri, 13 Dec 2024 09:27:02 +0000 (10:27 +0100)] 
link to the correct output method in documentation (#127857)

10 months agoDocument PyObject_SelfIter (#127861)
Miro Hrončok [Fri, 13 Dec 2024 09:26:22 +0000 (10:26 +0100)] 
Document PyObject_SelfIter (#127861)

10 months agogh-127845: Minor improvements to iOS test runner script (#127846)
Russell Keith-Magee [Thu, 12 Dec 2024 21:49:02 +0000 (05:49 +0800)] 
gh-127845: Minor improvements to iOS test runner script (#127846)

Uses symlinks to install iOS framework into testbed clone, adds a verbose mode
to the iOS runner to hide most Xcode output, adds another mechanism to disable
terminal colors, and ensures that stdout is flushed after every write.

10 months agoFix typo in traceback docs (#127884)
Daniel Haag [Thu, 12 Dec 2024 21:43:44 +0000 (22:43 +0100)] 
Fix typo in traceback docs (#127884)

10 months agoGH-127724: don't use sysconfig to calculate the venv local include path (#127731)
Filipe Laíns 🇵🇸 [Thu, 12 Dec 2024 21:41:46 +0000 (21:41 +0000)] 
GH-127724: don't use sysconfig to calculate the venv local include path (#127731)

10 months agoRevert "gh-127353: Allow to force color output on Windows (#127354)" (#127889)
Hugo van Kemenade [Thu, 12 Dec 2024 21:11:20 +0000 (23:11 +0200)] 
Revert "gh-127353: Allow to force color output on Windows (#127354)" (#127889)

This reverts commit 365451e28368db46ae89a3a990d85c10c2284aa2.

10 months agoFix typos in `Lib/_pydecimal.py` (#127700)
Stan Ulbrych [Thu, 12 Dec 2024 20:27:29 +0000 (20:27 +0000)] 
Fix typos in `Lib/_pydecimal.py` (#127700)