]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
23 months agogh-111178: Define `visitproc` callback functions properly and remove unnecessary...
Christopher Chavez [Wed, 6 Dec 2023 15:30:37 +0000 (09:30 -0600)] 
gh-111178: Define `visitproc` callback functions properly and remove unnecessary casts in gcmodule.c (#112687)

23 months agogh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322)
Serhiy Storchaka [Wed, 6 Dec 2023 14:42:15 +0000 (16:42 +0200)] 
gh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322)

Previously, "widget.unbind(sequence, funcid)" destroyed the current binding
for "sequence", leaving "sequence" unbound, and deleted the "funcid"
command.

Now it removes only "funcid" from the binding for "sequence", keeping
other commands, and deletes the "funcid" command.
It leaves "sequence" unbound only if "funcid" was the last bound command.

Co-authored-by: GiovanniL <13402461+GiovaLomba@users.noreply.github.com>
23 months agogh-111545: Add Py_HashPointer() function (#112096)
Victor Stinner [Wed, 6 Dec 2023 14:09:22 +0000 (15:09 +0100)] 
gh-111545: Add Py_HashPointer() function (#112096)

* Implement _Py_HashPointerRaw() as a static inline function.
* Add Py_HashPointer() tests to test_capi.test_hash.
* Keep _Py_HashPointer() function as an alias to Py_HashPointer().

23 months agogh-108223: Refer to PEP 703 as Free Threading (#112780)
Victor Stinner [Wed, 6 Dec 2023 11:55:58 +0000 (12:55 +0100)] 
gh-108223: Refer to PEP 703 as Free Threading (#112780)

23 months agogh-111178: Docs: fix `traverseproc`, `inquiry`, and `destructor` parameters in slot...
Christopher Chavez [Wed, 6 Dec 2023 09:44:41 +0000 (03:44 -0600)] 
gh-111178: Docs: fix `traverseproc`, `inquiry`, and `destructor` parameters in slot typedefs table (GH-112742)

In the slot typedefs table, the parameter of `destructor`
and the first parameter of `traverseproc` should both be
`PyObject *` rather than `void *`.
Same for `inquiry`.

23 months agogh-101100: Fix most Sphinx nitpicks in the glossary and `stdtypes.rst` (#112757)
Alex Waygood [Wed, 6 Dec 2023 08:44:06 +0000 (08:44 +0000)] 
gh-101100: Fix most Sphinx nitpicks in the glossary and `stdtypes.rst` (#112757)

23 months agogh-108927: Include new dir test/regrtestdata in the installation (GH-112765)
Serhiy Storchaka [Wed, 6 Dec 2023 07:48:27 +0000 (09:48 +0200)] 
gh-108927: Include new dir test/regrtestdata in the installation (GH-112765)

Co-authored-by: Victor Stinner <vstinner@python.org>
23 months agogh-112606: Use sem_clockwait with monotonic time when supported in parking_lot.c...
Matt Prodani [Wed, 6 Dec 2023 06:54:57 +0000 (01:54 -0500)] 
gh-112606: Use sem_clockwait with monotonic time when supported in parking_lot.c (gh-112733)

23 months agogh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix...
Miro Hrončok [Tue, 5 Dec 2023 19:39:28 +0000 (20:39 +0100)] 
gh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771)

zlib-ng defines the version as "1.3.0.zlib-ng".

23 months agogh-101100: Properly document frame object attributes (#112735)
Alex Waygood [Tue, 5 Dec 2023 19:27:59 +0000 (19:27 +0000)] 
gh-101100: Properly document frame object attributes (#112735)

23 months agoMinor stylistic edit to the grouper recipe (gh112759)
Jurjen N. E. Bos [Tue, 5 Dec 2023 18:44:06 +0000 (19:44 +0100)] 
Minor stylistic edit to the grouper recipe (gh112759)

23 months agobpo-35332: Handle os.close() errors in shutil.rmtree() (GH-23766)
Zackery Spytz [Tue, 5 Dec 2023 17:09:39 +0000 (09:09 -0800)] 
bpo-35332: Handle os.close() errors in shutil.rmtree() (GH-23766)

* Ignore os.close() errors when ignore_errors is True.
* Pass os.close() errors to the error handler if specified.
* os.close no longer retried after error.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112328: [Enum] Make some private attributes public. (GH-112514)
Ethan Furman [Tue, 5 Dec 2023 16:27:36 +0000 (08:27 -0800)] 
gh-112328: [Enum] Make some private attributes public. (GH-112514)

* [Enum] Make some private attributes public.

- ``_EnumDict`` --> ``EnumDict``
- ``EnumDict._member_names`` --> ``EnumDict.member_names``
- ``Enum._add_alias_``
- ``Enum._add_value_alias_``

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
23 months agogh-94692: Only catch OSError in shutil.rmtree() (#112756)
Serhiy Storchaka [Tue, 5 Dec 2023 15:40:49 +0000 (17:40 +0200)] 
gh-94692: Only catch OSError in shutil.rmtree() (#112756)

Previously a symlink attack resistant version of shutil.rmtree() could ignore
or pass to the error handler arbitrary exception when invalid arguments
were provided.

23 months agogh-110190: Fix ctypes structs with array on Arm (#112604)
Diego Russo [Tue, 5 Dec 2023 15:07:50 +0000 (15:07 +0000)] 
gh-110190: Fix ctypes structs with array on Arm (#112604)

Set MAX_STRUCT_SIZE to 32 in stgdict.c when on Arm platforms.
This because on Arm platforms structs with at most 4 elements of any
floating point type values can be passed through registers. If the type
is double the maximum size of the struct is 32 bytes.
On x86-64 Linux, it's maximum 16 bytes hence we need to differentiate.

23 months agogh-105323: Remove `WITH_APPLE_EDITLINE` to use the same declaration for all editline...
Tian Gao [Tue, 5 Dec 2023 14:52:28 +0000 (05:52 -0900)] 
gh-105323: Remove `WITH_APPLE_EDITLINE` to use the same declaration for all editline (gh-112513)

23 months agobpo-43153: Don't mask `PermissionError` with `NotADirectoryError` during tempdirector...
Ken Jin [Tue, 5 Dec 2023 13:30:59 +0000 (21:30 +0800)] 
bpo-43153: Don't mask `PermissionError` with `NotADirectoryError` during tempdirectory cleanup (GH-29940)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112535: Add comment for ppc32/64 registers (gh-112746)
Donghee Na [Tue, 5 Dec 2023 10:44:19 +0000 (10:44 +0000)] 
gh-112535: Add comment for ppc32/64 registers (gh-112746)

23 months agogh-101100: Fix many easily solvable Sphinx nitpicks in the datamodel docs (#112737)
Alex Waygood [Tue, 5 Dec 2023 09:59:52 +0000 (09:59 +0000)] 
gh-101100: Fix many easily solvable Sphinx nitpicks in the datamodel docs (#112737)

23 months agogh-81441: shutil.rmtree() FileNotFoundError race condition (GH-14064)
Jeffrey Kintscher [Tue, 5 Dec 2023 09:33:51 +0000 (01:33 -0800)] 
gh-81441: shutil.rmtree() FileNotFoundError race condition (GH-14064)

Ignore missing files and directories while enumerating
directory entries in shutil.rmtree().

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-62897: Update PyUnicode C API parameter names (GH-12680)
Rune Tynan [Tue, 5 Dec 2023 09:21:09 +0000 (04:21 -0500)] 
gh-62897: Update PyUnicode C API parameter names (GH-12680)

Standardize PyUnicode C API parameter names across the documentation.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112535: Update _Py_ThreadId() to support PowerPC (gh-112624)
Donghee Na [Tue, 5 Dec 2023 09:03:32 +0000 (09:03 +0000)] 
gh-112535: Update _Py_ThreadId() to support PowerPC (gh-112624)

23 months agogh-82300: Add track parameter to multiprocessing.shared_memory (#110778)
pan324 [Tue, 5 Dec 2023 08:11:44 +0000 (09:11 +0100)] 
gh-82300: Add track parameter to multiprocessing.shared_memory (#110778)

Add a track parameter to shared memory to allow resource tracking via the side-launched resource tracker process to be disabled on platforms that use it (POSIX).

This allows people who do not want automated cleanup at process exit because they are using the shared memory with processes not participating in Python's resource tracking to use the shared_memory API.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
23 months agoMinor refactoring of Object/abstract.c (UNARY_FUNC macro and more cases for BINARY_FU...
Sergey B Kirpichev [Tue, 5 Dec 2023 07:34:13 +0000 (10:34 +0300)] 
Minor refactoring of Object/abstract.c (UNARY_FUNC macro and more cases for BINARY_FUNC) (GH-112145)

* Use BINARY_FUNC macro for some remaining ops
* Add UNARY_FUNC macro to define unary PyNumber_* functions

23 months agogh-102130: Support tab completion in cmd for Libedit. (GH-107748)
Constantin Hong [Tue, 5 Dec 2023 07:24:56 +0000 (16:24 +0900)] 
gh-102130: Support tab completion in cmd for Libedit. (GH-107748)

---

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
23 months agogh-112736: Refactor del-safe symbol handling in subprocess (#112738)
Russell Keith-Magee [Tue, 5 Dec 2023 04:23:17 +0000 (12:23 +0800)] 
gh-112736: Refactor del-safe symbol handling in subprocess (#112738)

Refactor delete-safe symbol handling in subprocess.

Only module globals are force-cleared during interpreter finalization, using a class reference instead of individually listing the constants everywhere is simpler.

23 months agoGH-112727: Speed up `pathlib.Path.absolute()` (#112728)
Barney Gale [Mon, 4 Dec 2023 23:21:39 +0000 (23:21 +0000)] 
GH-112727: Speed up `pathlib.Path.absolute()` (#112728)

Use `_from_parsed_parts()` to create a pre-joined/pre-parsed path, rather
than passing multiple arguments to `with_segments()`

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
23 months agogh-112334: Restore subprocess's use of `vfork()` & fix `extra_groups=[]` behavior...
Gregory P. Smith [Mon, 4 Dec 2023 23:08:19 +0000 (15:08 -0800)] 
gh-112334: Restore subprocess's use of `vfork()` & fix `extra_groups=[]` behavior (#112617)

Restore `subprocess`'s intended use of `vfork()` by default for performance on Linux;
also fixes the behavior of `extra_groups=[]` which was unintentionally broken in 3.12.0:

Fixed a performance regression in 3.12's :mod:`subprocess` on Linux where it
would no longer use the fast-path ``vfork()`` system call when it could have
due to a logic bug, instead falling back to the safe but slower ``fork()``.

Also fixed a security bug introduced in 3.12.0.  If a value of ``extra_groups=[]``
was passed to :mod:`subprocess.Popen` or related APIs, the underlying
``setgroups(0, NULL)`` system call to clear the groups list would not be made
in the child process prior to ``exec()``.

The security issue was identified via code inspection in the process of
fixing the first bug.  Thanks to @vain for the detailed report and
analysis in the initial bug on Github.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
23 months agogh-112535: Add test on _Py_ThreadId() (#112709)
Victor Stinner [Mon, 4 Dec 2023 22:40:06 +0000 (23:40 +0100)] 
gh-112535: Add test on _Py_ThreadId() (#112709)

Add also test.support.Py_GIL_DISABLED constant.

23 months agogh-112671: Fixing typo in the Macro Docs (GH-112715)
Amioplk [Mon, 4 Dec 2023 20:52:06 +0000 (21:52 +0100)] 
gh-112671: Fixing typo in the Macro Docs (GH-112715)

Replace Py_T_STRING_INLINE with Py_T_STRING_INPLACE

23 months agogh-105967: Work around a macOS bug, limit zlib C library crc32 API calls to 1gig...
Gregory P. Smith [Mon, 4 Dec 2023 20:04:05 +0000 (12:04 -0800)] 
gh-105967: Work around a macOS bug, limit zlib C library crc32 API calls to 1gig (#112615)

Work around a macOS bug, limit zlib crc32 calls to 1GiB.

Without this, `zlib.crc32` and `binascii.crc32` could produce incorrect
results on multi-gigabyte inputs depending on the macOS version's Apple
supplied zlib implementation.

23 months agogh-103363: Add follow_symlinks argument to `pathlib.Path.owner()` and `group()` ...
Kamil Turek [Mon, 4 Dec 2023 19:42:01 +0000 (20:42 +0100)] 
gh-103363: Add follow_symlinks argument to `pathlib.Path.owner()` and `group()` (#107962)

23 months agogh-74690: Avoid a costly type check where possible in `_ProtocolMeta.__subclasscheck_...
Alex Waygood [Mon, 4 Dec 2023 19:35:46 +0000 (19:35 +0000)] 
gh-74690: Avoid a costly type check where possible in `_ProtocolMeta.__subclasscheck__` (#112717)

23 months agogh-112516: Update bundled pip version to 23.3.1 (gh-112517)
Thomas Bininda [Mon, 4 Dec 2023 17:27:57 +0000 (18:27 +0100)] 
gh-112516: Update bundled pip version to 23.3.1 (gh-112517)

23 months agogh-108927: Fix removing testing modules from sys.modules (GH-108952)
Serhiy Storchaka [Mon, 4 Dec 2023 15:43:27 +0000 (17:43 +0200)] 
gh-108927: Fix removing testing modules from sys.modules (GH-108952)

It breaks import machinery if the test module has submodules used in
other tests.

23 months agogh-74690: Optimise `isinstance()` and `issubclass()` calls against runtime-checkable...
Alex Waygood [Mon, 4 Dec 2023 15:41:41 +0000 (15:41 +0000)] 
gh-74690: Optimise `isinstance()` and `issubclass()` calls against runtime-checkable protocols by avoiding costly `super()` calls (#112708)

23 months agogh-101100: Fix Sphinx nitpicks in `library/abc.rst` (#112703)
Alex Waygood [Mon, 4 Dec 2023 12:42:24 +0000 (12:42 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/abc.rst` (#112703)

23 months agogh-109786: Fix leaks and crash when re-enter itertools.pairwise.__next__() (GH-109788)
Serhiy Storchaka [Mon, 4 Dec 2023 11:47:55 +0000 (13:47 +0200)] 
gh-109786: Fix leaks and crash when re-enter itertools.pairwise.__next__() (GH-109788)

23 months agogh-110275: Named tuple's __replace__() now raises TypeError for invalid arguments...
Serhiy Storchaka [Mon, 4 Dec 2023 11:30:32 +0000 (13:30 +0200)] 
gh-110275: Named tuple's __replace__() now raises TypeError for invalid arguments (GH-110299)

23 months agogh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords() (GH-105958)
Serhiy Storchaka [Mon, 4 Dec 2023 11:14:56 +0000 (13:14 +0200)] 
gh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords() (GH-105958)

Change the declaration of the keywords parameter in functions
PyArg_ParseTupleAndKeywords() and PyArg_VaParseTupleAndKeywords() from `char **`
to `char * const *` in C and `const char * const *` in C++.

It makes these functions compatible with argument of type `const char * const *`,
`const char **` or `char * const *` in C++ and `char * const *` in C
without explicit type cast.

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
23 months agogh-101100: Fix Sphinx nitpicks in `library/functions.rst` (#112669)
Alex Waygood [Mon, 4 Dec 2023 11:05:20 +0000 (11:05 +0000)] 
gh-101100: Fix Sphinx nitpicks in `library/functions.rst` (#112669)

23 months agogh-106550: Fix sign conversion in pycore_code.h (#112613)
Victor Stinner [Mon, 4 Dec 2023 10:42:58 +0000 (11:42 +0100)] 
gh-106550: Fix sign conversion in pycore_code.h (#112613)

Fix sign conversion in pycore_code.h: use unsigned integers and cast
explicitly when needed.

23 months agobpo-34392: Add sys. _is_interned() (GH-8755)
Serhiy Storchaka [Mon, 4 Dec 2023 09:09:06 +0000 (11:09 +0200)] 
bpo-34392: Add sys. _is_interned() (GH-8755)

23 months agogh-112625: Protect bytearray from being freed by misbehaving iterator inside bytearra...
chilaxan [Mon, 4 Dec 2023 08:15:43 +0000 (03:15 -0500)] 
gh-112625: Protect bytearray from being freed by misbehaving iterator inside bytearray.join (GH-112626)

23 months agogh-112678: Declare `Tkapp_CallDeallocArgs()` as `static` (GH-112679)
Christopher Chavez [Mon, 4 Dec 2023 08:00:27 +0000 (02:00 -0600)] 
gh-112678: Declare `Tkapp_CallDeallocArgs()` as `static` (GH-112679)

23 months agogh-66819: More IDLE htest updates(4) (#112686)
Terry Jan Reedy [Mon, 4 Dec 2023 06:36:40 +0000 (01:36 -0500)] 
gh-66819: More IDLE htest updates(4) (#112686)

Mostly double spacing before 'if __name__...'.

23 months agogh-66819: More IDLE htest updates(3) (#112683)
Terry Jan Reedy [Mon, 4 Dec 2023 04:45:56 +0000 (23:45 -0500)] 
gh-66819: More IDLE htest updates(3) (#112683)

Revise spec-callable pairs from percolator to end.

23 months agoGH-106747: Improve `Path.glob()` expectations in pathlib tests (#112365)
Barney Gale [Sun, 3 Dec 2023 20:35:10 +0000 (20:35 +0000)] 
GH-106747: Improve `Path.glob()` expectations in pathlib tests (#112365)

Add trailing slashes to expected `Path.glob()` results wherever a pattern
has a trailing slash. This matches what `glob.glob()` produces.

Due to another bug (GH-65238) pathlib strips all trailing slashes, so this
change is academic for now.

23 months agogh-101100: Fix Sphinx warning in `library/gettext.rst` (#112668)
Hugo van Kemenade [Sun, 3 Dec 2023 20:23:09 +0000 (22:23 +0200)] 
gh-101100: Fix Sphinx warning in `library/gettext.rst` (#112668)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
23 months agogh-101100: Fix most Sphinx nitpicks in `inspect.rst` (#112662)
Alex Waygood [Sun, 3 Dec 2023 17:32:49 +0000 (17:32 +0000)] 
gh-101100: Fix most Sphinx nitpicks in `inspect.rst` (#112662)

23 months agoFix link to 'The Perils of Floating Point', on the tutorial (GH-112499)
Marco Aurélio A. Barbosa [Sun, 3 Dec 2023 15:14:14 +0000 (12:14 -0300)] 
Fix link to 'The Perils of Floating Point', on the tutorial (GH-112499)

Use author link to 'The Perils of Floating Point'.

23 months agogh-112645: remove deprecation warning for use of onerror in shutil.rmtree (#112659)
Irit Katriel [Sun, 3 Dec 2023 14:02:37 +0000 (14:02 +0000)] 
gh-112645: remove deprecation warning for use of onerror in shutil.rmtree (#112659)

23 months agogh-112620: Fix dis error on show_cache with labels (#112621)
Irit Katriel [Sun, 3 Dec 2023 12:12:49 +0000 (12:12 +0000)] 
gh-112620: Fix dis error on show_cache with labels (#112621)

23 months agoRun more `inspect.rst` code snippets in CI (#112654)
Alex Waygood [Sun, 3 Dec 2023 11:50:22 +0000 (11:50 +0000)] 
Run more `inspect.rst` code snippets in CI (#112654)

23 months agogh-111545: Mention PEP 456 in PyHash_GetFuncDef() doc (#112647)
Victor Stinner [Sun, 3 Dec 2023 11:21:48 +0000 (12:21 +0100)] 
gh-111545: Mention PEP 456 in PyHash_GetFuncDef() doc (#112647)

23 months agogh-106560: Fix redundant declarations in Python/frozen.c (#112612)
Victor Stinner [Sun, 3 Dec 2023 11:18:24 +0000 (12:18 +0100)] 
gh-106560: Fix redundant declarations in Python/frozen.c (#112612)

Avoid duplicated declarations of "extern" functions in
Python/frozen.c.

Compiler warnings seen by building Python with gcc -Wredundant-decls.

23 months agogh-106560: Fix redundant declarations in Include/ (#112611)
Victor Stinner [Sun, 3 Dec 2023 11:16:31 +0000 (12:16 +0100)] 
gh-106560: Fix redundant declarations in Include/ (#112611)

Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but
only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.

23 months agogh-112578: Fix RuntimeWarning when running zipfile (GH-112579)
Shantanu [Sun, 3 Dec 2023 11:09:29 +0000 (03:09 -0800)] 
gh-112578: Fix RuntimeWarning when running zipfile (GH-112579)

23 months agogh-112316: improve docs for `inspect.signature` and `inspect.Signature` (#112631)
Alex Waygood [Sun, 3 Dec 2023 09:37:34 +0000 (09:37 +0000)] 
gh-112316: improve docs for `inspect.signature` and `inspect.Signature` (#112631)

23 months agogh-66819: More IDLE htest updates(2) (#112642)
Terry Jan Reedy [Sun, 3 Dec 2023 09:28:37 +0000 (04:28 -0500)] 
gh-66819: More IDLE htest updates(2) (#112642)

Examine and update spec -- callable pairs.
Revise run method.

23 months agogh-112139: Add `inspect.Signature.format` and use it in `pydoc` (#112143)
Nikita Sobolev [Sat, 2 Dec 2023 23:39:43 +0000 (02:39 +0300)] 
gh-112139: Add `inspect.Signature.format` and use it in `pydoc` (#112143)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
23 months agoDocs: Use sphinx-notfound-page to show a nicer 404 page (#111084)
Hugo van Kemenade [Sat, 2 Dec 2023 17:41:40 +0000 (19:41 +0200)] 
Docs: Use sphinx-notfound-page to show a nicer 404 page (#111084)

23 months agogh-112618: Make `Annotated` cache typed (#112619)
Nikita Sobolev [Sat, 2 Dec 2023 16:10:19 +0000 (19:10 +0300)] 
gh-112618: Make `Annotated` cache typed (#112619)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
23 months agogh-112316: Improve docs of `inspect.signature` and `Signature.from_callable` (#112317)
Nikita Sobolev [Sat, 2 Dec 2023 13:13:44 +0000 (16:13 +0300)] 
gh-112316: Improve docs of `inspect.signature` and `Signature.from_callable` (#112317)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
23 months agogh-106922: Support multi-line error locations in traceback (attempt 2) (#112097)
William Wen [Fri, 1 Dec 2023 22:18:16 +0000 (14:18 -0800)] 
gh-106922: Support multi-line error locations in traceback (attempt 2) (#112097)

23 months agogh-112567: Add _PyTimeFraction C API (#112568)
Victor Stinner [Fri, 1 Dec 2023 18:50:10 +0000 (19:50 +0100)] 
gh-112567: Add _PyTimeFraction C API (#112568)

Use a fraction internally in the _PyTime API to reduce the risk of
integer overflow: simplify the fraction using Greatest Common
Divisor (GCD). The fraction API is used by time functions:
perf_counter(), monotonic() and process_time().

For example, QueryPerformanceFrequency() usually returns 10 MHz on
Windows 10 and newer. The fraction SEC_TO_NS / frequency =
1_000_000_000 / 10_000_000 can be simplified to 100 / 1.

* Add _PyTimeFraction type.
* Add functions:

  * _PyTimeFraction_Set()
  * _PyTimeFraction_Mul()
  * _PyTimeFraction_Resolution()

* No longer check "numer * denom <= _PyTime_MAX" in
  _PyTimeFraction_Set(). _PyTimeFraction_Mul() uses _PyTime_Mul()
  which handles integer overflow.

23 months agogh-112567: Add _Py_GetTicksPerSecond() function (#112587)
Victor Stinner [Fri, 1 Dec 2023 16:05:56 +0000 (17:05 +0100)] 
gh-112567: Add _Py_GetTicksPerSecond() function (#112587)

* Move _PyRuntimeState.time to _posixstate.ticks_per_second and
  time_module_state.ticks_per_second.
* Add time_module_state.clocks_per_second.
* Rename _PyTime_GetClockWithInfo() to py_clock().
* Rename _PyTime_GetProcessTimeWithInfo() to py_process_time().
* Add process_time_times() helper function, called by
  py_process_time().
* os.times() is now always built: no longer rely on HAVE_TIMES.

23 months agogh-110481: Fix typo in Py_SET_REFCNT() (#112595)
Victor Stinner [Fri, 1 Dec 2023 15:54:40 +0000 (16:54 +0100)] 
gh-110481: Fix typo in Py_SET_REFCNT() (#112595)

23 months agobpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503)
Zackery Spytz [Fri, 1 Dec 2023 15:16:49 +0000 (07:16 -0800)] 
bpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503)

* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.

23 months agogh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (#112586)
Alex Waygood [Fri, 1 Dec 2023 14:54:33 +0000 (14:54 +0000)] 
gh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (#112586)

Co-authored-by: Victor Stinner <vstinner@python.org>
23 months agogh-110481: Fix Py_SET_REFCNT() integer overflow (#112174)
Victor Stinner [Fri, 1 Dec 2023 14:50:16 +0000 (15:50 +0100)] 
gh-110481: Fix Py_SET_REFCNT() integer overflow (#112174)

If Py_NOGIL is defined and Py_SET_REFCNT() is called with a reference
count larger than UINT32_MAX, make the object immortal.

Set _Py_IMMORTAL_REFCNT constant type to Py_ssize_t to fix the
following compiler warning:

Include/internal/pycore_global_objects_fini_generated.h:14:24:
warning: comparison of integers of different signs: 'Py_ssize_t'
(aka 'long') and 'unsigned int' [-Wsign-compare]

    if (Py_REFCNT(obj) < _Py_IMMORTAL_REFCNT) {
        ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~

23 months agogh-112510: Add `readline.backend` for the backend readline uses (GH-112511)
Tian Gao [Fri, 1 Dec 2023 14:05:55 +0000 (05:05 -0900)] 
gh-112510: Add `readline.backend` for the backend readline uses (GH-112511)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
23 months agogh-109413: regrtest: add WorkerRunTests class (#112588)
Victor Stinner [Fri, 1 Dec 2023 13:46:50 +0000 (14:46 +0100)] 
gh-109413: regrtest: add WorkerRunTests class (#112588)

23 months agogh-82565: Add tests for pickle and unpickle with bad files (GH-16606)
Zackery Spytz [Fri, 1 Dec 2023 13:36:37 +0000 (05:36 -0800)] 
gh-82565: Add tests for pickle and unpickle with bad files (GH-16606)

23 months agogh-112367: Only free perf trampoline arenas at shutdown (#112368)
Pablo Galindo Salgado [Fri, 1 Dec 2023 13:20:51 +0000 (13:20 +0000)] 
gh-112367: Only free perf trampoline arenas at shutdown (#112368)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
23 months agogh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed coroutine/genera...
Irit Katriel [Fri, 1 Dec 2023 12:57:31 +0000 (12:57 +0000)] 
gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed coroutine/generator. (#112428)

23 months agobpo-39912: Raise appropriate exceptions in filterwarnings() and simplefilter() (GH...
Rémi Lapeyre [Fri, 1 Dec 2023 11:17:47 +0000 (12:17 +0100)] 
bpo-39912: Raise appropriate exceptions in filterwarnings() and simplefilter() (GH-18878)

23 months agobuild(deps): bump hypothesis from 6.88.1 to 6.91.0 in /Tools (#112580)
dependabot[bot] [Fri, 1 Dec 2023 11:17:24 +0000 (11:17 +0000)] 
build(deps): bump hypothesis from 6.88.1 to 6.91.0 in /Tools (#112580)

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

---
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>
23 months agobuild(deps): bump actions/github-script from 6 to 7 (#112584)
dependabot[bot] [Fri, 1 Dec 2023 10:41:09 +0000 (11:41 +0100)] 
build(deps): bump actions/github-script from 6 to 7 (#112584)

Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
23 months agoFix typos in variable names, function names, and comments (GH-101868)
Yang Hau [Fri, 1 Dec 2023 09:37:40 +0000 (17:37 +0800)] 
Fix typos in variable names, function names, and comments (GH-101868)

23 months agobuild(deps-dev): bump types-setuptools from 68.2.0.0 to 69.0.0.0 in /Tools (#112582)
dependabot[bot] [Fri, 1 Dec 2023 09:29:04 +0000 (09:29 +0000)] 
build(deps-dev): bump types-setuptools from 68.2.0.0 to 69.0.0.0 in /Tools (#112582)

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

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
23 months agobuild(deps-dev): bump mypy from 1.7.0 to 1.7.1 in /Tools (#112581)
dependabot[bot] [Fri, 1 Dec 2023 09:21:45 +0000 (09:21 +0000)] 
build(deps-dev): bump mypy from 1.7.0 to 1.7.1 in /Tools (#112581)

Bumps [mypy](https://github.com/python/mypy) from 1.7.0 to 1.7.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
23 months agoAdd links under "generator expression" in glossary (#112537)
William Andrea [Fri, 1 Dec 2023 08:41:11 +0000 (03:41 -0500)] 
Add links under "generator expression" in glossary (#112537)

23 months agogh-66819: More IDLE htest updates (#112574)
Terry Jan Reedy [Fri, 1 Dec 2023 07:02:31 +0000 (02:02 -0500)] 
gh-66819: More IDLE htest updates (#112574)

Revise htest.py docstring and move 2 specs to alphabetical position.

23 months agogh-112205: Update stringio module to use AC for the thread-safe (gh-112549)
Donghee Na [Thu, 30 Nov 2023 23:37:30 +0000 (23:37 +0000)] 
gh-112205: Update stringio module to use AC for the thread-safe (gh-112549)

23 months agogh-109413: Run mypy on `libregrtest` in CI (#112558)
Alex Waygood [Thu, 30 Nov 2023 23:00:14 +0000 (23:00 +0000)] 
gh-109413: Run mypy on `libregrtest` in CI (#112558)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
23 months agoClarify a comment for `test.support.Py_C_RECURSION_LIMIT` to point out where a value...
Brett Cannon [Thu, 30 Nov 2023 21:38:10 +0000 (13:38 -0800)] 
Clarify a comment for `test.support.Py_C_RECURSION_LIMIT` to point out where a value came from but that it doesn't need to stay in sync (#112224)

23 months agogh-112502: Docs: Improve docs for gc.collect method (#112562)
Alperen Serkan Aksöz [Thu, 30 Nov 2023 21:04:00 +0000 (00:04 +0300)] 
gh-112502: Docs: Improve docs for gc.collect method (#112562)

* Docs: Improve docs for gc.collect method

* Update gc.rst

23 months agoClarify that WASI tool requirements are included in the devcontainer (GH-112561)
Brett Cannon [Thu, 30 Nov 2023 21:01:07 +0000 (13:01 -0800)] 
Clarify that WASI tool requirements are included in the devcontainer (GH-112561)

23 months agogh-104231: Add more tests for str(), repr(), ascii(), and bytes() (GH-112551)
Serhiy Storchaka [Thu, 30 Nov 2023 15:22:04 +0000 (17:22 +0200)] 
gh-104231: Add more tests for str(), repr(), ascii(), and bytes() (GH-112551)

23 months agogh-111699: Move smtpd note to dedicated section in What's New Python 3.12 doc (GH...
Matt Prodani [Thu, 30 Nov 2023 12:53:19 +0000 (07:53 -0500)] 
gh-111699: Move smtpd note to dedicated section in What's New Python 3.12 doc (GH-112544)

Relocate smtpd deprecation notice to it's own section rather than under
'locale' in docs for What's New in Python 3.12 doc

23 months agogh-112519: Make it possible to specify instruction flags for pseudo instructions...
Irit Katriel [Thu, 30 Nov 2023 11:03:30 +0000 (11:03 +0000)] 
gh-112519: Make it possible to specify instruction flags for pseudo instructions in bytecodes.c (#112520)

23 months agogh-112205: Support @getter annotation from AC (gh-112396)
Donghee Na [Thu, 30 Nov 2023 10:40:53 +0000 (10:40 +0000)] 
gh-112205: Support @getter annotation from AC (gh-112396)

23 months agogh-111972: Make Unicode name C APIcapsule initialization thread-safe (#112249)
Kirill Podoprigora [Thu, 30 Nov 2023 10:12:49 +0000 (13:12 +0300)] 
gh-111972: Make Unicode name C APIcapsule initialization thread-safe (#112249)

23 months agoIDLE: fix config_key htest (#112545)
Terry Jan Reedy [Thu, 30 Nov 2023 07:08:44 +0000 (02:08 -0500)] 
IDLE: fix config_key htest (#112545)

Change 'Dialog' to 'Window' in two places to match the name of the config_key class being tested.

23 months agoGH-103065, GH-106704, GH-105253: Provide a `Tools/wasm/wasi.py` script to simplify...
Brett Cannon [Thu, 30 Nov 2023 00:18:25 +0000 (16:18 -0800)] 
GH-103065, GH-106704, GH-105253: Provide a `Tools/wasm/wasi.py` script to simplify doing a WASI build (GH-112473)

23 months agogh-104003: Implement PEP 702 (#104004)
Jelle Zijlstra [Wed, 29 Nov 2023 17:38:29 +0000 (09:38 -0800)] 
gh-104003: Implement PEP 702 (#104004)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
23 months agogh-112509: Fix keys being present in both required_keys and optional_keys in TypedDic...
Jelle Zijlstra [Wed, 29 Nov 2023 17:36:48 +0000 (09:36 -0800)] 
gh-112509: Fix keys being present in both required_keys and optional_keys in TypedDict (#112512)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
23 months agoAdd more C API tests (GH-112522)
Serhiy Storchaka [Wed, 29 Nov 2023 15:37:05 +0000 (17:37 +0200)] 
Add more C API tests (GH-112522)

Add tests for PyObject_Str(), PyObject_Repr(), PyObject_ASCII() and
PyObject_Bytes().

23 months ago[Enum] update class creation for RuntimeError changes (GH-111815)
Ethan Furman [Wed, 29 Nov 2023 04:40:12 +0000 (20:40 -0800)] 
[Enum] update class creation for RuntimeError changes (GH-111815)