They use special method lookup for special methods.
(cherry picked from commit 9e8fa2d4d1ec263bdc6945237b0e0517f07a3474)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
---------
(cherry picked from commit 7a7521bcfad4a8346d460476de2e3fa11e412477)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
gh-143637: Fix test_socket.test_sendmsg_reentrant_ancillary_mutation() on Solaris (GH-144890)
Use socket.SCM_RIGHTS operation.
(cherry picked from commit 63531a3867cf4f8b5a7088fb7667d33534c43ff7)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-144782: Make sure that ArgumentParser instances are pickleable (GH-144783)
(cherry picked from commit 2f7634c0291c92cf1e040fc81c4210f0883e6036)
Co-authored-by: Mauricio Villegas <5780272+mauvilsa@users.noreply.github.com>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
gh-144601: Avoid sharing exception objects raised in a `PyInit` function across multiple interpreters (GH-144602)
(cherry picked from commit fd6b639a49dd1143c6fd8729fc49f17b3114a965)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843)
In newPySSLSocket(), when SSL_new() returns NULL, Py_DECREF(self)
was called before _setSSLError(get_state_ctx(self), ...), causing
a use-after-free. Additionally, get_state_ctx() was called with
self (PySSLSocket*) instead of sslctx (PySSLContext*), which is
a type confusion bug.
Fix by calling _setSSLError() before Py_DECREF() and using
sslctx instead of self for get_state_ctx().
(cherry picked from commit c91638ca0671b8038831f963ed44e66cdda006a2)
Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
gh-144759: Fix undefined behavior from NULL pointer arithmetic in lexer (GH-144788)
Guard against NULL pointer arithmetic in `_PyLexer_remember_fstring_buffers`
and `_PyLexer_restore_fstring_buffers`. When `start` or `multi_line_start`
are NULL (uninitialized in tok_mode_stack[0]), performing `NULL - tok->buf`
is undefined behavior. Add explicit NULL checks to store -1 as sentinel
and restore NULL accordingly.
Add test_lexer_buffer_realloc_with_null_start to test_repl.py that
exercises the code path where the lexer buffer is reallocated while
tok_mode_stack[0] has NULL start/multi_line_start pointers. This
triggers _PyLexer_remember_fstring_buffers and verifies the NULL
checks prevent undefined behavior.
(cherry picked from commit e6110efd03259acd1895cff63fbfa115ac5f16dc)
Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
[3.14] gh-144551: Update CI to use latest OpenSSL versions
Also update _ssl_data_35.h to include an added symbol from 3.5.5.
(cherry picked from commit b933ef92619db2a103a26c70e69b6d31978eb566)
gh-144787: [tests] Allow TLS v1.2 to be minimum version (GH-144790)
Allow TLS v1.2 to be minimum version
Updates test_min_max_version to allow TLS v1.2 to be minimum version if
TLS 1.0 and 1.1 are disabled in OpenSSL.
(cherry picked from commit d625f7da33bf8eb57fb7e1a05deae3f68bf4d00f)
Co-authored-by: Colin McAllister <colinmca242@gmail.com>
* gh-141563: Enable test_cppext internal C API tests on macOS (#144711)
Build the C API in C++11 mode on macOS.
(cherry picked from commit c6e418d1744aed95a6f25d22565204649dde29c7)
* gh-135906: Test more internal headers in test_cext/test_cppext (#144751)
(cherry picked from commit b488f338cf058f46cbf0255023ca1c1669b0eb44)
gh-144706: Warn against using synchronization primitives within signal handlers (GH-144736)
(cherry picked from commit 945bf8ce1bf7ee3881752c2ecc129e35ab818477)
Co-authored-by: Robsdedude <dev@rouvenbauer.de>
Lookup for CJK ideograms and Hangul syllables is now case-insensitive,
as is the case for other character names.
(cherry picked from commit e66f4a5a9c7ce744030d6352bf5575639b1096cc)
Co-authored-by: James <snoopjedi@gmail.com>
This was causing ucd_3_2_0.numeric() to pick up only decimal
changes between Unicode 3.2.0 and the current version.
(cherry picked from commit 3e0322ff16f47caa3e273d453f007d3918b8ac80)
Co-authored-by: William Meehan <wmeehan@fb.com>
gh-142518: Define lock-free and per-object lock (GH-144548)
- Add definitions of lock-free and per-object lock to the glossary
- Cross-reference these from list thread safety notes
- Change admonition to rubric
(cherry picked from commit 12dbae4c02dac197330d5bfa650b495e962aba6d)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
gh-143650: Fix importlib race condition on import failure (GH-143651)
Fix a race condition where a thread could receive a partially-initialized
module when another thread's import fails. The race occurs when:
1. Thread 1 starts importing, adds module to sys.modules
2. Thread 2 sees the module in sys.modules via the fast path
3. Thread 1's import fails, removes module from sys.modules
4. Thread 2 returns a stale module reference not in sys.modules
The fix adds verification after the "skip lock" optimization in both Python
and C code paths to check if the module is still in sys.modules. If the
module was removed (due to import failure), we retry the import so the
caller receives the actual exception from the import failure rather than
a stale module reference.
(cherry picked from commit ac8b5b6890006ee7254ea878866cb486ff835ecb)
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630)
(cherry picked from commit cc81707e406c49c63afc18048e1a221d796ce638)
Co-authored-by: Nybblista <170842536+nybblista@users.noreply.github.com>
gh-144652: Support Windows exit status in support get_signal_name() (GH-144653)
Format Windows exit status as hexadecimal.
(cherry picked from commit b121dc434748772272514311fe315e009fdfe6e5)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-134179: Use sys._clear_internal_caches() at test_cmd_line (GH-134180)
Use sys._clear_internal_caches() instead of deprecated sys._clear_type_cache() at test_cmd_line.
(cherry picked from commit dd2da42ea479c32a4260463b47e1b58877d07bdc)
Co-authored-by: alexey semenyuk <alexsemenyuk88@gmail.com>
This was done in GH-119743 (3.14).
(cherry picked from commit aa6ed802f20c1ddadf45942d350422d3d4e0bbea)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
(cherry picked from commit d5cb9f6a9b6f48cc08c4422259498d4fd023357a)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
gh-106318: Add example for str.isalnum() (GH-137550)
(cherry picked from commit 3dd7a3c65ad4ac330ad44a519efa017484530e1a)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
For `enum.bin`, update versionadded directive from 3.10 to 3.11 (GH-144574)
(cherry picked from commit d73634935cb9ce00a57dcacbd2e56371e4c18451)
Co-authored-by: Guo Ci <zguoci@gmail.com>
gh-143700: document `secrets.DEFAULT_ENTROPY` as an opaque value (GH-144568)
(cherry picked from commit 934997218e55714003276a70090a710cb3beeb61)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
gh-142044: Add note to prefer `asyncio.timeout[_at]` over `asyncio.Timeout` (GH-144449)
(cherry picked from commit 0e7c06a85880ba790fac4239b0ff1052399a36ae)
Co-authored-by: kovan <xaum.io@gmail.com>
gh-140490: Document changes for `PurePath.stem` in Python 3.14 (GH-144450)
(cherry picked from commit 16efaa225cbe53345b482daddee85b5ebfe3cb98)
Co-authored-by: kovan <xaum.io@gmail.com>