Commit graph

55176 commits

Author SHA1 Message Date
mpage
6b77af257c
gh-134889: Fix handling of a few opcodes when optimizing LOAD_FAST (#134958)
We were incorrectly handling a few opcodes that leave their operands on the stack. Treat all of these conservatively; assume that they always leave operands on the stack.
2025-06-04 16:07:58 -07:00
Terry Jan Reedy
0df15d0d4d
gh-129876: Update IDLE News3.txt to May 2025 (#135139) 2025-06-04 11:26:19 -04:00
Thomas Grainger
40c8be0008
gh-126483: disable warnings filters mutation in concurrent test (GH-132694)
The `test_ssl_in_multiple_threads` test failed because `test_check_hostname_idn()`
modified the global warnings filters via `warnings_helper.check_no_resource_warning()`.
Only check for warnings when the context aware warnings feature is enabled, which makes
the warnings filter context-local and thread-safe.
2025-06-04 09:00:25 -04:00
Daniel Hollas
bc00ce941e
gh-135074: Fix exception messages in test.support module (GH-135076) 2025-06-04 14:58:34 +02:00
Christian Veenhuis
8f778f7bb9
gh-135103: Remove an unused local variable in Lib/code.py (GH-135104)
remove unused local variable
2025-06-04 13:57:31 +09:00
tpburns
54ca55978e
gh-134248 test_getallocatedblocks pre-check to ignore immortalized strings (#134871)
When sanity checking against gettotalrefcount(), we exclude the blocks for
immortalized strings since their references are not tracked/reported. This
now matches refleak.py's book-keeping using the same functions.
2025-06-03 18:00:25 +02:00
Łukasz Langa
3612d8f517
gh-135034: Normalize link targets in tarfile, add os.path.realpath(strict='allow_missing') (#135037)
Addresses CVEs 2024-12718, 2025-4138, 2025-4330, and 2025-4517.

Signed-off-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-03 12:42:11 +02:00
Roei Ben Artzi
ec12559eba
gh-131884: Fix incorrect formatting in json.dumps() when using indent and skipkeys=True (GH-132200) 2025-06-03 10:40:25 +03:00
Victor Stinner
6e80f11eb5
gh-135028: Increase parser MAXSTACK for nested parenthesis (#135031) 2025-06-03 08:40:45 +02:00
Serhiy Storchaka
df98a47a61
gh-132813: Improve error messages for incorrect types and values of csv.Dialog attributes (GH-133241)
Make them similar to PyArg_Parse error messages, mention None as
a possible value, show a wrong type and the string length.
2025-06-02 23:35:41 +03:00
Serhiy Storchaka
7a79f52d83
gh-133454: Mark test_queue tests with many threads as bigmem (gh-134575)
50 producer and 50 consumer threads need more than 5GB of memory.
2025-06-02 23:25:32 +03:00
Serhiy Storchaka
0cec424af5
gh-66234: Add flag to disable the use of mmap in dbm.gnu (GH-135005)
This may harm performance, but improve crash tolerance.
2025-06-02 21:08:26 +03:00
Duane Griffin
44fb7c361c
gh-134908: Protect textiowrapper_iternext with critical section (gh-134910)
The `textiowrapper_iternext` function called `_textiowrapper_writeflush`, but did not
use a critical section, making it racy in free-threaded builds.
2025-06-02 17:22:41 +00:00
Łukasz Langa
055827528f
gh-130999: Fix globals() poisoning in test_traceback (gh-135030) 2025-06-02 16:57:08 +02:00
Pieter Eendebak
26a1cd4e8c
gh-123471: make concurrent iteration over itertools.cycle safe under free-threading (#131212)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-06-02 20:13:32 +05:30
Duane Griffin
b6237c3602
gh-117852: fix argument checking of async_generator.athrow (#134868)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-06-02 20:04:26 +05:30
Sergey B Kirpichev
9c72658e49
gh-130662: Accept leading zeros in precision/width for Decimal's formatting (#132549)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-02 15:30:52 +02:00
Sergey B Kirpichev
5bc2d99126
gh-130662: Accept leading zeros in precision/width for Fraction's formatting (#130663)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-02 15:28:20 +02:00
devdanzin
baccfdb3d4
gh-130999: Avoid exiting the new REPL when there are non-string candidates for suggestions (gh-131001) 2025-06-02 13:04:59 +02:00
Sergey B Kirpichev
5f61cde80a
gh-132908: Add math.isnormal/issubnormal() functions (GH132935) 2025-06-02 13:38:05 +03:00
Bénédikt Tran
ee65ebdb50
gh-134978: deprecate string keyword parameter for hash function constructors (#134979) 2025-06-02 10:25:50 +02:00
Andrea-Oliveri
f806463e16
gh-134004: Added the reorganize() methods to dbm.sqlite, dbm.dumb and shelve (GH-134028)
They are similar to the same named method in dbm.gnu.
2025-06-01 15:30:04 +03:00
Serhiy Storchaka
b595237166
gh-132983: Minor fixes and clean up for the _zstd module (GH-134930) 2025-06-01 11:22:15 +03:00
Michał Górny
965c480566
gh-134970: Fix exception message in argparse module (GH-134971)
Fix the "unknown action" exception in argparse.ArgumentParser.add_argument_group()
to correctly replace the action class.
2025-06-01 08:56:56 +03:00
Itamar Oren
f58873e4b2
gh-134954: Hard-cap max file descriptors in subprocess test fd_status (#134955)
* Hard-cap max file descriptors in subprocess test fd_status

On some systems, `SC_OPEN_MAX` may return a very large value (i.e. 10**30), leading to the subprocess test timing out (or run forever).
Prevent this situation by applying a hard cap on how many file descriptors are checked.

* Fix typo in usage docstring

s/fd_stats/fd_status/
2025-05-31 07:29:03 -07:00
CF Bolz-Tereick
895119ec24
skip test for sys._stdlib_dir if that is not present (#134973) 2025-05-31 13:46:22 +02:00
CF Bolz-Tereick
af0d3268d9
Skip test as cpython_only that checks whether setattr interns the attribute or not (#134972)
Skip test that checks whether setattr interns the attribute or not

The details of when a string is being interned or not is implementation
dependent.
2025-05-31 13:38:05 +02:00
Bénédikt Tran
379d0bc956
gh-134696: fix hashlib tests for FIPS-only BLAKE-2 buildbot (#134968) 2025-05-31 12:48:34 +02:00
Serhiy Storchaka
ad39f01788
gh-108885: Use subtests for doctest examples run by unittest (GH-134890)
Run each example as a subtest in unit tests synthesized by
doctest.DocFileSuite() and doctest.DocTestSuite().

Add the doctest.DocTestRunner.report_skip() method.
2025-05-31 13:01:46 +03:00
Serhiy Storchaka
68784fed78
gh-133489: Remove size restrictions on getrandbits() and randbytes() (GH-133658)
random.getrandbits() can now generate more that 2**31 bits.
random.randbytes() can now generate more that 256 MiB.
2025-05-31 11:23:01 +03:00
Bénédikt Tran
c6e63d9d35
gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (#134713)
OpenSSL and HACL*-based hash functions constructors now support both `data` and `string` parameters.
Previously these constructor functions inconsistently supported sometimes `data` and sometimes `string`,
while the documentation expected `data` to be given in all cases.
2025-05-31 09:37:47 +02:00
Serhiy Storchaka
4d31d19a1d
gh-134718: Omit optional Load() values in ast.dump() (GH-134934) 2025-05-31 10:32:53 +03:00
László Kiss Kollár
8e8786f898
gh-91048: Reorder result tuple of parse_code_object (#134898)
Reorder result tuple of parse_code_object

The standard followed by APIs like pstat.Stats is to take a file, line,
function triplet. The parse_code_object function (and callers exposing
this in Python like RemoteUnwinder.get_stack_trace) return function,
file, line triplets which requires the caller to reorder these when
using it in classes like pstat.Stats.
2025-05-31 00:32:36 +00:00
Eric Snow
52deabefd0
gh-132775: Expand the Capability of Interpreter.call() (gh-133484)
It now supports most callables, full args, and return values.
2025-05-30 09:15:00 -06:00
Serhiy Storchaka
cc344e8dd0
gh-134718: Fix ast.dump() for empty non-default values (GH-134926) 2025-05-30 17:25:07 +03:00
Mark Shannon
ce6a6371a2
GH-134879: Fix INSTRUMENT_FOR_ITER for list/tuple (#134897)
Fix INSTRUMENT_FOR_ITER for list/tuple
2025-05-30 07:11:42 -07:00
Victor Stinner
ebf6d13567
gh-134745: Change PyThread_allocate_lock() implementation to PyMutex (#134747)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-05-30 10:15:47 +00:00
Serhiy Storchaka
cb8a72b301
gh-134857: Improve error report for doctests run with unittest (GH-134858)
Remove doctest module frames from tracebacks and redundant newline
character from a failure message.
2025-05-30 00:32:44 +03:00
Victor Stinner
f49a07b531
gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973)
Replace most PyUnicodeWriter_WriteUTF8() calls with
PyUnicodeWriter_WriteASCII().

Unrelated change to please the linter: remove an unused
import in test_ctypes.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-29 14:54:30 +00:00
Bénédikt Tran
cafbcd666a
gh-133866: remove deprecated and undocumented function ctypes.SetPointerType (GH-133869) 2025-05-29 15:28:57 +02:00
Mark Shannon
9fbd66a93d
GH-133912: Fix PyObject_GenericSetDict to handle inline values (GH-134725) 2025-05-28 19:03:41 +01:00
Serhiy Storchaka
f6324bc7ee
gh-108885: Imporove tests for doctest (GH-134832)
Test the error and failure report in more detail.
2025-05-28 20:14:56 +03:00
Serhiy Storchaka
bac3fcba5b
gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035)
Add functions PySys_GetAttr(), PySys_GetAttrString(),
PySys_GetOptionalAttr() and PySys_GetOptionalAttrString().
2025-05-28 20:11:09 +03:00
Victor Stinner
4635115c3f
gh-133711: Fix test_readline.test_nonascii() for UTF-8 Mode (#134841)
Skip the test if the Python UTF-8 Mode is enabled and the LC_CTYPE
encoding is not UTF-8.
2025-05-28 17:43:52 +02:00
Victor Stinner
d9ec0ee733
gh-133711: Log Windows OEM code page in test.pythoninfo (#134840)
Add _winapi.GetOEMCP() function.
2025-05-28 17:41:11 +02:00
Serhiy Storchaka
d83576bf48
gh-128840: Fix parsing long IPv6 addresses with embedded IPv4 address (#134836) 2025-05-28 08:24:24 -07:00
Victor Stinner
91618278e7
gh-133711: Fix test_regrtest for PYTHONUTF8=1 (#134839)
Use "backslashreplace" error handler to decode stdout and stderr.
Example:

    vstinner@WIN C:\victor\python\main\build\test_python_worker_8360\x91>
    "C:\victor\python\main\PCbuild\amd64\python_d.exe"  -m test
    --fast-ci --slow-ci --testdir
    C:\Users\vstinner\AppData\Local\Temp\tmp0t59e8da
    test_regrtest_noop1 test_regrtest_noop2 test_regrtest_noop3
    test_regrtest_noop4

Notice the "\x91" byte at the end of the first line: it's the
non-ASCII U+00E6 character encoded to the OEM cp437 code page.
2025-05-28 17:19:50 +02:00
Adam Turner
11f7a939de
gh-132983: Split `_zstd_set_c_parameters` (#133921) 2025-05-28 14:45:08 +00:00
Neil Schemenauer
fbbbc10055
gh-127266: avoid data races when updating type slots (gh-133177)
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.
2025-05-27 18:27:41 -07:00
Wulian233
7ca6d79fa3
gh-134580: Modernizing difflib.HtmlDiff for HTML Output (#134581)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-28 03:46:41 +03:00