Commit graph

33606 commits

Author SHA1 Message Date
sobolevn
0e21ed7c09
gh-133213: Add tests for string.templatelib.TemplateIter (#133215)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-30 22:38:25 +03:00
Eric Snow
94b4fcd806
gh-132775: Add _PyCode_GetVarCounts() (gh-133128)
This helper is useful in a variety of ways, including in demonstrating how the different counts relate to one another.

It will be used in a later change to help identify if a function is "stateless", meaning it doesn't have any free vars or globals.

Note that a majority of this change is tests.
2025-04-30 18:19:20 +00:00
sobolevn
b451516aa6
gh-133197: Improve error message for ft"" and bt"" cases (#133202) 2025-04-30 19:20:44 +03:00
sobolevn
f7264ddea0
gh-133211: Test that PEP750 types are final (#133212) 2025-04-30 18:03:19 +02:00
sobolevn
cc39b19f0f
gh-133167: Fix compilation process with --enable-optimizations and --without-docstrings (#133187) 2025-04-30 16:41:50 +03:00
Petr Viktorin
8b26b23a96
gh-87135: test_threading: Wait on thread, not an Event it sets (GH-133198)
When the event is set the thread might not be done yet.

This is a fix-up for commit 4ebbfcf30e
2025-04-30 15:14:24 +02:00
Matt Wozniski
5154d412a4
gh-131591: Add tests for _PdbClient (#132976) 2025-04-30 14:09:41 +01:00
sobolevn
b1f893875b
gh-133194: Add CHECK_VERSION to new PEP758 grammar (#133195) 2025-04-30 13:39:26 +03:00
Victor Stinner
0f23e84cda
gh-130317: Skip test_pack_unpack_roundtrip_for_nans() on x86 (#133155)
Reduce also the number of iterations from 1000 to 10 to ease
debugging failures and prevent "command line too line" error when
tests are re-run.
2025-04-30 12:01:06 +02:00
Lysandros Nikolaou
60202609a2
gh-132661: Implement PEP 750 (#132662)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Wingy <git@wingysam.xyz>
Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Paul Everitt <pauleveritt@me.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-30 11:46:41 +02:00
Shantanu
7e8b153fef
gh-116436: Improve error message when TypeError occurs during dict update (#116443) 2025-04-29 22:18:06 -07:00
Inada Naoki
4e294f6feb
gh-133036: Deprecate codecs.open (#133038)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-30 10:11:09 +09:00
Brandt Bucher
732d1b0241
Get rid of ERROR_IF's "label" parameter (GH-132654) 2025-04-29 17:21:53 -07:00
Serhiy Storchaka
c46635aa5a
gh-120220: Deprecate legacy methods for tracing variables in Tkinter (GH-120223)
They do not work with Tcl 9.0.
Use new methods added in Python 3.6.
2025-04-29 20:26:51 +03:00
Tian Gao
caee16f052
gh-121468: Support async breakpoint in pdb (#132576) 2025-04-29 12:28:24 -04:00
Serhiy Storchaka
4265854d96
gh-132987: Support __index__() in the socket module (GH-133093)
ntohl(), htonl(), if_indextoname(), getaddrinfo() now use __index__() if
available.

Also fix the Argument Clinic names for module-level functions (although
this does not affect the user).
2025-04-29 19:27:07 +03:00
Johannes Holmberg
698c6e3a0c
gh-132933: zipapp - apply the filter when creating the list of files to add (gh-132934) 2025-04-29 15:14:46 +01:00
Serhiy Storchaka
a64fdc7513
gh-132987: Support __index__() in the lzma module (GH-133099) 2025-04-29 14:14:33 +00:00
Serhiy Storchaka
0fb4c38c27
gh-132987: Support __index__() in the ssl.SSLContext.options setter (GH-133098) 2025-04-29 16:28:47 +03:00
Neil Schemenauer
eecafc3380
Revert gh-127266: avoid data races when updating type slots (gh-131174) (gh-133129)
This is triggering deadlocks in test_opcache.  See GH-133130 for stack trace.
2025-04-28 23:38:29 -07:00
Eric Snow
219d8d24b5
gh-87859: Track Code Object Local Kinds For Arguments (gh-132980)
Doing this was always the intention. I was finally motivated to find the time to do it.

See #87859 (comment).
2025-04-29 02:21:47 +00:00
Eric Snow
96a7fb93a8
gh-132775: Add _PyCode_ReturnsOnlyNone() (gh-132981)
The function indicates whether or not the function has a return statement.

This is used by a later change related treating some functions like scripts.
2025-04-28 20:12:52 -06:00
Eric Snow
bdd23c0bb9
gh-132775: Add _PyMarshal_GetXIData() (gh-133108)
Note that the bulk of this change is tests.
2025-04-28 17:23:46 -06:00
Neil Schemenauer
e414a2d81c
gh-127266: avoid data races when updating type slots (gh-131174)
In the free-threaded build, avoid data races caused by updating type slots
or type flags after the type was initially created.  For those (typically
rare) cases, use the stop-the-world mechanism.  Remove the use of atomics
when reading or writing type flags.  The use of atomics is not sufficient to
avoid races (since flags are sometimes read without a lock and without
atomics) and are no longer required.
2025-04-28 20:28:44 +00:00
Neil Schemenauer
22f0730d40
gh-122320: Limit dict key versions used by test_opcache. (gh-132961)
The `test_load_global_module()` test consumes a lot of dict key versions.
Skip the test if we have consumed half of the available versions that can be
used for the "load global" cache.
2025-04-28 12:54:55 -07:00
Barney Gale
336322b341
GH-128520: pathlib ABCs tests: use explicit text encoding (#133105)
Follow-up to fbffd70. Set `encoding='utf-8'` when reading and writing text
in the tests for the private pathlib ABCs, which allows the tests to run
with `-W error -X warn_default_encoding`
2025-04-28 20:18:56 +01:00
Serhiy Storchaka
25186c2472
gh-132742: Fix newly added tcflush() tests on Android (GH-133070) 2025-04-28 21:41:09 +03:00
Barney Gale
fbffd70328
GH-128520: pathlib ABCs: raise text encoding warnings at correct stack level (#133051)
Ensure that warnings about unspecified text encodings are emitted from
`ReadablePath.read_text()`, `WritablePath.write_text()` and `magic_open()`
with the correct stack level set.
2025-04-28 19:04:20 +01:00
Eric Snow
6f04325992
gh-132775: Cleanup Related to crossinterp.c Before Further Changes (gh-132974)
This change consists of adding tests and moving code around, with some renaming thrown in.
2025-04-28 11:55:15 -06:00
sobolevn
b739ec5ab7
gh-133054: Skip test_pyrepl tests when cannot use pyrepl is reported (#133055)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-28 19:09:28 +03:00
Jelle Zijlstra
58567cc18c
gh-132952: Speed up startup by importing _io instead of io (#132957) 2025-04-28 08:38:56 -07:00
Jelle Zijlstra
7f16f1bc11
typing, annotationlib: clean tests (#133087)
- Add @cpython_only decorator to lazy import tests
- Rename reference to SOURCE format
- Always two newlines between test case classes
- Merge two classes of ForwardRef tests
- Use get_annotations instead of annotationlib.get_annotations
- Format test_annotationlib with Black (not expecting that we'll keep this up
  but it's close to Black-formatted right now)
2025-04-28 08:38:11 -07:00
Hugo van Kemenade
4cec0b510b
gh-129965: Add more missing MIME types (#132845) 2025-04-28 15:30:35 +00:00
Hugo van Kemenade
ee9102a535
gh-75223: Deprecate undotted extensions in mimetypes.MimeTypes.add_type (#128638)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2025-04-28 14:23:57 +00:00
Petr Viktorin
4ebbfcf30e
gh-87135: Raise PythonFinalizationError when joining a blocked daemon thread (gh-130402)
If `Py_IsFinalizing()` is true, non-daemon threads (other than the current one)
are done, and daemon threads are prevented from running, so they
cannot finalize themselves and become done. Joining them (without timeout)
would block forever.

Raise PythonFinalizationError instead of hanging.

Raise even when a timeout is given, for consistency with trying to join your own thread.

See gh-123940 for a use case: calling `join()` from `__del__`. This is
ill-advised, but an exception should at least make it easier to diagnose.
2025-04-28 15:48:48 +02:00
Sergey B Kirpichev
6157135a8d
gh-130317: Fix PyFloat_Pack/Unpack[24] for NaN's with payload (#130452)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-28 15:23:26 +02:00
Jelle Zijlstra
922049b613
gh-130907: Treat all module-level annotations as conditional (#131550) 2025-04-28 06:10:28 -07:00
Sergey B Kirpichev
5bf0f3666e
gh-53032: support IEEE 754 contexts in the decimal module (#122003)
This was in C version from beginning, but available only
on conditional compilation (EXTRA_FUNCTIONALITY).  Current
patch adds function to create IEEE contexts to the
pure-python module as well.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-28 15:05:56 +02:00
Chris Eibl
11f457cf41
GH-114911: use time.perf_counter in Stopwatch (GH-131469)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-28 13:55:08 +02:00
Serhiy Storchaka
ed8e886f4f
gh-132742: Improve tests for fcntl.ioctl() (GH-132791)
* Use better tests for integer argument.
* Add also parallel tests for tcflush() and tcflow().
2025-04-28 10:42:40 +03:00
Bénédikt Tran
3695ba93d5
gh-132993: expose HASHLIB_GIL_MINSIZE to private extension modules (#132999) 2025-04-27 22:20:15 +00:00
Emma Smith
20be6ba61a
gh-132983: Introduce compression package and move _compression module (GH-133018)
* Introduces `compression` package for https://peps.python.org/pep-0784/

This commit introduces the `compression` package, specified in PEP 784
to re-export the `lzma`, `bz2`, `gzip`, and `zlib` modules. Introduction
of `compression.zstd` will be completed in a future commit once the
`_zstd` module is merged.

This commit also moves the `_compression` private module to
`compression._common._streams`.

* Re-exports existing module docstrings.
2025-04-27 14:41:30 -07:00
Mariusz Felisiak
28a2fd031e
gh-115032: Deprecate support for custom logging handlers with 'strm' argument. (GH-115314) 2025-04-27 22:18:14 +01:00
Gregory P. Smith
355ee1a429
[tests] fix test_fcntl issue when run in a ChromeOS linux runtime (GH-133053)
* [tests] test_fcntl fails when run in a ChromeOS linux runtime container.

It doesn't appear to support F_NOTIFY? Detect the lack of that and skip the test.
2025-04-27 13:28:23 -07:00
Sergey B Kirpichev
276252565c
gh-127495: Append to history file after every statement in PyREPL (GH-132294) 2025-04-27 15:32:37 +02:00
Wulian233
8b4fd24ca5
gh-128438: Use EnvironmentVarGuard in test_zoneinfo.py (#131870) 2025-04-27 13:29:37 +02:00
Bénédikt Tran
cc05e4b867
gh-91069: do not disable sha3 in test_hashlib under UBSan (#133001) 2025-04-27 11:51:00 +02:00
Tian Gao
4f18916c5c
gh-124703: Set return code to 1 when aborting process from pdb (#133013) 2025-04-26 18:43:23 -04:00
Stan Ulbrych
ee033d4555
gh-63882: Implement some test_minidom tests (#132879)
Co-authored-by: Julian Gindi <julian@gindi.io>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-26 23:03:48 +03:00
John
8d6d7386a3
gh-133016: Fix a reference to removed asyncio.futures.TimeoutError (#133019)
Just use the builtin `TimeoutError`, and remove the import of `futures`.
2025-04-26 18:57:08 +00:00