Commit graph

34376 commits

Author SHA1 Message Date
Dino Viehland
1c691ea756 Lazy imports grammar / AST changes 2025-10-02 13:22:53 -07:00
Victor Stinner
af01b46866
gh-139322: Remove redundant test_os.Win32ErrorTests (#139477)
test_os.OSErrorTests already covers the OSError class and is more
complete than Win32ErrorTests.
2025-10-02 20:46:25 +02:00
Victor Stinner
9bf69659e1
gh-55258: Reenable support test_get_original_stdout() (#139499) 2025-10-02 18:10:36 +02:00
Victor Stinner
ea4027e179
gh-139504: Catch BrokenPipeError in ssl test_client_sigalgs_mismatch() (#139505)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-02 18:08:29 +02:00
Victor Stinner
8797e1a8c3
gh-77476: Remove urllib HTTP test (#139502)
Remove test_sites_no_connection_close() which is skipped since 2018
(commit 36d56ea826).
2025-10-02 17:30:08 +02:00
Victor Stinner
6826ebf986
gh-89745: Remove test_embed.test_init_read_set() (#139500)
Since Python 3.11, it's no longer possible to call PyConfig_Read() to
get the path configuration, and then modify the path configuration.
2025-10-02 16:52:10 +02:00
Victor Stinner
c985822d86
gh-135329: Use longer timeout in pyrepl test_repl_eio() (#139503)
Replace hardcoded 5 seconds with support.SHORT_TIMEOUT.

Fix the following error on slow CI such as GitHub Action UBSan:

test test_pyrepl failed -- Traceback (most recent call last):
  File "Lib/test/test_pyrepl/test_unix_console.py", line 362, in test_repl_eio
    _, err = proc.communicate(timeout=5)  # sleep for pty to settle
             ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "Lib/subprocess.py", line 1219, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Lib/subprocess.py", line 2126, in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Lib/subprocess.py", line 1266, in _check_timeout
    raise TimeoutExpired(
    ...<2 lines>...
            stderr=b''.join(stderr_seq) if stderr_seq else None)
subprocess.TimeoutExpired: Command '[...]' timed out after 5 seconds
2025-10-02 16:44:02 +02:00
ivonastojanovic
75b1afe562
gh-135953: Add Gecko reporter to sampling profiler (#139364)
Signed-off-by: Pablo Galindo Salgado <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2025-10-01 21:18:54 +01:00
Victor Stinner
0158890005
gh-139322: Create test_os package (#139453)
* Move test_posix.py and test_os.py to Lib/test/test_os/.
* Split Windows specific test cases to a new test_windows.py file.
2025-10-01 16:42:45 +02:00
Nadeshiko Manju
f39dea3bae
gh-123828: Fix data race in _interpchannels._waiting_release (GH-124107) 2025-10-01 11:34:47 +00:00
Cody Maloney
ce23eeaa2b
gh-138013: Split BufferedIO tests from test_io.test_general (#139454)
The last remaining set of tests to split out that are focused on one
specific implementation portion (`bufferedio.c`).

test_io.test_general is now largely tests around `io.open` and module
properties (ex. pickling, class hierarchy, module members, etc).

This closes #138013.
2025-10-01 09:06:26 +02:00
Ken Jin
c86eb4d3ac
gh-139210: Fix use-after-free in xml.etree.ElementTree.iterparse() (GH-139211) 2025-09-30 20:50:50 +03:00
Cody Maloney
f752fde452
gh-138013: Split TextIO tests from test_io.test_general (#139173)
gh-138013: Split TextIO tests from test_general

These tests take 1.3 seconds on my dev machine, match fairly closely
with testing `textio.c` implementation only.
2025-09-30 17:37:15 +02:00
Serhiy Storchaka
b2f5ad0c6d
gh-63161: Add more tests for source encoding (#139440) 2025-09-30 12:20:17 +03:00
Bénédikt Tran
bc172ee830
gh-139283: correctly handle size limit in cursor.fetchmany() (#139296)
Passing a negative or zero size to `cursor.fetchmany()` made it fetch all rows
instead of none.

While this could be considered a security vulnerability, it was decided to treat
this issue as a regular bug as passing a non-sanitized *size* value in the first
place is not recommended.
2025-09-30 11:18:55 +02:00
AN Long
bd1ada6df3
gh-138092: Allow calling mmap.flush with offset only (#138093) 2025-09-30 11:08:50 +02:00
Serhiy Storchaka
1b8dcdacc7
gh-130567: Enable previously skipped locale tests on FreeBSD and macOS (GH-138652) 2025-09-29 17:32:38 +02:00
Hugo van Kemenade
872eafd2b0
gh-76007: Deprecate __version__ attribute (#138675)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-09-29 12:03:23 +03:00
Gordon Messmer
408154d64a
gh-78319: Fix implementation of IMAP APPEND UTF8 (GH-9436)
Make UTF8 support for the IMAP APPEND command RFC 6855 compliant.
2025-09-29 09:03:06 +03:00
Bénédikt Tran
3779f2b95e
gh-139393: fix _CALL_LEN JIT tests for tuples (#139394)
Fix a regression introduced in 7ce25edb8f
where `_PY_NSMALLPOSINTS` was changed from 257 to 1025.
2025-09-28 19:30:44 +02:00
yihong
e18dda96c9
gh-139374: colorize traceback when using timeit command-line interface (#139375)
---------

Signed-off-by: yihong0618 <zouzou0208@gmail.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: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-09-28 11:49:18 +00:00
Bénédikt Tran
666112376d
gh-90949: expose Expat API to tune exponential expansion protections (#139368)
Expose the XML Expat 2.7.2 APIs to tune protections against
"billion laughs" [1] attacks.

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetBillionLaughsAttackProtectionActivationThreshold(threshold)`, and
- `parser.SetBillionLaughsAttackProtectionMaximumAmplification(max_factor)`.

This completes the work in f04bea44c3,
and improves the existing related documentation.

[1]: https://en.wikipedia.org/wiki/Billion_laughs_attack
2025-09-28 08:27:04 +00:00
Tian Gao
8288f3693f
gh-139289: Lazy import rlcompleter to fix the refleak (#139305) 2025-09-26 22:17:02 +08:00
Bénédikt Tran
f04bea44c3
gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (#139234)
Expose the XML Expat 2.7.2 mitigation APIs to disallow use of
disproportional amounts of dynamic memory from within an Expat
parser (see CVE-2025-59375 for instance).

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetAllocTrackerActivationThreshold(threshold)`, and
- `parser.SetAllocTrackerMaximumAmplification(max_factor)`.
2025-09-26 14:13:56 +00:00
Raymond Hettinger
7909b30493
gh-138682: Add symmetric difference to Counter (gh-138766) 2025-09-26 00:04:49 -05:00
Pablo Galindo Salgado
bc7b511376
gh-138122: Allow to filter by thread in tachyon's flamegraph (#139216) 2025-09-25 15:34:57 +01:00
Jan-Eric Nitschke
2462807b70
gh-138772: Add tests for Turtle.dot() signature (GH-138773) 2025-09-25 16:46:12 +03:00
dgpb
7ce25edb8f
gh-133059: Increase the small positive integer cache to 1024 (GH-133160) 2025-09-24 17:05:30 -04:00
Tian Gao
c8624cd367
gh-138860: Lazy import rlcompleter in pdb to avoid deadlock in subprocess (#139185) 2025-09-24 11:46:05 +08:00
Serhiy Storchaka
1a2e00c97a
gh-67795: Accept any real numbers as timestamp and timeout (GH-139224)
Functions that take timestamp or timeout arguments now accept any
real numbers (such as Decimal and Fraction), not only integers or floats,
although this does not improve precision.
2025-09-23 21:31:42 +03:00
Dave Peck
6ec058a1f7
gh-138558: Improve handling of Template annotations in annotationlib (#139072) 2025-09-23 11:25:51 -07:00
Victor Stinner
e8382e55c5
gh-74857, PEP 538: Coerce POSIX locale to UTF-8 based locale (#139238) 2025-09-23 19:20:59 +02:00
Russell Keith-Magee
a79ce35c70
gh-136744: Remove a redundant test skip (#139267)
Remove a redundant test skip.
2025-09-23 16:56:14 +00:00
Peter Bierma
6b4e3fe9d4
gh-126016: Fix flaky test by allowing the SIGINT return code (GH-139219) 2025-09-23 16:09:19 +02:00
Victor Stinner
dd683f8f34
gh-139208: Fix regrtest --fast-ci --verbose (#139240)
Don't ignore the --verbose option anymore.
2025-09-23 16:09:01 +02:00
Mark Shannon
16eae6d90d
GH-137573: Add test to check that the margin used for overflow protection is larger than the stack space used by the interpreter (GH-137724) 2025-09-23 15:47:27 +02:00
Russell Keith-Magee
04c4628345
gh-136744: Remove unnecessary chmod from pydoc.apropos() test. (GH-136746)
Remove unnecessary chmod from pydoc.apropos() test.
2025-09-22 16:26:13 +02:00
Katie Gardner
e642a24b50
gh-95953: Add a css class to changed lines of difflib.HtmlDiff make_table (#139226) 2025-09-22 13:19:37 +00:00
Petr Viktorin
61e54e52ea
gh-136003: Close file descriptors in test (GH-139225)
This fixes file descriptor leaks introduced in GH-136004
2025-09-22 13:22:27 +02:00
Jason R. Coombs
a756a4b953
gh-138313: Suppress ResourceWarnings and restore skipped test (#138597) 2025-09-21 20:53:57 -04:00
Pablo Galindo Salgado
cb6fed0d7e
gh-138709: Supress stdout/stderr during test_sampling_profiler tests (#139212) 2025-09-21 18:39:07 +00:00
Pablo Galindo Salgado
9df477c0ce
gh-138709: Fix race condition in test_external_inspection (#139209)
Fix race condition in test_external_inspection thread status tests

The tests test_thread_status_detection and test_thread_status_gil_detection
had a race condition where the test could sample thread status between when
the sleeper thread sends its "ready" message and when it actually calls
time.sleep(). This caused intermittent test failures where the sleeper
thread would show as running (status=0) instead of idle (status=1 or 2).

The fix moves the thread status collection inside the retry loop and
specifically waits for the expected thread states before proceeding with
assertions. The retry loop now continues until:
- The sleeper thread shows as idle (status=1 for CPU mode, status=2 for GIL mode)
- The busy thread shows as running (status=0)
- Both thread IDs are found in the status collection

This ensures the test waits for threads to settle into their expected states
before making assertions, eliminating the race condition.
2025-09-21 18:32:03 +01:00
Serhiy Storchaka
20d5494c88
Revert "gh-66234: Add flag to disable the use of mmap in dbm.gnu (GH-135005)" (GH-136989)
This reverts commit 0cec424af5.
2025-09-20 11:01:44 +03:00
Cody Maloney
69c6b438e8
gh-138013: Split SignalsTest from test_io.test_general (#139079)
Increase parallelism by splitting out `SignalsTest` from test_general.
`SignalsTest` takes 24.2 seconds on my dev machine when fully enabled
making it the largest part of `test_io`. Code move done via copy/paste
then tweak imports.

After splitting `test_io.test_general` is down to 10.1 seconds on my dev
box with all parts enabled.
2025-09-19 18:21:50 +00:00
Pablo Galindo Salgado
67636f72d2
gh-138709: Implement CPU time profiling in profiling.sample (#138710) 2025-09-19 19:17:28 +01:00
Peter Bierma
d06113c7a7
gh-112729: Correctly fail when the process is out of memory during interpreter creation (GH-139164) 2025-09-19 10:41:09 -04:00
Lisa Roach
2fd43a1ffe
gh-138310: Adds sys.audit event for import_module (#138311)
* Updates sys.audit calls for imports to include import_module
* Adds unit tests for existing and new functionality
2025-09-19 06:21:42 -07:00
Serhiy Storchaka
7257b24140
gh-139076: Fix regression in pydoc not showing extension functions (GH-139077)
Fix a bug in the pydoc module that was hiding functions in a Python
module if they were implemented in an extension module and the module did
not have __all__.
2025-09-19 15:54:06 +03:00
Peter Bierma
9243a4b933
gh-126016: Remove bad assertion in PyThreadState_Clear (GH-139158)
In the _interpreters module, we use PyEval_EvalCode() to run Python code in another interpreter. However, when the process receives a KeyboardInterrupt, PyEval_EvalCode() will jump straight to finalization rather than returning. This prevents us from cleaning up and marking the thread as "not running main", which triggers an assertion in PyThreadState_Clear() on debug builds. Since everything else works as intended, remove that assertion.
2025-09-19 12:17:05 +00:00
Gordon P. Hemsley
e3d9bd6be3
gh-81148: Eliminate unnecessary check in _strptime when determining AM/PM (#13428)
* bpo-36967: Eliminate unnecessary check in _strptime when determining AM/PM

* Pauls suggestion to refactor test

* Fix test

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2025-09-19 10:23:12 +00:00