127184 Commits

Author SHA1 Message Date
Eric Snow
ac06b534ee
gh-132775: Fix Recently Introduced Warnings (gh-134530) 2025-05-22 17:24:09 +00:00
Tomas R.
484e00379b
GH-131798: Optimize away isinstance calls in the JIT (GH-134369) 2025-05-22 12:52:47 -04:00
Duprat
fade146cfb
gh-134322: Fix repr(threading.RLock) (#134389)
Fix the `__repr__` value of `threading.RLock` from `_thread` module, when just created.
2025-05-22 16:46:57 +00:00
Eric Snow
4a4ac3ab4d
gh-132775: Make _PyXI_session Opaque (gh-134452)
This is mostly a refactor to clean things up a bit, most notably the "XI namespace" code.

Making the session opaque requires adding the following internal-only functions:

* _PyXI_NewSession()
* _PyXI_FreeSession()
* _PyXI_GetMainNamespace()
2025-05-22 10:14:04 -06:00
Brandt Bucher
ec736e7dae
GH-131798: Optimize cached class attributes and methods in the JIT (GH-134403) 2025-05-22 11:15:03 -04:00
Eric Snow
09e72cf091
gh-132775: Use _PyCode GetScriptXIData() (gh-134511) 2025-05-22 08:40:33 -06:00
Victor Stinner
899c7dc283
gh-133740: Fix locale.nl_langinfo(ALT_DIGITS) (#134468)
Set the LC_CTYPE locale to the LC_TIME locale even if
nl_langinfo(ALT_DIGITS) result is ASCII. The result is a list
separated by NUL characters and the code only checks the first list
item which can be ASCII whereas following items are non-ASCII.

Fix test__locale for the uk_UA locale on RHEL 7.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-05-22 16:05:07 +02:00
Nadeshiko Manju
8c5e5557c6
GH-131798: Turn _LOAD_SMALL_INT into _LOAD_CONST_INLINE_BORROW in the JIT (GH-134406) 2025-05-22 09:54:57 -04:00
Duprat
3effede97c
gh-134323: Fix the new threading.RLock.locked method (#134368)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-22 13:48:24 +00:00
Alex Kautz
bd4046f4f8
gh-134370: Added clarification on instance annotations (#134387)
Instances of classes cannot have annotations,
however sometimes they will erroneously have the
__annotations__ attribute
2025-05-22 06:46:29 -07:00
Eric Snow
d0eedfa10e
gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134440)
This change includes some semi-related refactoring of queues and channels.
2025-05-22 06:50:06 -06:00
Michał Górny
d706eb9e0f
gh-134455: Fix build-details.json to use the `c_api.headers` key (#134456)
Fix `build-details.json` generation to use the correct `c_api.headers`
key as defined in PEP 739, instead of `c_api.include`.

Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-05-22 11:28:35 +00:00
Duane Griffin
458e33018a
gh-127081: lock non-re-entrant *pwent calls in free-threading (#132748) 2025-05-22 15:52:02 +05:30
Serhiy Storchaka
2602d8ae98
gh-71339: Use new assertion methods in tests (GH-129046) 2025-05-22 13:17:22 +03:00
Hugo van Kemenade
bb244fd33d
Consistent sentence case in docs template files (#134412) 2025-05-22 12:51:02 +03:00
Mark Shannon
fbe7b87c06
GH-131688: Mark instructions and uops with DECREF_INPUTS as escaping. (GH-133501) 2025-05-22 09:54:35 +01:00
Mark Shannon
29f6dc6323
GH-133932: Tagged ints are heap safe (GH-134244) 2025-05-22 09:54:04 +01:00
Petr Viktorin
1f0a294e8c
Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO (GH-134141)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-05-22 09:36:37 +02:00
Sergey Miryanov
7309eb60c0
gh-131357: Add some extra tests for empty bytes and bytearray (#134458) 2025-05-22 09:01:46 +02:00
Kira
979d81a179
gh-134309: Add `github.actor` to the GitHub Actions concurrency key (#134310)
When inexperienced users create a PR from their default branch, all of the concurrency keys
collide as there is no namespacing. This becomes an issue at events with many new contributors,
where workflow runs are cancelled on other pull requests.
Disambiguate by adding the username of the relevant 'actor' to the concurrency key.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Sviatoslav Sydorenko <sviat@redhat.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-22 04:49:07 +01:00
Gregory P. Smith
296a66051e
gh-127840: Revert "gh-127840: pass flags and address from send_fds (GH-127841)" (#134482)
Revert "gh-127840: pass flags and address from send_fds (GH-127841)"

This reverts commit 518c95b5529ed3379b5a3065b09f71411efe72fb.
2025-05-22 03:38:44 +00:00
Mike Salvatore
f3fc0c16e0
gh-134062: Fix hash collisions in IPv4Network and IPv6Network (GH-134063)
gh-134062: Fix hash collisions in IPv4Network and IPv6Network
gh-134062: Add hash collision regression test
2025-05-21 19:48:10 -07:00
Marcin Bachry
518c95b552
gh-127840: pass flags and address from send_fds (GH-127841)
socket: pass flags and address from send_fds

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-21 19:38:01 -07:00
Yuichiro Tachibana (Tsuchiya)
b1b8962443
gh-127960 Fix the REPL to set the correct namespace by setting the correct __main__ module (gh-134275)
The `__main__` module imported in the `_pyrepl` module points to the `_pyrepl` module itself when the interpreter was launched without `-m` option and didn't execute a module,
while it's an unexpected behavior that `__main__` can be `_pyrepl` and relative imports such as `from . import *` works based on the `_pyrepl` module.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-22 02:18:00 +02:00
Eric Snow
a66bae8bb5
gh-132775: Use _PyFunction_VerifyStateless() and _PyCode_VerifyStateless() (gh-134439) 2025-05-21 14:16:55 -06:00
Emma Smith
fb68776591
gh-132983: Fix refleak in zstd dictionary functions (gh-134459) 2025-05-21 19:09:34 +00:00
Bénédikt Tran
1a07a01014
gh-132124: improve safety nets for creating AF_UNIX socket files (GH-134085)
* ensure that we can create AF_UNIX socket files
* emit a warning if system-wide temporary directory is used
2025-05-21 10:10:31 -07:00
Cody Maloney
e1f891414b
gh-80050: Update BufferedReader.read docs around non-blocking (GH-130653) 2025-05-21 16:06:40 +00:00
Emma Smith
c64a21454b
gh-132983: Refactor shared code in train_dict and finalize_dict (GH-134432)
Refactor shared code in train_dict and finalize_dict
2025-05-21 08:53:13 -07:00
Cody Maloney
0a68068bd2
gh-62184: Remove _pyio import of _io.FileIO (gh-134192)
This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
2025-05-21 17:29:18 +02:00
Cody Maloney
5b0e827521
gh-133982: Run unclosed file test on all io implementations (gh-134165)
Update `test_io` `_check_warn_on_dealloc` to use `self.` to dispatch to
different I/O implementations.

Update the `_pyio` implementation to match expected behavior, using the
same `_dealloc_warn` design as the C implementation uses to report the
topmost `__del__` object.

The FileIO one now matches all the others, so can use IOBase. There was
a missing check on closing (self._fd must be valid), add that check
2025-05-21 16:51:56 +02:00
Cody Maloney
06eaf4055c
gh-71253: Match _io exception in _pyio (gh-133985)
Test was only testing _io, expanded to cover _pyio.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-05-21 16:45:00 +02:00
Cody Maloney
84d5f8d799
gh-133982: Update test_bufio to use self.open (gh-133983) 2025-05-21 16:40:50 +02:00
Cody Maloney
b529b60fc2
gh-132246: Add special buffer methods to C API Type Object docs (gh-132247)
Two special methods, __buffer__ and __release_buffer__ were added to
Python 3.12 by PEP 688. The C API Type Object documentation for slots
includes `tp_as_buffer`, and sub-slots `bf_getbuffer`, `bf_releasebuffer`
but does not refer to the Python Data Model version of those. Add the
missing references.
2025-05-21 16:21:57 +02:00
Emma Smith
d862b6de1b
gh-132983: Add documentation for compression.zstd (GH-133911)
Add documentation for compression & compression.zstd.

🎉

---------

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Sumana Harihareswara <sh@changeset.nyc>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
2025-05-21 07:18:21 -07:00
Yash Vijay
4eacf3883d
gh-134026: Fix grammar description of for statement (GH-134034) 2025-05-21 16:09:28 +02:00
Petr Viktorin
c7364f79b2
gh-127833: lexical analysis: Improve section on Names (GH-131474)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-05-21 16:01:52 +02:00
Christian Harries
109f7597d2
gh-90871: fix connection backlog offset in asyncio (gh-134392)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-21 15:59:09 +02:00
Yuki Kobayashi
15a8b5b9bd
gh-110631: Fix some incorrect indents in the documentation (#129312) 2025-05-21 13:52:02 +00:00
Eric Snow
88f8102a8f
gh-132775: Support Fallbacks in _PyObject_GetXIData() (gh-133482)
It now supports a "full" fallback to _PyFunction_GetXIData() and then `_PyPickle_GetXIData()`.  There's also room for other fallback modes if that later makes sense.
2025-05-21 07:23:48 -06:00
Emma Smith
0c5a8b0b55
gh-134262: Add retries to generate_sbom.py (#134263)
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-05-21 16:14:36 +03:00
Peter Bierma
b8998fe2d8
gh-131185: Use a proper thread-local for cached thread states (gh-132510)
Switches over to a _Py_thread_local in place of autoTssKey, and also fixes a few other checks regarding PyGILState_Ensure after finalization.

Note that this doesn't fix concurrent use of PyGILState_Ensure with Py_Finalize; I'm pretty sure zapthreads doesn't work at all, and that needs to be fixed seperately.
2025-05-21 07:01:25 -06:00
sobolevn
dcfc91e4e5
Fix signature of _curses.assume_default_colors in the docs (#134409) 2025-05-21 15:56:34 +03:00
Noam Cohen
e6dde10a69
gh-132542: Only run test_native_id_after_fork if native_id is supported (GH-134408) 2025-05-21 14:10:57 +03:00
Sofia Toro
c740fe3bd0
gh-134360 Add processName attribute to logging.Formatter docstring (GH-134371) 2025-05-21 05:49:06 +01:00
Tim Hatch
1298511b41
gh-72680: Fix false positives when using zipfile.is_zipfile() (GH-134250)
bpo-28494: Improve zipfile.is_zipfile reliability

The zipfile.is_zipfile function would only search for the EndOfZipfile
section header. This failed to correctly identify non-zipfiles that
contained this header. Now the zipfile.is_zipfile function verifies
the first central directory entry.

Changes:
* Extended zipfile.is_zipfile to verify zipfile catalog
* Added tests to validate failure of binary non-zipfiles
* Reuse 'concat' handling for is_zipfile

Co-authored-by: John Jolly <john.jolly@gmail.com>
2025-05-20 18:32:41 -07:00
Pablo Galindo Salgado
d327159eb4
gh-91048: Fix error path result in _remote_debugging_module (#134347) 2025-05-20 19:54:09 -04:00
ivonastojanovic
6856a04d68
Add documentation for remote debugging with pdb (#134260)
* Mention remote debugging via -p PID in usage text

Adds a brief note to the pdb help summary about attaching to a running
process using the -p option, making the remote debugging feature
more visible.

* Mention remote debugging in pdb.rst
2025-05-20 19:50:49 -04:00
Brandt Bucher
2f0570caf4
GH-131798: Narrow types more aggressively in the JIT (GH-134373) 2025-05-20 18:09:51 -04:00
Nadeshiko Manju
e1c0c451a2
GH-131798: Narrow the return type of _GET_LEN to int (GH-133345) 2025-05-20 18:02:50 -04:00