118037 Commits

Author SHA1 Message Date
Eric Snow
8ba4df91ae
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.
2023-07-28 14:39:08 -06:00
Alex Waygood
55ed85e49c
gh-104050: Argument clinic: complete type annotations (#107399) 2023-07-28 21:27:21 +01:00
Eric Snow
c0b81c4b54
gh-107305: Update the C-API Docs for PEP 684 (gh-107324) 2023-07-28 13:46:55 -06:00
Alex Waygood
ecc05e23a1
gh-106368: Argument clinic: Fix minor bug in state_modulename_name (#107387) 2023-07-28 19:10:45 +01:00
Erlend E. Aasland
3a1d819ebc
gh-104629: Build _testclinic extension module on Windows (#104723) 2023-07-28 18:31:30 +02:00
Mark Shannon
1ee605c588
GH-101291: Add warning to "what's new" that PyLongObject internals have changed. (GH-107388) 2023-07-28 17:07:33 +01:00
Tom Niget
2aaa83d5f5
Fix typo in comment (gh-107389) 2023-07-28 10:52:29 -04:00
Illia Volochii
fc130c47da
gh-102509: Start initializing ob_digit of _PyLongValue (GH-102510) 2023-07-28 14:39:54 +01:00
Mark Shannon
a1b679572e
GH-104580: Put eval_breaker back at the start of the interpreter state. (GH-107383) 2023-07-28 13:55:25 +01:00
Serhiy Storchaka
0aa58fa7a6
gh-107091: Fix some uses of :const: role (GH-107379)
It is for references, not for literals.
2023-07-28 13:26:28 +03:00
Charlie Zhao
a43cc3fa1f
gh-106078: Isolate decimal module (#107287) 2023-07-28 11:28:14 +05:30
Felipe A. Hernandez
3dcac78581
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>
2023-07-28 05:04:26 +00:00
Alex Waygood
76c26eaca4
gh-106368: Argument clinic tests: improve failure message when tests in ClinicExternalTests fail (#107364) 2023-07-27 23:57:55 +00:00
Alex Waygood
c2b1689abc
gh-104683: Argument clinic: cleanup state_modulename_name() (#107340) 2023-07-27 22:51:18 +01:00
Eric Snow
2f9bb77764
gh-106931: Fix the WASM Buildbots (gh-107362)
Skip subinterpreter tests when not supported.
2023-07-27 21:46:02 +00:00
Eric Snow
8bdae1424b
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).
2023-07-27 15:30:16 -06:00
Eric Snow
75c974f535
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.
2023-07-27 15:08:38 -06:00
Eric Snow
b72947a8d2
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.
2023-07-27 13:56:59 -06:00
Eric Snow
4f67921ad2
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.
2023-07-27 19:39:26 +00:00
Christopher Chavez
f01e4cedba
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.
2023-07-27 19:20:25 +00:00
Serhiy Storchaka
983305268e
gh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345) 2023-07-27 18:44:32 +03:00
Mark Shannon
ac7a0f858a
GH-106898: Add the exception as an argument to the PY_UNWIND event callback function. (GH-107347) 2023-07-27 15:47:33 +01:00
Victor Stinner
9a7204b86b
gh-105268: _PyGC_FINALIZED() removal is already documented in 3.12 (#107350) 2023-07-27 14:43:09 +00:00
Victor Stinner
1dbb427dd6
gh-107196: Remove _PyArg_VaParseTupleAndKeywordsFast() function (#107197)
Remove the private _PyArg_VaParseTupleAndKeywordsFast() function: it
is no longer used.
2023-07-27 16:36:54 +02:00
Mark Shannon
c6539b36c1
GH-106895: Raise a ValueError when attempting to disable events that cannot be disabled. (GH-107337) 2023-07-27 15:27:11 +01:00
Irit Katriel
d77d973335
gh-105481: remove dependency of _inline_cache_entries on opname (#107339) 2023-07-27 14:15:25 +01:00
Mark Shannon
766d2518ae
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.
2023-07-27 13:32:30 +01:00
Alex Waygood
f84d77b4e0
Bump some docs dependencies to resolve a Dependabot security alert (#107341) 2023-07-27 11:53:21 +00:00
Christopher Chavez
6e850c30bb
gh-103731: Remove unneeded checks for TCL_WIDE_INT_TYPE (GH-103732) 2023-07-27 11:25:19 +03:00
Daniele Procida
ccd4253752
gh-106996: Rewrite turtle explanation (#107244)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-07-27 11:02:19 +03:00
Kumar Aditya
71b3eda02c
remove outdated _asyncio globals from globals-to-fix.tsv (#107334) 2023-07-27 07:24:44 +00:00
shailshouryya
4b2e54bd3c
gh-107279 Add <stddef.h> to Modules/zlibmodule.c to fix failing builds (#107280) 2023-07-27 12:26:39 +05:30
Serhiy Storchaka
abec9a1b20
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.
2023-07-27 09:04:02 +03:00
Serhiy Storchaka
d363eb5b02
gh-107091: Fix some uses of :attr: role (GH-107318)
Fix also formatting of PyMethodDef members.
2023-07-27 08:52:54 +03:00
Victor Stinner
8d61a71f9c
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
2023-07-27 00:52:40 +00:00
Victor Stinner
391e03fa05
gh-107298: Fix Sphinx warnings in the C API doc (#107302)
* Update Doc/tools/.nitignore
* Fix BufferedIOBase.write() link in buffer.rst
2023-07-27 01:41:15 +02:00
Irit Katriel
507d8bc39a
gh-106149: fix comment on stackdepth of generators (#107321) 2023-07-26 22:31:47 +00:00
Erlend E. Aasland
2ad699002e
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>
2023-07-26 22:08:43 +00:00
Erlend E. Aasland
592395577c
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.
2023-07-26 22:54:25 +02:00
Alex Waygood
5aa6964a5c
gh-104050: Argument clinic: Annotate str_converter_key() (#107294) 2023-07-26 21:12:18 +01:00
Alex Waygood
f9bcdf2368
gh-104050: Argument clinic: Complete get_destination_buffer annotations (#107293) 2023-07-26 21:11:15 +01:00
János Kukovecz
e7e6e4b035
gh-105002: [pathlib] Fix relative_to with walk_up=True using ".." (#107014)
It makes sense to raise an Error because ".." can not
be resolved and the current working directory is unknown.
2023-07-26 20:44:55 +01:00
Serhiy Storchaka
6d5b6e71c8
gh-107091: Fix some uses of :c:type: role (GH-107138) 2023-07-26 22:29:23 +03:00
Serhiy Storchaka
af61cb9c78
gh-107091: Fix some uses of :c:member: role (GH-107129) 2023-07-26 22:16:06 +03:00
Roman Yurchak
737d1da074
Document that os.link() is not available on Emscripten (GH-104822) 2023-07-26 11:38:59 -07:00
Victor Stinner
87b39028e5
gh-107298: Fix doc references to undocumented modules (#107300)
Update also Doc/tools/.nitignore.
2023-07-26 18:59:06 +02:00
Victor Stinner
b1de3807b8
gh-106948: Update documentation nitpick_ignore for c:identifer domain (#107295)
Update the nitpick_ignore of the documentation configuration to fix
Sphinx warnings about standard C types when declaring functions with
the "c:function" markups.

Copy standard C types declared in the "c:type" domain to the
"c:identifier" domain, since "c:function" markup looks for types in
the "c:identifier" domain.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-07-26 18:04:46 +02:00
Pablo Galindo Salgado
da8f87b7ea
gh-107015: Remove async_hacks from the tokenizer (#107018) 2023-07-26 16:34:15 +01:00
Irit Katriel
b0202a4e5d
gh-106149: Simplify stack depth calculation. Replace asserts by exceptions. (#107255) 2023-07-26 13:32:47 +01:00
Alex Waygood
14d074e1fb
gh-104683: Argument Clinic: Make most arguments to Class and Function required (#107289) 2023-07-26 11:54:03 +01:00