cpython/Lib
Eric Snow 0d5fe2c7b4
[3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119425)
_PyArg_Parser holds static global data generated for modules by Argument Clinic.  The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global.  In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters.  However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed.

This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes.  It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime.  The solution here is to temporarily switch to the main interpreter.  The alternative would be to always statically allocate the tuple.

This change also fixes a bug where only the most recent parser was added to the global linked list.

(cherry picked from commit 81865002ae)
2024-05-22 22:26:58 +00:00
..
__phello__
asyncio [3.12] gh-91227: Ignore ERROR_PORT_UNREACHABLE in proactor recvfrom() (GH-32011) (GH-117209) 2024-03-25 12:21:31 +02:00
collections [3.12] gh-117387 Remove hash mark from introductory text (GH-117409) (#gh- 2024-03-31 21:24:28 +00:00
concurrent [3.12] gh-114440: Close writer pipe in multiprocessing.Queue, not concurrent.futures (GH-114489) 2024-01-24 13:21:10 +01:00
ctypes [3.12] gh-87969: Align docs and docstrings with implementation for ctypes' [w]string_at() (GH-25384) (GH-118046) 2024-04-19 13:23:26 +02:00
curses gh-60436: fix curses textbox backspace/del (#103783) 2023-04-26 22:54:07 +02:00
dbm
email [3.12] gh-118643: Fix AttributeError in the email module (GH-119099) (GH-119390) 2024-05-22 14:08:05 +03:00
encodings
ensurepip [3.12] gh-114965: Updated bundled pip to 24.0 (gh-114966) (gh-114971) 2024-02-03 19:37:13 +00:00
html
http [3.12] gh-100985: Consistently wrap IPv6 IP address during CONNECT (GH-100986) (GH-115591) 2024-02-17 15:01:48 +02:00
idlelib [3.12] gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175) (#119290) 2024-05-21 04:09:30 +00:00
importlib [3.12] gh-117178: Recover lazy loading of self-referential modules (GH-117179) (#117319) 2024-03-28 11:15:16 +00:00
json [3.12] doc: Use super() in subclassed JSONEncoder examples (GH-115565) (GH-116047) 2024-02-28 14:13:08 +00:00
lib2to3
logging [3.12] gh-117975: Ensure flush level is checked when configuring a logging MemoryHandler. (GH-117976) (GH-117986) 2024-04-17 14:48:09 +01:00
msilib
multiprocessing [3.12] bpo-43952: Fix multiprocessing Listener authkey bug (GH-25845) (GH-115995) 2024-02-27 16:13:53 +00:00
pydoc_data [3.12] Add 'The Python 2.3 Method Resolution Order' (GH-116435) (#117885) 2024-04-15 14:14:16 +03:00
re [3.12] gh-109747: Improve errors for unsupported look-behind patterns (GH-109859) (GH-110859) 2023-10-14 06:42:19 +00:00
site-packages
sqlite3 [3.12] gh-118221: Always use the default row factory in sqlite3.iterdump() (#118223) (#118270) 2024-04-25 08:33:35 +00:00
test [3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119425) 2024-05-22 22:26:58 +00:00
tkinter [3.12] gh-71592: Add ability to trace Tcl commands executed by Tkinter (GH-118291) (GH-118662) 2024-05-06 19:26:08 +00:00
tomllib
turtledemo [3.12] gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175) (#119290) 2024-05-21 04:09:30 +00:00
unittest [3.12] gh-90848: Fixed create_autospec ignoring configure_mock style kwargs (GH-118163) (#118517) 2024-05-02 18:01:17 +00:00
urllib [3.12] gh-67693: Fix urlunparse() and urlunsplit() for URIs with path starting with multiple slashes and no authority (GH-113563) (GH-119024) 2024-05-14 09:47:11 +00:00
venv gh-90329: Add _winapi.GetLongPathName and GetShortPathName and use in venv to reduce warnings (GH-117817) 2024-04-15 16:43:41 +01:00
wsgiref
xml [3.12] gh-101549: fix documentation of xml.etree.ElementInclude (GH-101550) (#117754) 2024-04-11 14:53:27 +00:00
xmlrpc
zipfile [3.12] gh-102190: Add additional zipfile pwd= arg docstrings (gh-102195) (GH-117408) 2024-03-31 18:53:51 -07:00
zoneinfo [3.12] gh-106233: Fix stacklevel in zoneinfo.InvalidTZPathWarning (GH-106234) (GH-115081) 2024-02-06 13:26:39 +00:00
__future__.py
__hello__.py
_aix_support.py
_collections_abc.py gh-91896: Deprecate collections.abc.ByteString (#102096) 2023-05-04 09:39:33 -07:00
_compat_pickle.py
_compression.py
_markupbase.py
_osx_support.py [3.12] gh-102362: Fix macOS version number in result of sysconfig.get_platform() (GH-112942) (#113264) 2023-12-19 19:51:17 +01:00
_py_abc.py
_pydatetime.py [3.12] gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761) (#114767) 2024-01-30 19:24:27 -08:00
_pydecimal.py [3.12] gh-118164: str(10**10000) hangs if the C _decimal module is missing (GH-118503) (GH-118584) 2024-05-05 09:34:43 +03:00
_pyio.py [3.12] gh-95782: Fix io.BufferedReader.tell() etc. being able to return offsets < 0 (GH-99709) (GH-115599) 2024-02-17 14:56:00 +02:00
_pylong.py [3.12] gh-118164: Break a loop between _pydecimal and _pylong and optimize int to str conversion (GH-118483) (GH-118590) 2024-05-06 12:10:05 +03:00
_sitebuiltins.py
_strptime.py [3.12] bpo-36959: Fix error messages for invalid ISO format string in _strptime() (GH-13408) (GH-113495) 2023-12-26 21:56:42 +02:00
_threading_local.py
_weakrefset.py
abc.py
aifc.py
antigravity.py
argparse.py [3.12] bpo-44865: Fix yet one missing translations in argparse (GH-27668) (GH-115974) 2024-02-26 23:09:57 +00:00
ast.py [3.12] gh-112364: Correct unparsing of backslashes and quotes in ast.… (#115782) 2024-02-21 23:28:07 +00:00
base64.py
bdb.py [3.12] gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979) (#119008) 2024-05-13 20:21:15 +01:00
bisect.py
bz2.py
calendar.py [3.12] Remove limit in calendar CLI help message for year arg (GH-114719) (GH-114722) 2024-01-29 16:40:32 +00:00
cgi.py
cgitb.py
chunk.py
cmd.py
code.py
codecs.py [3.12] gh-50644: Forbid pickling of codecs streams (GH-109180) (#109231) 2023-10-02 16:55:52 +02:00
codeop.py [3.12] gh-111366: Correctly show custom syntax error messages in the codeop module functions (GH-111384). (#111517) 2023-10-30 19:53:01 +00:00
colorsys.py [3.12] gh-106498: Revert incorrect colorsys.rgb_to_hls change (GH-106627) (#106632) 2023-07-11 15:47:15 +00:00
compileall.py
configparser.py [3.12] gh-116957: configparser: Do post-process values after DuplicateOptionError (GH-116958) (GH-117013) 2024-03-19 18:18:50 +01:00
contextlib.py [3.12] gh-103791: handle BaseExceptionGroup in contextlib.suppress() (GH-111910) (#111955) 2023-11-10 14:00:48 +00:00
contextvars.py
copy.py
copyreg.py
cProfile.py gh-103935: Use io.open_code() when executing code in trace and profile modules (GH-103947) 2023-04-27 20:29:35 +00:00
crypt.py
csv.py
dataclasses.py [3.12] gh-118033: Fix __weakref__ not set for generic dataclasses (GH-118099) (#118822) 2024-05-09 09:09:40 +00:00
datetime.py [3.12] gh-84976: Add back UTC to datetime.__all__ (GH-104920) (#106019) 2023-06-26 20:41:52 -07:00
decimal.py [3.12] gh-71966: Move the module docstring from _pydecimal to decimal (GH-117919) (GH-117962) 2024-04-17 15:13:21 +03:00
difflib.py
dis.py [3.12] gh-108826: Document dis module CLI and rename _test function to main (#108827) (#110681) 2023-10-11 14:47:38 -06:00
doctest.py [3.12] gh-117692: Fix AttributeError in DocTestFinder on wrapped builtin_or_method (GH-117699) (#117708) 2024-04-10 14:17:15 +00:00
enum.py [3.12] gh-116600: [Enum] fix global Flag repr (GH-116615) (GH-116629) 2024-03-11 17:36:00 -07:00
filecmp.py
fileinput.py
fnmatch.py
fractions.py [3.12] gh-114014: Update fractions.Fraction()'s rational parsing regex (GH-114015) (#114023) 2024-01-13 13:21:34 -05:00
ftplib.py [3.12] gh-114241: Fix and improve the ftplib CLI (GH-114242) (GH-114404) 2024-01-21 20:48:12 +00:00
functools.py [3.12] Add 'The Python 2.3 Method Resolution Order' (GH-116435) (#117885) 2024-04-15 14:14:16 +03:00
genericpath.py
getopt.py
getpass.py
gettext.py [3.12] gh-110519: Improve deprecation warning in the gettext module (GH-110520) (GH-110563) 2023-10-09 16:27:01 +02:00
glob.py [3.12] gh-79382: Fix recursive glob() with trailing "**" (GH-115134) (GH-115290) 2024-02-11 10:57:40 +00:00
graphlib.py
gzip.py [3.12] gh-108111: Flush gzip write buffer before seeking, fixing bad writes (GH-108341) (#108402) 2023-08-24 12:30:16 +02:00
hashlib.py
heapq.py
hmac.py [3.12] gh-112999: Replace the outdated "deprecated" directives with "versionchanged" (GH-113000) (GH-113019) 2023-12-12 17:20:51 +00:00
imaplib.py
imghdr.py
inspect.py [3.12] gh-87106: Fix inspect.signature.bind() handling of positional-only arguments with **kwargs (GH-103404) (GH-118984) 2024-05-13 08:29:47 +00:00
io.py gh-111356: io: Add missing documented objects to io.__all__ (GH-111370) 2023-11-10 07:37:19 +00:00
ipaddress.py [3.12] gh-117566: fix IPv6Address.is_loopback for IPv4-mapped loopbacks (GH-117567) (GH-118391) 2024-04-29 14:41:26 +00:00
keyword.py gh-103763: Implement PEP 695 (#103764) 2023-05-15 20:36:23 -07:00
linecache.py [3.12] gh-86291: linecache: get module name from __spec__ if available (GH-22908) (GH-115731) 2024-02-20 18:14:24 +00:00
locale.py [3.12] gh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568) (GH-117890) 2024-04-15 12:59:34 +00:00
lzma.py
mailbox.py [3.12] gh-117467: Add preserving of mailbox owner on flush (GH-117510) (GH-117537) 2024-04-04 10:55:42 +00:00
mailcap.py
mimetypes.py [3.12] gh-66543: Fix mimetype.guess_type() (GH-117217) (GH-117256) 2024-03-26 11:43:36 +00:00
modulefinder.py
netrc.py
nntplib.py
ntpath.py [3.12] gh-106242: Make ntpath.realpath errors consistent with abspath when there are embedded nulls (GH-108248) (#108251) 2023-08-22 12:01:24 +02:00
nturl2path.py
numbers.py
opcode.py gh-103865: add monitoring support to LOAD_SUPER_ATTR (#103866) 2023-05-16 10:29:00 -06:00
operator.py
optparse.py
os.py [3.12] gh-116401: Fix blocking os.fwalk() and shutil.rmtree() on opening a named pipe (GH-116421) (GH-116716) 2024-03-13 10:02:37 +00:00
pathlib.py [3.12] docs: typo: tiny grammar change: "pointed by" -> "pointed to by" (GH-118411) (#118504) 2024-05-02 06:01:06 +00:00
pdb.py [3.12] gh-90095: Ignore empty lines and comments in .pdbrc (GH-116834) (#116854) 2024-03-15 09:52:00 +00:00
pickle.py [3.12] gh-85567: Fix resouce warnings in pickle and pickletools CLIs (GH-113618) (GH-113758) 2024-01-05 22:37:43 +00:00
pickletools.py [3.12] gh-115146: Fix typo in pickletools.py documentation (GH-115148) (GH-115155) 2024-02-08 08:30:31 +00:00
pipes.py
pkgutil.py gh-97850: Deprecate find_loader and get_loader in pkgutil (GH-98520) 2023-05-03 16:11:54 -07:00
platform.py [3.12] gh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568) (GH-117890) 2024-04-15 12:59:34 +00:00
plistlib.py
poplib.py
posixpath.py [3.12] gh-117503: Fix support of non-ASCII user names in posixpath.expanduser() (GH-117504) (GH-117970) 2024-04-17 10:43:37 +00:00
pprint.py [3.12] [pprint]: Add docstring about PrettyPrinter.underscore_numbers parameter (GH-112963) (#113053) 2023-12-13 12:38:07 +00:00
profile.py gh-103935: Use io.open_code() when executing code in trace and profile modules (GH-103947) 2023-04-27 20:29:35 +00:00
pstats.py
pty.py gh-96522: Fix deadlock in pty.spawn (#96639) 2023-05-19 13:22:43 +00:00
py_compile.py
pyclbr.py
pydoc.py [3.12] gh-116143: Fix race condition in pydoc _start_server (GH-116144) (#116415) 2024-03-06 14:58:02 +00:00
queue.py
quopri.py
random.py [3.12] gh-109653: Reduce the import time of random by 60% (GH-110221) (#110247) 2023-10-02 23:31:55 +00:00
reprlib.py [3.12] gh-109818: reprlib.recursive_repr copies __type_params__ (… (#109999) 2023-10-02 17:41:26 +02:00
rlcompleter.py
runpy.py gh-98040: Remove just the imp module (#98573) 2023-04-28 16:17:58 -07:00
sched.py
secrets.py
selectors.py [3.12] gh-110038: KqueueSelector must count all read/write events (GH-110039) (#110043) 2023-10-02 17:42:55 +02:00
shelve.py
shlex.py
shutil.py [3.12] docs: typo: tiny grammar change: "pointed by" -> "pointed to by" (GH-118411) (#118504) 2024-05-02 06:01:06 +00:00
signal.py [3.12] gh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py (GH-113040) (#113443) 2023-12-23 18:09:59 -08:00
site.py gh-77102: site: try utf-8 and locale encoding when reading .pth file (GH-117802) 2024-04-16 18:51:06 +09:00
smtplib.py
sndhdr.py
socket.py [3.12] gh-110383: Document socket.makefile() accepts combined modes (GH-119150) (#119325) 2024-05-21 18:52:56 +00:00
socketserver.py gh-103673: Add missing ForkingUnixStreamServer and ForkingUnixDatagramServer socketservers (#103674) 2023-04-24 22:35:52 +00:00
sre_compile.py
sre_constants.py
sre_parse.py
ssl.py [3.12] gh-113280: Always close socket if SSLSocket creation failed (GH-114659) (GH-114995) 2024-02-04 16:12:19 +00:00
stat.py
statistics.py
string.py
stringprep.py
struct.py
subprocess.py [3.12] gh-90872: Fix subprocess.Popen.wait() for negative timeout (#116989) (#117002) 2024-03-19 14:15:05 +00:00
sunau.py
symtable.py [3.12] gh-110045: Update symtable module for PEP 695 (GH-110066) (#110070) 2023-09-29 08:10:22 +02:00
sysconfig.py
tabnanny.py gh-102856: Python tokenizer implementation for PEP 701 (#104323) 2023-05-21 01:03:02 +01:00
tarfile.py [3.12] gh-117691: Add an appropriate stacklevel for PEP-706 tarfile deprecation warnings (GH-117872) (GH-117930) 2024-04-16 11:54:01 +00:00
telnetlib.py [3.12] gh-118042: Fix error in Telnet.__del__ when __init__() was not called (GH-118274) 2024-04-26 08:53:54 +03:00
tempfile.py [3.12] gh-79325: Fix recursion error in TemporaryDirectory cleanup on Windows (GH-112762) (GH-112847) 2023-12-07 17:36:29 +00:00
textwrap.py
this.py
threading.py [3.12] gh-102512: Turn _DummyThread into _MainThread after os.fork() called from a foreign thread (GH-113261) (GH-114430) 2024-01-22 15:24:43 +00:00
timeit.py [3.12] gh-105052:update timeit function's description (GH-105060) (#108534) 2023-08-27 16:15:01 +02:00
token.py gh-102856: Python tokenizer implementation for PEP 701 (#104323) 2023-05-21 01:03:02 +01:00
tokenize.py [3.12] gh-115154: Fix untokenize handling of unicode named literals (GH-115171) (#115662) 2024-02-19 16:38:43 +00:00
trace.py [3.12] gh-103956: Fix trace output in case of missing source line (GH-103958) (GH-118832) 2024-05-09 12:51:03 +00:00
traceback.py [3.12] gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359) (#114173) 2024-01-21 17:12:17 +00:00
tracemalloc.py
tty.py [3.12] gh-114328: tty cbreak mode should not alter ICRNL (GH-114335) (#114410) 2024-01-21 23:41:03 +00:00
turtle.py [3.12] gh-107805: Fix signatures of module-level generated functions in turtle (GH-107807) (#108749) 2023-09-01 15:32:35 +02:00
types.py [3.12] gh-107576: Ensure __orig_bases__ are our own in get_original_bases (GH-107584) (#107592) 2023-08-03 17:07:43 +02:00
typing.py [3.12] gh-118418: Use a default value for type_params in typing._eval_type (GH-118431) (#118436) 2024-04-30 16:26:38 +00:00
uu.py gh-99889: Fix directory traversal security flaw in uu.decode() (#104096) 2023-05-09 16:01:58 +00:00
uuid.py gh-104396: uuid.py to skip platform check for emscripten and wasi (gh-104397) 2023-05-12 07:45:55 +09:00
warnings.py [3.12] gh-117535: Ignore made up file name "sys" for warnings (#118014) 2024-04-19 04:07:05 +00:00
wave.py [3.12] gh-105096: Reformat wave documentation (#105136) (#105138) 2023-05-31 12:04:21 +00:00
weakref.py
webbrowser.py [3.12] gh-113543: Make sure that MacOSXOSAScript sends webbrowser.open audit event (GH-113544) (#113549) 2023-12-29 09:56:18 +01:00
xdrlib.py
zipapp.py
zipimport.py