]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-106368: Argument clinic tests: improve error message when `expect_success()` fails...
Alex Waygood [Thu, 3 Aug 2023 21:26:14 +0000 (22:26 +0100)] 
gh-106368: Argument clinic tests: improve error message when `expect_success()` fails (#107606)

2 years agogh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567)
Eric Snow [Thu, 3 Aug 2023 19:51:08 +0000 (13:51 -0600)] 
gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567)

The linked list of objects was a global variable, which broke isolation between interpreters, causing crashes. To solve this, we've moved the linked list to each interpreter.

2 years agogh-107446: Fix test_inspect.test_class_with_method_from_other_module when ran multipl...
Tian Gao [Thu, 3 Aug 2023 15:04:03 +0000 (07:04 -0800)] 
gh-107446: Fix test_inspect.test_class_with_method_from_other_module when ran multiple times (#107451)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2 years agogh-107576: Ensure `__orig_bases__` are our own in `get_original_bases` (#107584)
James Hilton-Balfe [Thu, 3 Aug 2023 14:19:24 +0000 (15:19 +0100)] 
gh-107576: Ensure `__orig_bases__` are our own in `get_original_bases` (#107584)

Co-authored-by: Chris Bouchard <chris@upliftinglemma.net>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-107077: Raise SSLCertVerificationError even if the error is set via SSL_ERROR_SYSC...
Pablo Galindo Salgado [Thu, 3 Aug 2023 12:37:14 +0000 (13:37 +0100)] 
gh-107077: Raise SSLCertVerificationError even if the error is set via SSL_ERROR_SYSCALL (#107586)

Co-authored-by: T. Wouters <thomas@python.org>
2 years agogh-106368: Increase Argument Clinic test coverage (#107582)
Erlend E. Aasland [Thu, 3 Aug 2023 09:35:26 +0000 (11:35 +0200)] 
gh-106368: Increase Argument Clinic test coverage (#107582)

Add tests for DSL parser state machine and docstring formatting

2 years agoGH-107458: fix test_tools refleak (#107577)
Kumar Aditya [Thu, 3 Aug 2023 06:36:02 +0000 (12:06 +0530)] 
GH-107458: fix test_tools refleak (#107577)

2 years agogh-107455: ctypes: Improve error messages when converting to an incompatible type...
Tomas R [Thu, 3 Aug 2023 05:29:03 +0000 (07:29 +0200)] 
gh-107455: ctypes: Improve error messages when converting to an incompatible type (#107456)

2 years agogh-104683: Rework Argument Clinic error handling (#107551)
Erlend E. Aasland [Thu, 3 Aug 2023 00:00:06 +0000 (02:00 +0200)] 
gh-104683: Rework Argument Clinic error handling (#107551)

Introduce ClinicError, and use it in fail(). The CLI runs main(),
catches ClinicError, formats the error message, prints to stderr
and exits with an error.

As a side effect, this refactor greatly improves the accuracy of
reported line numbers in case of error.

Also, adapt the test suite to work with ClinicError.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-107471: Fix Refleaks in test_import (gh-107569)
Eric Snow [Wed, 2 Aug 2023 20:55:09 +0000 (14:55 -0600)] 
gh-107471: Fix Refleaks in test_import (gh-107569)

gh-107184 introduced a refleak in test_import.SubinterpImportTests (specifically test_singlephase_check_with_setting_and_override and test_single_init_extension_compat).  We fix it here by making sure _testsinglephase is removed from sys.modules whenever we clear the runtime's internal state for the module.

The underlying problem is strictly contained in the internal function _PyImport_ClearExtension() (AKA _testinternalcapi.clear_extension()), which is only used in tests.

(This also fixes an intermittent segfault introduced in the same place, in test_disallowed_reimport.)

2 years agogh-104683: Make Argument Clinic template strings class level members (#107556)
Erlend E. Aasland [Wed, 2 Aug 2023 19:37:36 +0000 (21:37 +0200)] 
gh-104683: Make Argument Clinic template strings class level members (#107556)

The motivation for this change is to clean up the output_templates()
method a little bit, as it accounts for ~10% of the lines of code in
clinic.py; removing some clutter helps readability.

2 years agoFix test_capi.test_misc when run with -R:: (#107566)
Guido van Rossum [Wed, 2 Aug 2023 19:05:25 +0000 (12:05 -0700)] 
Fix test_capi.test_misc when run with -R:: (#107566)

Should fix the buildbot failures.

This creates a new function each time that test is run, like Victor did for other tests.

2 years agoGH-100964: Break cycles involving exception state when returning from generator ...
Mark Shannon [Wed, 2 Aug 2023 17:44:20 +0000 (18:44 +0100)] 
GH-100964: Break cycles involving exception state when returning from generator (GH-107563)

2 years agogh-105481: simplify definition of pseudo ops in Lib/opcode.py (#107561)
Irit Katriel [Wed, 2 Aug 2023 17:16:57 +0000 (18:16 +0100)] 
gh-105481: simplify definition of pseudo ops in Lib/opcode.py (#107561)

2 years agogh-106368: Increase test coverage for Argument Clinic (#107514)
Erlend E. Aasland [Wed, 2 Aug 2023 13:33:10 +0000 (15:33 +0200)] 
gh-106368: Increase test coverage for Argument Clinic (#107514)

As per this commit, we've got approx. ~91% test coverage for clinic.py.

2 years agogh-107559: Argument Clinic: complain about non-ASCII chars in param docstrings (...
Erlend E. Aasland [Wed, 2 Aug 2023 12:40:23 +0000 (14:40 +0200)] 
gh-107559: Argument Clinic: complain about non-ASCII chars in param docstrings (#107560)

Previously, only function docstrings were checked for non-ASCII characters.
Also, improve the warn() message.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104146: Remove dead code from Argument Clinic (#107555)
Erlend E. Aasland [Wed, 2 Aug 2023 09:22:17 +0000 (11:22 +0200)] 
gh-104146: Remove dead code from Argument Clinic (#107555)

2 years agogh-104683: Argument Clinic: Refactor and simplify 'add docstring' states (#107550)
Erlend E. Aasland [Tue, 1 Aug 2023 23:32:27 +0000 (01:32 +0200)] 
gh-104683: Argument Clinic: Refactor and simplify 'add docstring' states (#107550)

Introduce docstring_append() helper, and use it for both parameter and
function docstrings. Remove docstring fixup from
do_post_block_processing_cleanup(); instead, make sure no fixup is needed.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104683: Argument clinic: cleanup `DLSParser` `state_foo` methods (#107543)
Alex Waygood [Tue, 1 Aug 2023 20:42:39 +0000 (21:42 +0100)] 
gh-104683: Argument clinic: cleanup `DLSParser` `state_foo` methods (#107543)

2 years agoClarify `Self` interaction with subclasses (#107511)
Alexandru Mărășteanu [Tue, 1 Aug 2023 20:20:25 +0000 (21:20 +0100)] 
Clarify `Self` interaction with subclasses (#107511)

2 years agogh-104683: Argument clinic: remove the `LandMine` class (#107541)
Alex Waygood [Tue, 1 Aug 2023 20:10:54 +0000 (21:10 +0100)] 
gh-104683: Argument clinic: remove the `LandMine` class (#107541)

2 years agogh-105481: combine regen-opcode-targets with regen-opcode to avoid calculating the...
Irit Katriel [Tue, 1 Aug 2023 20:05:48 +0000 (21:05 +0100)] 
gh-105481: combine regen-opcode-targets with regen-opcode to avoid calculating the specialized opcodes in two places (#107540)

2 years agogh-105481: the ENABLE_SPECIALIZATION flag does not need to be generated by the build...
Irit Katriel [Tue, 1 Aug 2023 17:05:00 +0000 (18:05 +0100)] 
gh-105481: the ENABLE_SPECIALIZATION flag does not need to be generated by the build script, or exposed in opcode.py (#107534)

2 years agogh-107467: Restructure Argument Clinic command-line interface (#107469)
Erlend E. Aasland [Tue, 1 Aug 2023 16:24:23 +0000 (18:24 +0200)] 
gh-107467: Restructure Argument Clinic command-line interface (#107469)

- Use ArgumentParser.error() to handle CLI errors
- Put the entire CLI in main()
- Rework ClinicExternalTest to call main() instead of using subprocesses

Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2 years agogh-106092: Fix use-after-free crash in frame_dealloc (#106875)
Anders Kaseorg [Tue, 1 Aug 2023 09:32:18 +0000 (02:32 -0700)] 
gh-106092: Fix use-after-free crash in frame_dealloc (#106875)

It was possible for the trashcan to delay the deallocation of a
PyFrameObject until after its corresponding _PyInterpreterFrame has
already been freed.  So frame_dealloc needs to avoid dereferencing the
f_frame pointer unless it first checks that the pointer still points
to the interpreter frame within the frame object.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2 years agoRemove newlines from bug template (#107525)
Hugo van Kemenade [Tue, 1 Aug 2023 07:47:24 +0000 (10:47 +0300)] 
Remove newlines from bug template (#107525)

2 years agogh-89013: Improve the performance of methodcaller (lazy version) (gh-107201)
Pieter Eendebak [Tue, 1 Aug 2023 06:45:51 +0000 (08:45 +0200)] 
gh-89013: Improve the performance of methodcaller (lazy version) (gh-107201)

2 years agogh-99113: Add a What's New Entry for PEP 684 (gh-107520)
Eric Snow [Mon, 31 Jul 2023 23:13:55 +0000 (17:13 -0600)] 
gh-99113: Add a What's New Entry for PEP 684 (gh-107520)

2 years agogh-105766: Document that Custom Allocators Must Be Thread-Safe (gh-107519)
Eric Snow [Mon, 31 Jul 2023 23:11:15 +0000 (17:11 -0600)] 
gh-105766: Document that Custom Allocators Must Be Thread-Safe (gh-107519)

2 years agogh-107306: Add a Doc Entry for Py_mod_multiple_interpreters (#107403)
Eric Snow [Mon, 31 Jul 2023 23:03:01 +0000 (17:03 -0600)] 
gh-107306: Add a Doc Entry for Py_mod_multiple_interpreters (#107403)

It was added in 3.12 for PEP 684 (per-interpreter GIL).

2 years agogh-107507: Replace 'The goals of Argument Clinic' with a summary (#107508)
Erlend E. Aasland [Mon, 31 Jul 2023 21:33:13 +0000 (23:33 +0200)] 
gh-107507: Replace 'The goals of Argument Clinic' with a summary (#107508)

Summarise the goals of Argument Clinic in a single sentence.
Mention that Argument Clinic was introduced with PEP-436.

2 years agoUse tstate->interp to get the interpreter state in bytecodes.c (GH-107506)
Brandt Bucher [Mon, 31 Jul 2023 21:18:38 +0000 (14:18 -0700)] 
Use tstate->interp to get the interpreter state in bytecodes.c (GH-107506)

2 years agoGH-104584: Fix incorrect uoperands (GH-107513)
Brandt Bucher [Mon, 31 Jul 2023 21:16:57 +0000 (14:16 -0700)] 
GH-104584: Fix incorrect uoperands (GH-107513)

2 years agogh-106762: Add news for `EnumMeta.__getattr__` removal (GH-107466)
Jacob Walls [Mon, 31 Jul 2023 17:24:44 +0000 (13:24 -0400)] 
gh-106762: Add news for `EnumMeta.__getattr__` removal (GH-107466)

2 years agoGH-104909: Move unused cache entries from uops to macros (#107444)
Guido van Rossum [Mon, 31 Jul 2023 15:55:33 +0000 (08:55 -0700)] 
GH-104909: Move unused cache entries from uops to macros (#107444)

There's no need to use a dummy uop to skip unused cache entries. The macro syntax lets you write `unused/1` instead.

Similarly, move `unused/5` from op `_LOAD_ATTR_INSTANCE_VALUE` to macro `LOAD_ATTR_INSTANCE_VALUE`.

2 years agogh-105578: Document that `AnyStr` is deprecated in py313 (#107116)
Michael The [Mon, 31 Jul 2023 15:43:53 +0000 (17:43 +0200)] 
gh-105578: Document that `AnyStr` is deprecated in py313 (#107116)

It will not be removed until Python 3.18.

2 years agogh-105578: Add more usage examples to `typing.AnyStr` docs (#107045)
Michael The [Mon, 31 Jul 2023 15:23:08 +0000 (17:23 +0200)] 
gh-105578: Add more usage examples to `typing.AnyStr` docs (#107045)

``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion

2 years agogh-87799: Improve the textual representation of IPv4-mapped IPv6 addresses (#29345)
opavliuk [Mon, 31 Jul 2023 14:33:26 +0000 (16:33 +0200)] 
gh-87799: Improve the textual representation of IPv4-mapped IPv6 addresses (#29345)

Represent IPv4-mapped IPv6 address as x:x:x:x:x:x:d.d.d.d,
where the 'x's are the hexadecimal values
of the six high-order 16-bit pieces of the address,
and the 'd's are the decimal values
of the four low-order 8-bit pieces of the address
(standard IPv4 representation).

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2 years agogh-105751: Remove obsolete `object` base class in some ctypes tests (#107460)
Tomas R [Mon, 31 Jul 2023 12:48:27 +0000 (14:48 +0200)] 
gh-105751: Remove obsolete `object` base class in some ctypes tests (#107460)

2 years agono-issue: Fix typo in import.c (gh-107498)
Georg Brandl [Mon, 31 Jul 2023 12:07:17 +0000 (14:07 +0200)] 
no-issue: Fix typo in import.c (gh-107498)

2 years agogh-106368: Add test for Argument Clinic misbehaving custom converter_init() (#107496)
Erlend E. Aasland [Mon, 31 Jul 2023 11:50:03 +0000 (13:50 +0200)] 
gh-106368: Add test for Argument Clinic misbehaving custom converter_init() (#107496)

2 years agogh-104280: Add test cases for DTrace probes (#107125)
Furkan Onder [Mon, 31 Jul 2023 08:33:37 +0000 (11:33 +0300)] 
gh-104280: Add test cases for DTrace probes (#107125)

2 years agogh-46376: Return existing pointer when possible in ctypes (#107131)
Konstantin [Mon, 31 Jul 2023 07:10:53 +0000 (09:10 +0200)] 
gh-46376: Return existing pointer when possible in ctypes (#107131)

2 years agoUpdate macOS installer screens to 3.13. (GH-107475)
Ned Deily [Mon, 31 Jul 2023 06:05:47 +0000 (02:05 -0400)] 
Update macOS installer screens to 3.13. (GH-107475)

2 years agogh-99079: Update macOS installer to use OpenSSL 3.0.9. (GH-107474)
Ned Deily [Mon, 31 Jul 2023 05:58:35 +0000 (01:58 -0400)] 
gh-99079: Update macOS installer to use OpenSSL 3.0.9. (GH-107474)

2 years agogh-107427: Update the description of UNPACK_SEQUENCE (gh-107429)
Dong-hee Na [Sun, 30 Jul 2023 15:40:37 +0000 (00:40 +0900)] 
gh-107427: Update the description of UNPACK_SEQUENCE (gh-107429)

2 years agogh-106263: Fix segfault in `signaldict_repr` in `_decimal` module (#106270)
Charlie Zhao [Sun, 30 Jul 2023 08:28:54 +0000 (16:28 +0800)] 
gh-106263: Fix segfault in `signaldict_repr`  in `_decimal` module (#106270)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2 years agogh-104683: Argument clinic: pass `clinic` as a parameter where possible (#107435)
Alex Waygood [Sat, 29 Jul 2023 18:47:42 +0000 (19:47 +0100)] 
gh-104683: Argument clinic: pass `clinic` as a parameter where possible (#107435)

2 years agogh-104683: Argument clinic: Make the `filename` parameter to `Clinic` required (...
Alex Waygood [Sat, 29 Jul 2023 18:46:52 +0000 (19:46 +0100)] 
gh-104683: Argument clinic: Make the `filename` parameter to `Clinic` required (#107439)

2 years agoadd Kumar Aditya as CODEOWNER for import.c (#107441)
Kumar Aditya [Sat, 29 Jul 2023 18:26:24 +0000 (23:56 +0530)] 
add Kumar Aditya as CODEOWNER for import.c (#107441)

2 years agoFix the documentation for PyCode_New add `qualname` parameter (#107186)
da-woods [Sat, 29 Jul 2023 17:41:40 +0000 (18:41 +0100)] 
Fix the documentation for PyCode_New add `qualname` parameter (#107186)

2 years agogh-107422: Remove outdated `TypedDict` example from typing docs (#107436)
Rakesh Sabale [Sat, 29 Jul 2023 17:04:46 +0000 (22:34 +0530)] 
gh-107422: Remove outdated `TypedDict` example from typing docs (#107436)

2 years agoImprove the GitHub issue templates (#107150) 107423/head
Alex Waygood [Sat, 29 Jul 2023 14:42:44 +0000 (15:42 +0100)] 
Improve the GitHub issue templates (#107150)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2 years agogh-104050: Argument clinic: enable mypy's `--warn-return-any` setting (#107405)
Alex Waygood [Sat, 29 Jul 2023 12:39:21 +0000 (13:39 +0100)] 
gh-104050: Argument clinic: enable mypy's `--warn-return-any` setting (#107405)

2 years agogh-107369: optimize textwrap.indent() (#107374)
Inada Naoki [Sat, 29 Jul 2023 06:37:23 +0000 (15:37 +0900)] 
gh-107369: optimize textwrap.indent() (#107374)

2 years agogh-101100: Sphinx warnings: pick the low hanging fruits (GH-107386)
Serhiy Storchaka [Sat, 29 Jul 2023 05:48:10 +0000 (08:48 +0300)] 
gh-101100: Sphinx warnings: pick the low hanging fruits (GH-107386)

2 years agogh-107091: Fix some uses of :func: role (GH-107378)
Serhiy Storchaka [Sat, 29 Jul 2023 05:43:10 +0000 (08:43 +0300)] 
gh-107091: Fix some uses of :func: role (GH-107378)

:c:func: or :c:macro: should be used instead.

2 years agogh-107089: Improve Shelf.clear method performance (gh-107090)
James Cave [Sat, 29 Jul 2023 00:08:11 +0000 (20:08 -0400)] 
gh-107089: Improve Shelf.clear method performance (gh-107090)

2 years agogh-106881: Check for linux/limits.h before including it (#107397)
justdan6 [Fri, 28 Jul 2023 22:08:43 +0000 (16:08 -0600)] 
gh-106881: Check for linux/limits.h before including it (#107397)

* Check for linux/limits.h before including it

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-107307: Update the importlib Docs for PEP 684 (gh-107400)
Eric Snow [Fri, 28 Jul 2023 22:00:03 +0000 (16:00 -0600)] 
gh-107307: Update the importlib Docs for PEP 684 (gh-107400)

2 years agogh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974)
Eric Snow [Fri, 28 Jul 2023 20:39:08 +0000 (14:39 -0600)] 
gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974)

This fixes a crasher due to a race condition, triggered infrequently when two isolated (own GIL) subinterpreters simultaneously initialize their sys or builtins modules.  The crash happened due the combination of the "detached" thread state we were using and the "last holder" logic we use for the GIL.  It turns out it's tricky to use the same thread state for different threads.  Who could have guessed?

We solve the problem by eliminating the one object we were still sharing between interpreters.  We replace it with a low-level hashtable, using the "raw" allocator to avoid tying it to the main interpreter.

We also remove the accommodations for "detached" thread states, which were a dubious idea to start with.

2 years agogh-104050: Argument clinic: complete type annotations (#107399)
Alex Waygood [Fri, 28 Jul 2023 20:27:21 +0000 (21:27 +0100)] 
gh-104050: Argument clinic: complete type annotations (#107399)

2 years agogh-107305: Update the C-API Docs for PEP 684 (gh-107324)
Eric Snow [Fri, 28 Jul 2023 19:46:55 +0000 (13:46 -0600)] 
gh-107305: Update the C-API Docs for PEP 684 (gh-107324)

2 years agogh-106368: Argument clinic: Fix minor bug in `state_modulename_name` (#107387)
Alex Waygood [Fri, 28 Jul 2023 18:10:45 +0000 (19:10 +0100)] 
gh-106368: Argument clinic: Fix minor bug in `state_modulename_name` (#107387)

2 years agogh-104629: Build _testclinic extension module on Windows (#104723)
Erlend E. Aasland [Fri, 28 Jul 2023 16:31:30 +0000 (18:31 +0200)] 
gh-104629: Build _testclinic extension module on Windows (#104723)

2 years agoGH-101291: Add warning to "what's new" that `PyLongObject` internals have changed...
Mark Shannon [Fri, 28 Jul 2023 16:07:33 +0000 (17:07 +0100)] 
GH-101291: Add warning to "what's new" that `PyLongObject` internals have changed. (GH-107388)

2 years agoFix typo in comment (gh-107389)
Tom Niget [Fri, 28 Jul 2023 14:52:29 +0000 (16:52 +0200)] 
Fix typo in comment (gh-107389)

2 years agogh-102509: Start initializing `ob_digit` of `_PyLongValue` (GH-102510)
Illia Volochii [Fri, 28 Jul 2023 13:39:54 +0000 (16:39 +0300)] 
gh-102509: Start initializing `ob_digit` of `_PyLongValue` (GH-102510)

2 years agoGH-104580: Put `eval_breaker` back at the start of the interpreter state. (GH-107383)
Mark Shannon [Fri, 28 Jul 2023 12:55:25 +0000 (13:55 +0100)] 
GH-104580: Put `eval_breaker` back at the start of the interpreter state. (GH-107383)

2 years agogh-107091: Fix some uses of :const: role (GH-107379)
Serhiy Storchaka [Fri, 28 Jul 2023 10:26:28 +0000 (13:26 +0300)] 
gh-107091: Fix some uses of :const: role (GH-107379)

It is for references, not for literals.

2 years agogh-106078: Isolate `decimal` module (#107287)
Charlie Zhao [Fri, 28 Jul 2023 05:58:14 +0000 (13:58 +0800)] 
gh-106078: Isolate `decimal` module (#107287)

2 years agogh-106723: forward -Xfrozen_modules option to spawned process interpreters (#106724)
Felipe A. Hernandez [Fri, 28 Jul 2023 05:04:26 +0000 (06:04 +0100)] 
gh-106723: forward -Xfrozen_modules option to spawned process interpreters (#106724)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-106368: Argument clinic tests: improve failure message when tests in `ClinicExtern...
Alex Waygood [Thu, 27 Jul 2023 23:57:55 +0000 (00:57 +0100)] 
gh-106368: Argument clinic tests: improve failure message when tests in `ClinicExternalTests` fail (#107364)

2 years agogh-104683: Argument clinic: cleanup `state_modulename_name()` (#107340)
Alex Waygood [Thu, 27 Jul 2023 21:51:18 +0000 (22:51 +0100)] 
gh-104683: Argument clinic: cleanup `state_modulename_name()` (#107340)

2 years agogh-106931: Fix the WASM Buildbots (gh-107362)
Eric Snow [Thu, 27 Jul 2023 21:46:02 +0000 (15:46 -0600)] 
gh-106931: Fix the WASM Buildbots (gh-107362)

Skip subinterpreter tests when not supported.

2 years agogh-101524: Only Use Public C-API in the _xxsubinterpreters Module (gh-107359)
Eric Snow [Thu, 27 Jul 2023 21:30:16 +0000 (15:30 -0600)] 
gh-101524: Only Use Public C-API in the _xxsubinterpreters Module (gh-107359)

The _xxsubinterpreters module should not rely on internal API.  Some of the functions it uses were recently moved there however.  Here we move them back (and expose them properly).

2 years agogh-104621: Check for Incompatible Extensions in import_find_extension() (gh-107184)
Eric Snow [Thu, 27 Jul 2023 21:08:38 +0000 (15:08 -0600)] 
gh-104621: Check for Incompatible Extensions in import_find_extension() (gh-107184)

This fixes a bug where incompatible modules could still be imported if attempted multiple times.

2 years agogh-106931: Intern Statically Allocated Strings Globally (gh-107272)
Eric Snow [Thu, 27 Jul 2023 19:56:59 +0000 (13:56 -0600)] 
gh-106931: Intern Statically Allocated Strings Globally (gh-107272)

We tried this before with a dict and for all interned strings.  That ran into problems due to interpreter isolation.  However, exclusively using a per-interpreter cache caused some inconsistency that can eliminate the benefit of interning.  Here we circle back to using a global cache, but only for statically allocated strings.  We also use a more-basic _Py_hashtable_t for that global cache instead of a dict.

Ideally we would only have the global cache, but the optional isolation of each interpreter's allocator means that a non-static string object must not outlive its interpreter.  Thus we would have to store a copy of each such interned string in the global cache, tied to the main interpreter.

2 years agogh-105699: Disable the Interpreters Stress Tests (gh-107354)
Eric Snow [Thu, 27 Jul 2023 19:39:26 +0000 (13:39 -0600)] 
gh-105699: Disable the Interpreters Stress Tests (gh-107354)

The two tests are crashing periodically in CI and on buildbots.  I suspect the problem is in the _xxsubinterpreters module.
 Regardless, I'm disabling the tests temporarily, to reduce the noise as we approach 3.12rc1.  I'll be investigating the crashes separately.

2 years agogh-104432: Use `memcpy()` to avoid misaligned loads (#104433)
Christopher Chavez [Thu, 27 Jul 2023 19:20:25 +0000 (14:20 -0500)] 
gh-104432: Use `memcpy()` to avoid misaligned loads (#104433)

Fix potential unaligned memory access on C APIs involving returned sequences
of `char *` pointers within the :mod:`grp` and :mod:`socket` modules. These
were revealed using a ``-fsaniziter=alignment`` build on ARM macOS.

2 years agogh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345)
Serhiy Storchaka [Thu, 27 Jul 2023 15:44:32 +0000 (18:44 +0300)] 
gh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345)

2 years agoGH-106898: Add the exception as an argument to the `PY_UNWIND` event callback functio...
Mark Shannon [Thu, 27 Jul 2023 14:47:33 +0000 (15:47 +0100)] 
GH-106898: Add the exception as an argument to the `PY_UNWIND` event callback function. (GH-107347)

2 years agogh-105268: _PyGC_FINALIZED() removal is already documented in 3.12 (#107350)
Victor Stinner [Thu, 27 Jul 2023 14:43:09 +0000 (16:43 +0200)] 
gh-105268: _PyGC_FINALIZED() removal is already documented in 3.12 (#107350)

2 years agogh-107196: Remove _PyArg_VaParseTupleAndKeywordsFast() function (#107197)
Victor Stinner [Thu, 27 Jul 2023 14:36:54 +0000 (16:36 +0200)] 
gh-107196: Remove _PyArg_VaParseTupleAndKeywordsFast() function (#107197)

Remove the private _PyArg_VaParseTupleAndKeywordsFast() function: it
is no longer used.

2 years agoGH-106895: Raise a `ValueError` when attempting to disable events that cannot be...
Mark Shannon [Thu, 27 Jul 2023 14:27:11 +0000 (15:27 +0100)] 
GH-106895: Raise a `ValueError` when attempting to disable events that cannot be disabled. (GH-107337)

2 years agogh-105481: remove dependency of _inline_cache_entries on opname (#107339)
Irit Katriel [Thu, 27 Jul 2023 13:15:25 +0000 (14:15 +0100)] 
gh-105481: remove dependency of _inline_cache_entries on opname (#107339)

2 years agoGH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291)
Mark Shannon [Thu, 27 Jul 2023 12:32:30 +0000 (13:32 +0100)] 
GH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291)

* Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.

2 years agoBump some docs dependencies to resolve a Dependabot security alert (#107341)
Alex Waygood [Thu, 27 Jul 2023 11:53:21 +0000 (12:53 +0100)] 
Bump some docs dependencies to resolve a Dependabot security alert (#107341)

2 years agogh-103731: Remove unneeded checks for TCL_WIDE_INT_TYPE (GH-103732)
Christopher Chavez [Thu, 27 Jul 2023 08:25:19 +0000 (03:25 -0500)] 
gh-103731: Remove unneeded checks for TCL_WIDE_INT_TYPE (GH-103732)

2 years agogh-106996: Rewrite turtle explanation (#107244)
Daniele Procida [Thu, 27 Jul 2023 08:02:19 +0000 (10:02 +0200)] 
gh-106996: Rewrite turtle explanation (#107244)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agoremove outdated `_asyncio` globals from globals-to-fix.tsv (#107334)
Kumar Aditya [Thu, 27 Jul 2023 07:24:44 +0000 (12:54 +0530)] 
remove outdated `_asyncio` globals from globals-to-fix.tsv (#107334)

2 years agogh-107279 Add `<stddef.h>` to `Modules/zlibmodule.c` to fix failing builds (#107280)
shailshouryya [Thu, 27 Jul 2023 06:56:39 +0000 (23:56 -0700)] 
gh-107279 Add `<stddef.h>` to `Modules/zlibmodule.c` to fix failing builds (#107280)

2 years agogh-107298: Docs: add targets for some :c:member: and :c:macro: references (GH-107316)
Serhiy Storchaka [Thu, 27 Jul 2023 06:04:02 +0000 (09:04 +0300)] 
gh-107298: Docs: add targets for some :c:member: and :c:macro: references (GH-107316)

Add targets for PyStructSequence_Desc and PyStructSequence_Field members
and macros like Py_EQ.
Fix target for Py_RETURN_RICHCOMPARE.

2 years agogh-107091: Fix some uses of :attr: role (GH-107318)
Serhiy Storchaka [Thu, 27 Jul 2023 05:52:54 +0000 (08:52 +0300)] 
gh-107091: Fix some uses of :attr: role (GH-107318)

Fix also formatting of PyMethodDef members.

2 years agogh-107298: Fix more Sphinx warnings in the C API doc (#107329)
Victor Stinner [Thu, 27 Jul 2023 00:52:40 +0000 (02:52 +0200)] 
gh-107298: Fix more Sphinx warnings in the C API doc (#107329)

Declare the following functions as macros, since they are actually
macros. It avoids a warning on "TYPE" or "macro" argument.

* PyMem_New()
* PyMem_Resize()
* PyModule_AddIntMacro()
* PyModule_AddStringMacro()
* PyObject_GC_New()
* PyObject_GC_NewVar()
* PyObject_New()
* PyObject_NewVar()

Add C standard C types to nitpick_ignore in Doc/conf.py:

* int64_t
* uint64_t
* uintptr_t

No longer ignore non existing "__int" type in nitpick_ignore.

Update Doc/tools/.nitignore

2 years agogh-107298: Fix Sphinx warnings in the C API doc (#107302)
Victor Stinner [Wed, 26 Jul 2023 23:41:15 +0000 (01:41 +0200)] 
gh-107298: Fix Sphinx warnings in the C API doc (#107302)

* Update Doc/tools/.nitignore
* Fix BufferedIOBase.write() link in buffer.rst

2 years agogh-106149: fix comment on stackdepth of generators (#107321)
Irit Katriel [Wed, 26 Jul 2023 22:31:47 +0000 (23:31 +0100)] 
gh-106149: fix comment on stackdepth of generators (#107321)

2 years agoDocs: Argument Clinic: Restructure "Basic concepts and usage" (#106981)
Erlend E. Aasland [Wed, 26 Jul 2023 22:08:43 +0000 (00:08 +0200)] 
Docs: Argument Clinic: Restructure "Basic concepts and usage" (#106981)

Split "Basic concepts and usage" into:

- Reference
  - Terminology
  - CLI reference

- Background
  - Basic concepts

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2 years agoDocs: Remove the numbered steps from the Argument Clinic tutorial (#107203)
Erlend E. Aasland [Wed, 26 Jul 2023 20:54:25 +0000 (22:54 +0200)] 
Docs: Remove the numbered steps from the Argument Clinic tutorial (#107203)

Instead, order the tutorial as one body of prose, making it easier to
align the tutorial according to Diátaxis principles.

2 years agogh-104050: Argument clinic: Annotate `str_converter_key()` (#107294)
Alex Waygood [Wed, 26 Jul 2023 20:12:18 +0000 (21:12 +0100)] 
gh-104050: Argument clinic: Annotate `str_converter_key()` (#107294)