Commit graph

126221 commits

Author SHA1 Message Date
Kumar Aditya
39b37b0110
gh-128421: add critical section around traceback.tb_next (#131322) 2025-03-20 12:03:54 +05:30
Kumar Aditya
b12af0a48f
gh-131401: fix data races in exception handling (#131447) 2025-03-20 12:02:05 +05:30
Barney Gale
f141e8ec2a
GH-123599: Deprecate duplicate pathname2url() implementation (#127380)
Call `urllib.request.pathname2url()` from `pathlib.Path.as_uri()`, and
deprecate the duplicate implementation in `PurePath`.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-20 00:54:36 +00:00
Victor Stinner
6c776abb90
gh-131238: Cleanup pycore_runtime.h includes (#131486) 2025-03-20 00:47:30 +00:00
Victor Stinner
344f3c3fd4
gh-131238: Remove pycore_lock.h includes (#131483)
PyMutex type is now part of <Python.h>, it's no longer needed to
include <pycore_lock.h> to get it.
2025-03-19 23:46:25 +00:00
Victor Stinner
6827c5129c
gh-131238: Move pycore_obmalloc.h include to pycore_runtime_structs.h (#131482)
Move pycore_obmalloc.h include from pycore_interp_structs.h to
pycore_runtime_structs.h.

Add also comment explaining the purpose of each include in
pycore_interp_structs.h, pycore_runtime_structs.h and
pycore_structs.h.

Remove <stdbool.h> and <stddef.h> from pycore_structs.h.
2025-03-19 23:32:30 +00:00
Victor Stinner
a7411025c5
gh-131238: Use pycore_interp_structs.h header (#131481)
Replace pycore_runtime_structs.h include with pycore_interp_structs.h
include in internal headers.
2025-03-19 23:13:25 +00:00
Tomasz Pytel
a8cb5e4a43
gh-129598: ast: allow multi stmts for ast single with ';' (#129620) 2025-03-19 15:29:40 -07:00
Victor Stinner
20c5f969dd
gh-131238: Remove more includes from pycore_interp.h (#131480) 2025-03-19 23:01:32 +01:00
Barney Gale
63b5aed06e
GH-123599: Remove duplicate url2pathname() implementation (#127237)
Call `urllib.request.url2pathname()` from `pathlib.Path.from_uri()` rather
than re-implementing it. This paves the way for solving the main issue
(ignoring local authorities and rejecting non-local ones) in urllib, not
pathlib.
2025-03-19 21:08:32 +00:00
Yan Yanchii
75103d975c
gh-126835: Move constant tuple folding from ast_opt to CFG (#130769) 2025-03-19 20:59:55 +00:00
Chris Eibl
54efe296bc
GH-131473: Add missing %(AdditionalOptions) reference to pythoncore.vcxproj (GH-131475) 2025-03-19 19:50:04 +00:00
Barney Gale
8abfaba5a6
GH-125866: Deprecate nturl2path module (#131432)
Deprecate the `nturl2path` module. Its functionality is merged into
`urllib.request`.

Add `tests.test_nturl2path` to exercise `nturl2path`, as it's no longer
covered by `test_urllib`.
2025-03-19 19:33:01 +00:00
Diego Russo
8a33034d82
GH-130956: Only emit AArch64 trampolines for long jumps (GH-131041) 2025-03-19 12:19:21 -07:00
Steve Dower
63a638c43f
gh-91349: Replace zlib with zlib-ng in Windows build (GH-131438) 2025-03-19 19:03:25 +00:00
Adam Turner
c1a02f9101
GH-121970: Extract pydoc_topics into a new extension (#131256) 2025-03-19 18:35:11 +00:00
Victor Stinner
22706843e0
gh-131238: Remove many includes from pycore_interp.h (#131472) 2025-03-19 17:46:24 +00:00
Cody Maloney
a4832f6b9a
gh-131117: Update tp_finalize example to use PyErr_GetRaisedException (#131118)
The tp_finalize C API doc used PyErr_Fetch() and PyErr_Restore() in
its example code. That API was deprecated in 3.12.

Update to point to the suggested replacement function
PyErr_GetRaisedException() which has a sample usage.
2025-03-19 18:27:55 +01:00
Victor Stinner
5c44d7d99c
gh-130931: Add pycore_interpframe.h internal header (#131249)
Move _PyInterpreterFrame and associated functions
to a new pycore_interpframe.h header.
2025-03-19 18:17:44 +01:00
R. David Murray
6146295a5b
gh-90548: Make musl test skips smarter (fixes Alpine errors) (#131313)
* Make musl test skips smarter (fixes Alpine errors)

A relatively small number of tests fail when the underlying c library is
provided by musl.  This was originally reported in bpo-46390 by
Christian Heimes.  Among other changes, these tests were marked for
skipping in gh-31947/ef1327e3 as part of bpo-40280 (emscripten support),
but the skips were conditioned on the *platform* being emscripten (or
wasi, skips for which ere added in 9b50585e02).

In gh-131071 Victor Stinner added a linked_to_musl function to enable
skipping a test in test_math that fails under musl, like it does on a
number of other platforms.  This check can successfully detect that
python is running under musl on Alpine, which was the original problem
report in bpo-46390.

This PR replaces Victor's solution with an enhancement to
platform.libc_ver that does the check more cheaply, and also gets the
version number.  The latter is important because the math test being
skipped is due to a bug in musl that has been fixed, but as of this
checkin date has not yet been released.  When it is, the test skip can
be fixed to check for the minimum needed version.

The enhanced version of linked_to_musl is also used to do the skips of
the other tests that generically fail under musl, as opposed to
emscripten or wasi only failures.  This will allow these tests to be
skipped automatically on Alpine.

This PR does *not* enhance libc_ver to support emscripten and wasi, as
I'm not familiar with those platforms; instead it returns a version
triple of (0, 0, 0) for those platforms.  This means the musl tests will
be skipped regardless of musl version, so ideally someone will add
support to libc_ver for these platforms.

* Platform tests and bug fixes.

In adding tests for the new platform code I found a bug in the old code:
if a valid version is passed for version and it is greater than the
version found for an so *and* there is no glibc version, then the
version from the argument was returned.  The code changes here fix
that.

* Add support docs, including for some preexisting is_xxx's.

* Add news item about libc_ver enhancement.

* Prettify platform re expression using re.VERBOSE.
2025-03-19 13:05:09 -04:00
Victor Stinner
4b54031323
gh-131238: Remove pycore_runtime.h from pycore_pystate.h (#131356)
* Remove includes from pycore_pystate.h:

  * pycore_runtime_structs.h
  * pycore_runtime.h
  * pycore_tstate.h
  * pycore_interp.h

* Reorganize internal headers. Move _gc_thread_state from
  pycore_interp_structs.h to pycore_tstate.h.
* Add 3 new header files to PCbuild/pythoncore.vcxproj.
2025-03-19 17:33:24 +01:00
Victor Stinner
0a54bd6dd7
gh-111178: Fix function signatures in legacy_tracing.c (#131464) 2025-03-19 16:54:41 +01:00
Victor Stinner
6935d96e9c
gh-111178: Fix function signatures in _testbuffer.c (#131463) 2025-03-19 16:54:18 +01:00
Petr Viktorin
4bced29a74
gh-130587: Add hand-written docs for non-OP tokens (GH-130588)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-03-19 16:42:11 +01:00
Victor Stinner
b8367e7cf3
gh-130931: Add pycore_typedefs.h internal header (#131396)
Declare _PyInterpreterFrame and _PyRuntimeState types before
declaring their structure members. Break reference cycles between
header files.
2025-03-19 15:23:32 +01:00
Yuki Kobayashi
a0478c9f0c
Docs: Fix documentation for "PyTypeObject Definition" (GH-130936)
The structure definition for `PyTypeObject` is in `Include/cpython/object.h`,
not in `Include/object.h`.
2025-03-19 14:46:32 +01:00
Victor Stinner
bbe5baad6c
gh-111178: Fix function signatures for test_types (#131455) 2025-03-19 13:46:17 +00:00
Victor Stinner
f5e4c2955b
gh-111178: Fix function signatures for test_iter (#131456) 2025-03-19 14:42:51 +01:00
Furkan Onder
8ad4646c67
gh-131263: Skip test_timerfd_negative on NetBSD to prevent system freeze (#131431) 2025-03-19 11:24:09 +00:00
Stan Ulbrych
3118693a1a
gh-130655: Add tests for gettext.find() (GH-130691)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-03-19 11:52:03 +01:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
7558980a18
GH-131358: Add encoding alias cseuckr for euc_kr (#131370)
* Add encoding alias cseuckr for euc_kr

* Update Misc/NEWS.d/next/Library/2025-03-17-21-35-53.gh-issue-131358.YVZ6yo.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-19 18:29:20 +09:00
Kumar Aditya
74b87515a7
gh-131401: fix data race in _PyErr_Restore (#131406) 2025-03-19 14:35:47 +05:30
Andrew Svetlov
61b4b2c57c
gh-131417: Mention asyncio Future and Task in docs for generic classes list (#131422)
Mention asyncio Future and Task in docs for generic classes list
2025-03-19 10:05:23 +01:00
partev
267c06d6a8
Docs: fix shell command formatting (#131310)
replace "zypper in" with "zypper install" to avoid incorrect highlighting
2025-03-19 09:42:47 +02:00
Russell Keith-Magee
b754aeedfb
gh-121468: Ensure PDB cleans up event loop policies after using asyncio. (#131388)
Adds teardown logic, plus a change to asyncio.run usage, to avoid warnings when
running the test suite single process.
2025-03-19 08:33:31 +08:00
Barney Gale
d783d7b51d
GH-126367: url2pathname(): handle NTFS alternate data streams (#131428)
Adjust `url2pathname()` to decode embedded colon characters in Windows
URIs, rather than bailing out with an `OSError`.
2025-03-18 23:37:12 +00:00
Malcolm Smith
01b5abbc53
gh-124666: Improve thread cleanup in test_android (#131427)
Ensures that failures in test setup don't result in dangling threads.
2025-03-19 06:30:22 +08:00
Daniel Pope
c1b42db9e4
gh-130914: Make graphlib.TopologicalSorter.prepare() idempotent (#131317)
Closes #130914: Make graphlib.TopologicalSorter.prepare() idempotent

Relax the rules so that `.prepare()` can be called multiple times, provided that no work has been passed out by `.get_ready()` yet.
2025-03-18 16:28:00 -05:00
Yuki Kobayashi
f819900245
gh-118915: Document PY_MONITORING_IS_INSTRUMENTED_EVENT (GH-128026) 2025-03-18 17:34:01 +01:00
Max Bachmann
49234c065c
gh-114917: Fix typo in getaddrinfo emulation (#131413) 2025-03-18 14:31:13 +01:00
Bénédikt Tran
8cb57dc367
gh-131402: add HMAC-SHA3 NIST test cases (#131407)
Add NIST [1] tests for `HMAC-SHA-3/{224,256,384,512}`.

[1]: https://csrc.nist.gov/Projects/cryptographic-standards-and-guidelines/example-values
2025-03-18 13:57:15 +01:00
Irit Katriel
83479c2175
gh-130080: fix warnings in tests (#131400) 2025-03-18 12:33:46 +00:00
Petr Viktorin
51d309988b
gh-131261: expat/refresh.sh: Expand list of manual steps (GH-131359) 2025-03-18 13:17:43 +01:00
Mike Edmunds
295b53df2a
gh-121284: Fix email address header folding with parsed encoded-word (GH-122754)
Email generators using email.policy.default may convert an RFC 2047
encoded-word to unencoded form during header refolding. In a structured
header, this could allow 'specials' chars outside a quoted-string,
leading to invalid address headers and enabling spoofing. This change
ensures a parsed encoded-word that contains specials is kept as an
encoded-word while the header is refolded.

[Better fix from @bitdancer.]

---------

Co-authored-by: R David Murray <rdmurray@bitdance.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-03-18 12:07:17 +01:00
Kumar Aditya
ab6333f7f5
gh-128002: fix tsan race in closing socket in test_sslproto (#131399) 2025-03-18 16:20:47 +05:30
Sergey Miryanov
812074e291
gh-131311: Consolidate reference handling in PyCStructUnionType_update_stginfo to fix memory leak (GH-131312) 2025-03-18 11:50:22 +01:00
Max Bachmann
3453b5c1d6
gh-114917: add support for AI_NUMERICSERV in getaddrinfo emulation (#114918) 2025-03-18 11:26:51 +01:00
Kumar Aditya
b0a4f6599a
gh-128002: fix tsan race in closing socket in test_ssl (#131397) 2025-03-18 15:41:43 +05:30
Kanishk Pachauri
77d2fd4413
gh-130132: properly free resources in urrlib.urlopen examples (#130280)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-18 09:27:05 +00:00
Guy Jacoby
3f50f96586
gh-131094: Refine math.isclose docs (#131139) 2025-03-18 10:13:26 +01:00