Commit graph

34551 commits

Author SHA1 Message Date
Nick Burns
d7dbde8958
gh-92936: allow double quote in cookie values (#113663)
* allow double quote in cookie values
* Update Lib/test/test_http_cookies.py

Co-authored-by: Senthil Kumaran <senthil@python.org>
2025-08-08 12:07:15 -07:00
Douglas Thor
34d7351ac7
gh-133722: Add Difflib theme to _colorize and 'color' option to difflib.unified_diff (#133725) 2025-08-08 18:34:02 +03:00
Sergey Miryanov
25518f51dc
GH-135552: Add tests to check weakref clearing (GH-136304)
These are tests to ensure behaviour introduced by GH-136189 is working as expected.

Co-authored-by: Mikhail Borisov <43937008+fxeqxmulfx@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2025-08-07 17:45:33 -07:00
Neil Schemenauer
350c58ba4e
GH-135552: Make the GC clear weakrefs later (GH-136189)
Fix a bug caused by the garbage collector clearing weakrefs too early.  The
weakrefs in the ``tp_subclasses`` dictionary are needed in order to correctly
invalidate type caches (for example, by calling ``PyType_Modified()``).
Clearing weakrefs before calling finalizers causes the caches to not be
correctly invalidated.  That can cause crashes since the caches can refer to
invalid objects.  Defer the clearing of weakrefs without callbacks until after
finalizers are executed.
2025-08-07 16:32:17 -07:00
Bénédikt Tran
deb385a143
gh-137412: fix default_builtin_hashes values in test_hashlib.py (#137413)
fix `default_builtin_hashes` in test_hashlib
2025-08-07 15:31:56 -07:00
Dino Viehland
375f484f97
gh-137291: Support perf profiler with an evaluation hook (#137292)
Support perf profiler with an evaluation hook
2025-08-07 14:54:12 -07:00
Serhiy Storchaka
baefaa6cba
gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338)
* Return large limit values as positive integers instead of negative integers
  in resource.getrlimit().
* Accept large values and reject negative values (except RLIM_INFINITY)
  for limits in resource.setrlimit().
2025-08-07 11:06:37 +03:00
Guilherme Leobas
5be872350d
gh-137463: Update validate_abstract_methods in test_collections.py (#137464)
Update `validate_abstract_methods` in `test_collections.py`

The test for missing abstract methods in `validate_abstract_methods` incorrectly attempted to instantiate the generated class `C` with an argument (`C(name)`), which always raises a `TypeError: C() takes no arguments`. Although the test originally passes, it passes for the wrong reason.

This change makes the test correctly validate the enforcement of abstract methods in ABCs.
2025-08-07 09:10:56 +03:00
Barney Gale
f0a3c6ebc9
GH-137466: Remove deprecated and undocumented glob.glob0() and glob1() (#137467) 2025-08-06 17:13:58 +01:00
Alexander Urieles
481d5b5455
gh-75989: TarFile.extractall and TarFile.extract now overwrite symlinks when extracting hardlinks (GH-137316) 2025-08-06 14:59:22 +02:00
Victor Stinner
ce1b747ff6
gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (#137415)
Fix name of the Python encoding in Unicode errors of the code page
codec: use "cp65000" and "cp65001" instead of "CP_UTF7" and "CP_UTF8"
which are not valid Python code names.
2025-08-06 14:35:27 +02:00
Irit Katriel
1f2026b8a2
gh-137288: Fix bug where boolean expressions are not associated with the correct exception handler (#137310) 2025-08-05 19:25:57 +01:00
naweiss
a50822ff94
gh-107545: Fix misleading setsockopt() error messages (GH-107546) 2025-08-05 10:16:14 +00:00
Furkan Onder
7f416c8674
gh-137397: Skip test_os_open on NetBSD due to indefinite hang (#137398) 2025-08-05 10:32:21 +02:00
Bénédikt Tran
0af7556b94
gh-136306: fix test_ssl.ContextTests.test_set_groups on FIPS builds (#137405)
X25519 is not a valid curve if OpenSSL is built with FIPS mode,
and ignoring unknown groups in `SSL_CTX_set1_groups_list()`
is only supported since OpenSSL 3.3, so we use two curves that
are known to be FIPS-compliant, namely P-256 and P-384.
2025-08-05 07:50:34 +00:00
Victor Stinner
08ce7c6958
gh-129033: Remove dead code in test.support.has_no_debug_ranges() (#137379) 2025-08-04 16:48:24 +02:00
Peter Bierma
e8251dc0ae
gh-134170: Add colorization to unraisable exceptions (#134183)
Default implementation of sys.unraisablehook() now uses traceback._print_exception_bltin() to print exceptions with colorized text.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-04 14:35:00 +00:00
Alexander Urieles
3ec3d05345
gh-81325: Support path-like objects with streaming TarFile (#137188)
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-08-03 19:53:01 -07:00
Serhiy Storchaka
1612dcbafe
gh-137341: Remove more word duplications (GH-137342) 2025-08-03 19:41:12 +03:00
Pablo Galindo Salgado
0153d82a5a
gh-137314: Fix incorrect treatment of format specs in raw fstrings (#137328) 2025-08-03 17:10:51 +01:00
sobolevn
158b28dd19
gh-137191: Fix how type parameters are collected from Protocol and Generic bases with parameters (#137281) 2025-08-03 10:40:55 +03:00
sobolevn
b74f3bed51
gh-137308: Replace a single docstring with pass in -OO mode (#137318)
This is required so we would never have empty node bodies.
Refs #130087
2025-08-02 11:57:01 +00:00
Serhiy Storchaka
718e0c89ba
gh-137273: Fix debug assertion failure in locale.setlocale() on Windows (GH-137300)
It happened when there were at least 16 characters after dot in the
locale name.
2025-08-01 17:43:53 +03:00
Kumar Aditya
e99bc7fd44
gh-133467: fix data race in type_set_name (#137302)
Fix data race in `type_set_name` by assigning name under stop the world pause making it thread safe in free-threading.
2025-08-01 13:40:40 +00:00
Henry Schreiner
2a87af062b
gh-137282: Fix TypeError in tab completion and dir() of concurrent.futures (GH-137214)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-07-31 16:17:27 +00:00
Xuanteng Huang
d18f73ae13
gh-137200: support frame lineno setter with BRANCH_LEFT and BRANCH_RIGHT events (GH-137229) 2025-07-31 14:22:22 +01:00
Dzmitry Plashchynski
438cbd857a
gh-131146: Fix month names in a "standalone form" in calendar module (GH-131147)
The calendar module displays month names in some locales using the genitive case.
This is grammatically incorrect, as the nominative case should be used when the month
is named by itself. To address this issue, this change introduces new lists
`standalone_month_name` and `standalone_month_abbr` that contain month names in
the nominative case -- or more generally, in the form that should be used to
name the month itself, rather than form a date.

The module now uses the `%OB` format specifier to get month names in this form
where available.
2025-07-31 14:06:33 +02:00
Jeong, YunWon
0282eef880
gh-137194: Fix requires_debug_ranges when _testcpi doesn't exist (GH-137195) 2025-07-31 14:22:11 +03:00
Justin Bronder
e3ea861351
gh-135444: fix asyncio.DatagramTransport.sendto to account for datagram header size when data cannot be sent (#135445)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-30 23:41:28 +05:30
Serhiy Storchaka
9d3b53c47f
gh-71189: Support all-but-last mode in os.path.realpath() (GH-117562) 2025-07-30 10:19:19 +03:00
Neil Schemenauer
5236b0281b
GH-116738: document thread-safety of bisect (GH-136555) 2025-07-30 02:44:10 +00:00
Sam Gross
98d462cf4d
gh-137179: Fix flaky test_history_survive_crash test (gh-137180)
Kill the REPL subprocess once it prints the output from the command
immediately before the `time.sleep()`.
2025-07-29 14:25:50 -04:00
Ron Frederick
377b787618
gh-136306: Add support for getting and setting SSL groups (#136307)
Add support for getting and setting groups used for key agreement.

* `ssl.SSLSocket.group()` returns the name of the group used
  for the key agreement of the current session establishment.
  This feature requires Python to be built with OpenSSL 3.2 or later.

* `ssl.SSLContext.get_groups()` returns the list of names of groups
  that are compatible with the TLS version of the current context.
  This feature requires Python to be built with OpenSSL 3.5 or later.

* `ssl.SSLContext.set_groups()` sets the groups allowed for key agreement
  for sockets created with this context. This feature is always supported.
2025-07-28 19:33:31 +02:00
Alexander Urieles
7040aa54f1
gh-130577: tarfile now validates archives to ensure member offsets are non-negative (GH-137027)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-07-28 08:37:26 -07:00
Barney Gale
2bd4ff0700
GH-128520: pathlib ABCs: tweak protocol for virtual path strings (#134104)
Adjust `pathlib._os.vfspath()` so that it doesn't try `os.fsdecode()`. I
don't know that supporting `os.PathLike` arguments is a good idea, so
it's best to leave it out for now.
2025-07-27 12:47:15 +01:00
Barney Gale
10a925c86d
GH-137059: url2pathname(): fix support for drive letter in netloc (#137060)
Support file URLs like `file://c:/foo` in `urllib.request.url2pathname()`
on Windows. This restores behaviour from 3.13.
2025-07-27 11:44:41 +00:00
Pablo Galindo Salgado
a852c7bdd4
gh-131038: Use text=True in subprocesses in test_perf_profiler (#137117) 2025-07-26 18:01:51 +01:00
Bénédikt Tran
d658b9053b
gh-136912: fix handling of OverflowError in hmac.digest (#136917)
The OpenSSL and HACL* implementations of HMAC single-shot
digest computation reject keys whose length exceeds `INT_MAX`
and `UINT32_MAX` respectively. The OpenSSL implementation
also rejects messages whose length exceed `INT_MAX`.

Using such keys in `hmac.digest` previously raised an `OverflowError`
which was propagated to the caller. This commit mitigates this case by
making `hmac.digest` fall back to HMAC's pure Python implementation
which accepts arbitrary large keys or messages.

This change only affects the top-level entrypoint `hmac.digest`, leaving
`_hashopenssl.hmac_digest` and `_hmac.compute_digest` untouched.
2025-07-26 08:22:06 +00:00
Savannah Bailey
f7c380ef67
GH-132732: Use pure op machinery to optimize COMPARE_OP_INT/FLOAT/STR (#137062)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2025-07-25 19:02:04 -07:00
Peter Bierma
e047a35b23
gh-134698: Hold a lock when the thread state is detached in ssl (GH-134724)
Lock when the thread state is detached.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-07-25 08:16:05 -07:00
Tyler Kennedy
cb93b6fc5e
gh-130522: Fix unraisable TypeError in threading at interpreter shutdown (#131537)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-07-25 14:51:30 +00:00
Denis Laxalde
fece15d29f
gh-136914: Fix support of cached functions and properties in DocTest's lineno computation (GH-136930)
Previously, DocTest's lineno of functions and methods decorated with
functools.cache(), functools.lru_cache() and functools.cached_property()
was not properly returned (None was returned) because the
computation relied on inspect.isfunction() which does not consider the
decorated result as a function.

We now use the more generic inspect.isroutine(), as elsewhere
in doctest's logic.

Also, added a special case for functools.cached_property().
2025-07-25 12:46:12 +03:00
Zachary Ware
d5e75c0768
Exclude _testclinic_depr.c.h from c-analyzer (GH-137086)
_testclinic.c mocks out PY_VERSION_HEX to 3.8 before including
_testclinic_depr.c.h to avoid the errors the preprocessor would
otherwise throw due to the deprecation feature it is testing.

Also partially revert 74e2acddf6:
this restores Modules/_testclinic.c to match the same file in the 3.14
branch.
2025-07-24 15:50:01 -05:00
Jelle Zijlstra
6a285f94c6
Revert "gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (#136893)" (#137014)
This reverts commit 46cbdf967a.
2025-07-23 08:13:19 -07:00
Ani
aafb1435d8
Use test.support.is_wasm32 flag for is_emscripten or is_wasi for generic checks (GH-136815)
Co-authored-by: Brett Cannon <brett@python.org>
2025-07-22 12:50:13 -07:00
Nazım Can Altınova
a667800558
gh-136459: Add perf trampoline support for macOS (#136461) 2025-07-22 16:47:24 +01:00
Serhiy Storchaka
3a89dfe32b
Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (#136991) 2025-07-22 16:39:50 +03:00
Pablo Galindo Salgado
aafbdb5df5
gh-133742: Fix test_sysconfig and test_build_details for relocated directories (#136987) 2025-07-22 11:53:05 +00:00
Timon Viola
4d02f31cdd
gh-118350: Fix support of elements "textarea" and "title" in HTMLParser (#135310)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-07-22 13:27:13 +02:00
Hood Chatham
c933a6bb32
gh-124621: Emscripten: Support pyrepl in browser (GH-136931)
Basic support for pyrepl in Emscripten. Limitations:
* requires JSPI
* no signal handling implemented

As followup work, it would be nice to implement a webworker variant
for when JSPI is not available and proper signal handling.

Because it requires JSPI, it doesn't work in Safari. Firefox requires
setting an experimental flag. All the Chromiums have full support since
May. Until we make it work without JSPI, let's keep the original web_example
around.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-22 12:13:38 +02:00