gh-132159: Do not shadow user arguments in generated `__new__` by `@warnings.deprecated` (GH-132160)
(cherry picked from commit 7bb1e1a236)
Co-authored-by: Xuehai Pan <XuehaiPan@pku.edu.cn>
gh-132038: Make perf version check in test_perf_profiler more robust (GH-132039)
Should work also if the version string includes a commit hash, like `perf version 6.12.9.g242e6068fd5c`
(cherry picked from commit b6c92ec419)
Co-authored-by: Itamar Oren <itamarost@gmail.com>
Fix numbered list syntax in programming.rst (GH-130158)
(cherry picked from commit 376631829a)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
CPython's pthread-based thread identifier relies on pthread_t being able
to be represented as an unsigned integer type.
This is true in most Linux libc implementations where it's defined as an
unsigned long, however musl typedefs it as a struct *.
If the pointer has the high bit set and is cast to PyThread_ident_t, the
resultant value can be sign-extended [0]. This can cause issues when
comparing against threading._MainThread's identifier. The main thread's
identifier value is retrieved via _get_main_thread_ident which is backed
by an unsigned long which truncates sign extended bits.
>>> hex(threading.main_thread().ident)
'0xb6f33f3c'
>>> hex(threading.current_thread().ident)
'0xffffffffb6f33f3c'
Work around this by conditionally compiling in some code for non-glibc
based Linux platforms that are at risk of sign-extension to return a
PyLong based on the main thread's unsigned long thread identifier if the
current thread is the main thread.
[0]: https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Arrays-and-pointers-implementation.html
---------
(cherry picked from commit 72123063dd)
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Co-authored-by: Vincent Fazio <vfazio@gmail.com>
gh-130655: Add a test for corrupt `.mo` files in `gettext` (GH-131911)
(cherry picked from commit a126cefc17)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
gh-130655: Add a test for bad magic numbers in `.mo` files parsed by `gettext` (GH-131909)
(cherry picked from commit 16a6270aa6)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
gh-130655: Add tests for `gettext.find()` (GH-130691)
(cherry picked from commit 3118693a1a)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Now all structure members are initialized with zeroes by default.
(cherry picked from commit 345baa77ba)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-111178: Fix getsockaddrarg() undefined behavior (#131668)
Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.
On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.
(cherry picked from commit 8cd29c2b53)
gh-131736: only apply `security_level` workaround in `test_ssl` for security levels greater than 1 (GH-131739)
(cherry picked from commit 3b3720f1a2)
Co-authored-by: Will Childs-Klein <willck93@gmail.com>
Minor improvements to the programming FAQ (GH-127261)
(cherry picked from commit 23a658b9af)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-125957: sync argument naming in sphinx docs of the cmath and help() (GH-125958)
(cherry picked from commit 0a3eb8855c)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Adds a `package` entry point to the `android.py` build script to support
creating an Android distribution artefact.
(cherry picked from commit fe5c4c53e7)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
gh-129917: Update installers to use SQLite 3.49.1 (GH-131025)
(cherry picked from commit 45a3ab5a81)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Ned Deily <nad@python.org>
Use the standard `__ARM_ARCH` macro, which is supported by GCC and Clang.
The branching logic for of `__ARMEL__` has been removed so if the target
architecture supports v7+ instructions, a yield is emitted, otherwise a nop
is emitted. This covers both big and little endian scenarios.
(cherry picked from commit 03f6c8e239)
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Co-authored-by: Vincent Fazio <vfazio@gmail.com>
gh-131865: Properly apply exported CFLAGS for dtrace/systemtap builds (GH-131866)
When using --with-dtrace the resulting object file could be missing
specific CFLAGS exported by the build system due to the systemtap
script using specific defaults.
Exporting the CC and CFLAGS variables before the dtrace invocation
allows us to properly apply CFLAGS exported by the build system
even when cross-compiling.
The fix does not affect the dtrace invocation on Solaris/macOS.
(cherry picked from commit 0cd4befb02)
Co-authored-by: stratakis <cstratak@redhat.com>
gh-131936: Strengthen check in `_suggestions._generate_suggestions` (GH-131945)
(cherry picked from commit 511d3440a0)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
gh-126037: fix UAF in `xml.etree.ElementTree.Element.find*` when concurrent mutations happen (#127964)
We fix a use-after-free in the `find`, `findtext` and `findall` methods of `xml.etree.ElementTree.Element`
objects that can be triggered when the tag to find implements an `__eq__` method that mutates the
element being queried.
(cherry picked from commit c57623c221)
gh-129994: update docs when using `dualstack_ipv6` in `socket.create_server` (GH-129996)
(cherry picked from commit 044a1e13d5)
Co-authored-by: Alexander Ershov <150328014+AEErshov@users.noreply.github.com>
gh-131885: Document that `dict.setdefault` and `dict.get` take no keyword arguments (GH-128208)
(cherry picked from commit edfbd8c062)
Co-authored-by: Adam Dangoor <adamdangoor@gmail.com>
gh-127541: Update os.walk example (GH-127765)
Update os.walk example to be more modern, skip `__pycache__` dirs rather than `CVS` dirs.
(cherry picked from commit a5949986d6)
Co-authored-by: Totosuki <116938397+totosuki@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
gh-131807: fix ResourceWarning in test_ucn.py (GH-131808)
(cherry picked from commit adb67ed7e4)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-117174: Adapt `test_multiple_statements_fail_early` to new REPL behavior (follow-up gh-131065) (GH-131836)
Adapt test to new REPL behavior (follow-up gh-117174)
(cherry picked from commit a6cf8275f8)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
The bin tag is 3.0.16.1 because we rebuilt without uplink support to fix gh-131804.
This PR also prevents making calls that are now unsafe without uplink, and updates
the tests to property interpret these failures as unsupported.
gh-117174: Adapt test_multiple_statements_fail_early now that we have always source (GH-131065)
(cherry picked from commit 4192ce17ba)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
gh-118518: Minor improvements to perf docs (GH-130866)
Minor improvements to perf docs
(cherry picked from commit ecdf6b15b0)
Co-authored-by: stratakis <cstratak@redhat.com>
gh-128231: Use `runcode()` return value for failing early (GH-129488)
(cherry picked from commit 7ed3dc6392)
Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
gh-128446: Run Windows CI tests on each commit (GH-131702)
(cherry picked from commit 7d9442f0d5)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-131712: Build _suggestions extension on Windows (GH-131759)
Add a test checking that the '_suggestions' extension is available.
(cherry picked from commit 9ef9d687ff)
Co-authored-by: Victor Stinner <vstinner@python.org>