gh-134235: Import Autocomplete for Builtin Modules (GH-134277)
* added enhancement auto completing import with sys builtins
---------
(cherry picked from commit 8421b03b16)
Co-authored-by: Tom Wang <85062819+tommix626@users.noreply.github.com>
Co-authored-by: Hunter <hyoung3@gmail.com>
Extension builders must specify Py_GIL_DISABLED if they want to link to the free-threaded builds.
This was usually the case already, but this change guarantees it in all circumstances.
gh-132388: test HACL* and OpenSSL hash functions in pure Python HMAC (GH-134051)
(cherry picked from commit 73d71a416f)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
gh-133701: Fix incorrect `__annotations__` on TypedDict defined under PEP 563 (GH-133772)
(cherry picked from commit 9836503b48)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
gh-132641: fix race in `lru_cache` under free-threading (GH-133787)
Fix race in `lru_cache` by acquiring critical section on the cache object itself and call the lock held variant of dict functions to modify the underlying dict.
(cherry picked from commit 9ad0c7b0f1)
Co-authored-by: Peter Hawkins <phawkins@google.com>
If the error handler is used, a new bytes object is created to set as
the object attribute of UnicodeDecodeError, and that bytes object then
replaces the original data. A pointer to the decoded data will became invalid
after destroying that temporary bytes object. So we need other way to return
the first invalid escape from _PyUnicode_DecodeUnicodeEscapeInternal().
_PyBytes_DecodeEscape() does not have such issue, because it does not
use the error handlers registry, but it should be changed for compatibility
with _PyUnicode_DecodeUnicodeEscapeInternal().
(cherry picked from commit 9f69a58623)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
It now supports non-ASCII paths in non-UTF-8 locales and
non-UTF-8 paths in UTF-8 locales.
(cherry picked from commit c09cec5d69)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Fix TypeError when formatter_class is a custom subclass of
HelpFormatter.
* Fix TypeError when formatter_class is not a subclass of
HelpFormatter and non-standard prefix_char is used.
* Fix support of colorizing when formatter_class is not a subclass of
HelpFormatter.
* Remove the prefix_chars parameter of HelpFormatter.
(cherry picked from commit 734e15b70d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Prevent the possibility of re-entrancy leading to deadlock or infinite recursion (caused by logging triggered by logging), by disabling logging while the logger is handling log messages.
(cherry picked from commit 2561e148ec)
Co-authored-by: Duane Griffin <duaneg@dghda.com>
gh-133744: Fix multiprocessing interrupt test: add an event (GH-133746)
Add an event to synchronize the parent process with the child
process: wait until the child process starts sleeping.
(cherry picked from commit c2989b7070)
Co-authored-by: Victor Stinner <vstinner@python.org>
When calling .close() the HTMLParser should flush all remaining content,
even when that content is in an unclosed script or style tag.
(cherry picked from commit 53383e90e4)
Co-authored-by: Waylan Limberg <waylan.limberg@icloud.com>
gh-132642: document how to render human-readable `timedelta` objects (GH-133825)
(cherry picked from commit efcc42ba70)
Co-authored-by: Kentaro Jay Takahashi <64148935+KentaroJay@users.noreply.github.com>
GH-132983: PEP 7 and Argument Clinic changes for zstd (GH-133791)
(cherry picked from commit 1978904a2f)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This makes the test more reliable since there are not extra objects on the heap leftover
from other tests.
(cherry picked from commit 8598e57942)
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
gh-133519: Add console to resources in libregrtest (GH-133520)
Add console to resources in libregrtest
(cherry picked from commit 4274b47156)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
gh-132983: Clean-ups for ``_zstd`` (GH-133670)
(cherry picked from commit c2a5d4b383)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-133682: Fix inconsistent set ordering in annotationlib test (GH-133702)
(cherry picked from commit a2a0fa91c4)
Co-authored-by: Akshat Gupta <akshat.gupta24@gmail.com>
According to the HTML5 spec, named character references in attribute values
should only be processed if they are not followed by an ASCII alphanumeric,
or an equals sign.
(cherry picked from commit 77b14a6d58)
https: //html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
Co-authored-by: Sascha Ißbrücker <sascha.issbruecker@googlemail.com>
The function `dict_set_fromkeys()` adds elements of a set to an existing
dictionary. The size of the expanded dictionary was estimated with
`PySet_GET_SIZE(iterable)`, which did not take into account the size of the
existing dictionary.
(cherry picked from commit 421ba589d0)
Co-authored-by: Angela Liss <59097311+angela-tarantula@users.noreply.github.com>
This converts functions, code, str, bytes, bytearray, and memoryview objects to PyCodeObject,
and ensure that the object looks like a script. That means no args, no return, and no closure.
_PyCode_GetPureScriptXIData() takes it a step further and ensures there are no globals.
We also add _PyObject_SupportedAsScript() to the internal C-API.
(cherry picked from commit c81fa2b9cd, AKA gh-133480)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>