127176 Commits

Author SHA1 Message Date
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
Chris Eibl
e4fbfb1288
GH-130727: Avoid race condition in _wmimodule by copying shared data (GH-134313) 2025-05-20 22:21:25 +01:00
tigerding
aadda87b3d
gh-134209: use heap-allocated memory in _curses.window.{instr,getstr} (GH-134283)
* made curses buffer heap allocated instead of stack
* change docs to explicitly mention the max buffer size
* changing GetStr() function to behave similarly too
* Update Doc/library/curses.rst
* Update instr with proper return error handling
* Update Modules/_cursesmodule.c
* change to strlen and better memory safety
* change from const int to Py_ssize_t
* add mem allocation guard
* update versionchanged to mention it was an increase.
* explicitly use versionchanged 3.14 as that is its own branch now.

TESTED: `python -m test -u curses test_curses`

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-20 20:36:04 +00:00
Kevin Hernández
a3a3cf6d15
gh-134215: PyREPL: Do not show underscored modules by default during autocompletion (gh-134267)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 22:26:48 +02:00
Chris Patti
c91ad5da9d
gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 21:47:57 +02:00
devdanzin
c7f8e706e1
gh-90117: handle dict and mapping views in pprint (#30135)
* Teach pprint about dict views with PrettyPrinter._pprint_dict_view and ._pprint_dict_items_view.
* Use _private names for _dict_*_view attributes of PrettyPrinter.
* Use explicit 'items' keyword when calling _pprint_dict_view from _pprint_dict_items_view.
* 📜🤖 Added by blurb_it.
* Improve tests
* Add tests for collections.abc.[Keys|Items|Mapping|Values]View support in pprint.
* Add support for collections.abc.[Keys|Items|Mapping|Values]View in pprint.
* Split _pprint_dict_view into _pprint_abc_view, so pretty-printing normal dict views and ABC views is handled in two simple methods.
* Simplify redundant code.
* Add collections.abc views to some existing pprint tests.
* Test that views from collection.UserDict are correctly formatted by pprint.
* Handle recursive dict and ABC views.
* Test that subclasses of ABC views work in pprint.
* Test dict views coming from collections.Counter.
* Test ABC views coming from collections.ChainMap.
* Test odict views coming from collections.OrderedDict.
* Rename _pprint_abc_view to _pprint_mapping_abc_view.
* Add pprint test for mapping ABC views where ._mapping has a custom __repr__ and fix ChainMap test.
* When a mapping ABC view has a ._mapping that defines a custom __repr__, dispatch pretty-printing it by that __repr__.
* Add tests for ABC mapping views subclasses that don't replace __repr__, also handling those that delete ._mapping on instances.
* Simplify the pretty printing of ABC mapping views.
* Add a test for depth handling when pretty printing dict views.
* Fix checking whether the view type is a subclass of an items view, add a test.
* Move construction of the views __repr__ set out of _safe_repr.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-05-20 12:30:00 -07:00
Hood Chatham
91e6a58e2d
gh-127146: xfail more Emscripten stack overflows (#134358)
Adds some additional test xfails for Emscripten stack overflows. Also corrects a test skip for test_io.
2025-05-20 18:41:14 +00:00
Hood Chatham
3b7888bf3d
gh-106213: Shorten Emscripten wasm-gc trampoline by a little (#133984)
Using the if instruction results in slightly shorter trampoline code.
2025-05-20 14:22:49 -04:00
Alex Kautz
36eb711d2f
gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase (GH-134372)
Added a clarification that the underlying binary buffer of a TextIOBase can be a BufferedIOBase OR a RawIOBase
2025-05-20 18:18:58 +00:00