Commit graph

126246 commits

Author SHA1 Message Date
Semyon Moroz
37bc3865c8
gh-85162: Add HTTPSServer to http.server to serve files over HTTPS (#129607)
The `http.server` module now supports serving over HTTPS using the `http.server.HTTPSServer` class.
This functionality is also exposed by the command-line interface (`python -m http.server`) through the
`--tls-cert`, `--tls-key` and `--tls-password-file` options.
2025-04-05 08:49:48 +00:00
Yuki Kobayashi
99e9798d61
Docs: document plistlib.InvalidFileException (#132069) 2025-04-05 08:46:17 +00:00
Ageev Maxim
05557788f3
gh-131015: Add test for bytes formatting errors (#131881)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-05 10:30:16 +02:00
Prometheus3375
06a110f522
gh-131912: Improve description of grouping options in the format specification docs (#132030)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-05 10:28:50 +02:00
Jelle Zijlstra
ac14d4a23f
gh-129463, gh-128593: Simplify ForwardRef (#129465) 2025-04-05 04:36:34 +00:00
Adam Turner
231a50fa9a
gh-109599: Expose CapsuleType via the _types module (#131969) 2025-04-04 23:37:41 +01:00
Jelle Zijlstra
7473c600a5
gh-131933: Document UnionType/Union merger in What's New (#131941)
Co-authored-by: Alex Waygood
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-04 11:15:31 -07:00
Victorien
ac3a7bfecc
Fix typo in template_replace() test helper docstring (#132094) 2025-04-04 17:38:09 +00:00
Irit Katriel
68e72cf3a8
gh-100239: fix bug in comparison (#132093) 2025-04-04 18:09:49 +01:00
Bénédikt Tran
0a97427ee5
gh-99108: Implement HACL* HMAC (#130157)
A new extension module, `_hmac`, now exposes the HACL* HMAC (formally verified) implementation.

The HACL* implementation is used as a fallback implementation when the OpenSSL implementation of HMAC
is not available or disabled. For now, only named hash algorithms are recognized and SIMD support provided
by HACL* for the BLAKE2 hash functions is not yet used.
2025-04-04 19:04:00 +02:00
Mark Shannon
7099c75550
GH-131498: Cases generator: manage stacks automatically (GH-132074) 2025-04-04 17:59:36 +01:00
Jelle Zijlstra
305be5fb1a
gh-118761: Lazily import annotationlib in typing (#132060)
annotationlib is used quite a few times in typing.py, but I think the
usages are just rare enough that this makes sense.

The import would get triggered by:
- Using get_type_hints(), evaluate_forward_ref(), and similar introspection
  functions
- Using a string annotation anywhere that goes through _type_convert (e.g.,
  "Final['x']" will trigger an annotationlib import in order to access the
  ForwardRef class).
- Creating a TypedDict or NamedTuple (unless it's empty or PEP 563 is on).

Lots of programs will want to use typing without any of these, so the tradeoff
seems worth it.
2025-04-04 08:57:10 -07:00
Bénédikt Tran
04bc681e7c
gh-131938: Update exception message for Element.remove() when an element is not found (#131972)
The exception message for `xml.etree.ElementTree.Element.remove` when an element is not found
has been updated from "list.remove(x): x not in list" to "Element.remove(x): element not found".
2025-04-04 15:04:07 +00:00
Irit Katriel
df59226997
gh-100239: more refined specialisation stats for BINARY_OP/SUBSCR (#132068) 2025-04-04 15:33:31 +01:00
Vincent Fazio
72123063dd
gh-130115: fix thread identifiers for 32-bit musl (#130391)
CPython's pthread-based thread identifier relies on pthread_t being able
to be represented as an unsigned integer type.

This is true in most Linux libc implementations where it's defined as an
unsigned long, however musl typedefs it as a struct *.

If the pointer has the high bit set and is cast to PyThread_ident_t, the
resultant value can be sign-extended [0]. This can cause issues when
comparing against threading._MainThread's identifier. The main thread's
identifier value is retrieved via _get_main_thread_ident which is backed
by an unsigned long which truncates sign extended bits.

  >>> hex(threading.main_thread().ident)
  '0xb6f33f3c'
  >>> hex(threading.current_thread().ident)
  '0xffffffffb6f33f3c'

Work around this by conditionally compiling in some code for non-glibc
based Linux platforms that are at risk of sign-extension to return a
PyLong based on the main thread's unsigned long thread identifier if the
current thread is the main thread.

[0]: https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Arrays-and-pointers-implementation.html

---------

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
2025-04-04 16:31:37 +02:00
Serhiy Storchaka
345baa77ba
gh-132075: Fix possible use of sockaddr structures with uninitialized members (GH-132076)
Now all structure members are initialized with zeroes by default.
2025-04-04 17:09:58 +03:00
Jelle Zijlstra
255eb375a7
gh-118761: Defer import of functools in annotationlib (#132059) 2025-04-04 06:42:22 -07:00
Tomas R.
a126cefc17
gh-130655: Add a test for corrupt .mo files in gettext (#131911) 2025-04-04 13:26:59 +00:00
Tomas R.
16a6270aa6
gh-130655: Add a test for bad magic numbers in .mo files parsed by gettext (#131909) 2025-04-04 13:26:15 +00:00
Tomasz Pytel
891c61c1fa
gh-128632: fix segfault on nested __classdict__ type param (#128744) 2025-04-04 06:23:35 -07:00
Jelle Zijlstra
d1db43c139
gh-105499: Defer "import warnings" in typing (#132061)
A bunch of other warnings in typing.py were already deferred, but
I added a few non-lazy ones.
2025-04-04 06:19:42 -07:00
Chris Eibl
20098719df
GH-131288: Use _AddressOfReturnAddress for MSVC in pycore_ceval.h (gh-131289)
Use `_AddressOfReturnAddress` in `_Py_get_machine_stack_pointer` to silence MSVC warning in pycore_ceval.h for release builds.
2025-04-04 09:03:12 -04:00
Victor Stinner
37d47d4965
gh-125434: Display thread name in faulthandler (#132016) 2025-04-04 12:24:41 +00:00
Serhiy Storchaka
2ccd6aae4d
Add tests for Bluetooth RFCOMM, HCI and SCO (GH-132023) 2025-04-04 14:33:09 +03:00
Filipe Laíns 🇵🇸
6ab4acecf9
GH-131770: increase assumed WASI stack size to 131072 (wasi-sdk default) (#131844)
e9524a0980/libc-top-half/musl/src/internal/pthread_impl.h (L220)

Signed-off-by: Filipe Laíns <lains@riseup.net>
2025-04-04 09:34:02 +01:00
Diego Russo
0dbaeb94a8
Enable Windows on Arm GitHub runners (#131994) 2025-04-03 22:32:29 +02:00
Itamar Oren
b6c92ec419
gh-132038: Make perf version check in test_perf_profiler more robust (#132039)
Should work also if the version string includes a commit hash, like `perf version 6.12.9.g242e6068fd5c`
2025-04-03 18:37:08 +01:00
Jelle Zijlstra
5518c2ae09
gh-128661: Remove DeprecationWarning in evaluate_forward_ref (#128930)
It doesn't make sense to use a deprecation for evaluate_forward_ref,
as it is a new function in Python 3.14 and doesn't have compatibility
guarantees.

I considered making it throw an error if type_params it not passed and
there is no owner. However, I think this is too unfriendly for users. The
case where this param is really needed is fairly esoteric and I don't think
this case is worth the pain of forcing users to write "type_params=()".
2025-04-03 09:52:17 -07:00
Steve Dower
24decb05dd
gh-131423: Update OpenSSL build tag to 3.0.16.2 to fix ARM64 crash (GH-132051) 2025-04-03 17:35:21 +01:00
Pablo Galindo Salgado
943cc1431e
gh-131591: Implement PEP 768 (#131937)
Co-authored-by: Ivona Stojanovic <stojanovic.i@hotmail.com>
Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
2025-04-03 16:20:01 +01:00
Mark Shannon
275056a7fd
GH-131904: Fix Py_STACKREF_DEBUG build (GH-132022) 2025-04-03 09:40:37 +01:00
Adam Turner
b3e3cc054c
Remove deferred `typing import in annotationlib` (#132034) 2025-04-02 20:30:31 -07:00
Tian Gao
6bd9689426
gh-60115: Support frozen modules for linecache.getline() (#131638) 2025-04-02 19:50:01 -04:00
Jelle Zijlstra
06822bfbf6
gh-118761: Fix star-import of ast (#132025)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-04-02 18:15:05 +00:00
Victor Stinner
643dd5107c
gh-111178: Skip test_perf_profiler on function sanitizer (#132020)
Add 'function' parameter to check_sanitizer() of test.support.
2025-04-02 18:46:10 +02:00
Adam Turner
f20f02e6b5
gh-118761: Optimise import time for ast (#131953) 2025-04-02 17:22:15 +01:00
Mark Shannon
ad053d8d6a
GH-131498: Cases generator: Parse down to C statement level. (GH-131948)
* Parse down to statement level in the cases generator

* Add handling for #if macros, treating them much like normal ifs.
2025-04-02 16:31:59 +01:00
Peter Bierma
6e91d1f9aa
gh-131974: Fix usages of locked_deref in ctypes (#131975) 2025-04-02 17:04:25 +02:00
Donghee Na
25275bda79
gh-131544: Update docs for PyType_AddWatcher (gh-132015) 2025-04-02 15:04:07 +00:00
Jakub Kulík
e8085319eb
gh-59705: Fix solaris detection in test_threading.test_set_name() (#132012) 2025-04-02 16:34:43 +02:00
Kumar Aditya
76f6b5e64a
gh-132013: use relaxed atomics in hash of frozenset (#132014)
Use relaxed atomics in hash of `frozenset` to fix TSAN warning.
2025-04-02 20:01:05 +05:30
Thomas Grainger
b0f77c4d25
gh-131888: fix ResourceWarning in test_ftplib (#131889) 2025-04-02 14:30:19 +02:00
sobolevn
ab2a3dda1d
gh-132002: Fix crash of ContextVar on unhashable str subtype (#132003) 2025-04-02 14:48:47 +03:00
Tomas R.
87d9983994
gh-130197: pygettext: Test the --escape option (GH-131902) 2025-04-02 11:46:54 +03:00
Filipe Laíns 🇵🇸
e7980ba233
GH-128055: fix test_sysconfigdata_json outside the builddir (#128070) 2025-04-02 05:44:43 +00:00
Brandt Bucher
3a8cefba0b
GH-131726: Split up _CHECK_VALIDITY_AND_SET_IP (GH-131810) 2025-04-01 16:55:05 -07:00
Brandt Bucher
1a9d4a1fb3
GH-131798: Allow the JIT to remove more int/float/str guards (GH-131800) 2025-04-01 15:10:15 -07:00
mpage
cd69d55f64
gh-131987: Bump the magic number (#131991)
This should have been done as part of 053c285 but got blown away
in a merge.
2025-04-01 14:53:49 -07:00
Pablo Galindo Salgado
c2ac662f28
gh-131831: Implement PEP 758 – Allow except and except* expressions without parentheses (#131833) 2025-04-01 19:04:56 +00:00
mpage
053c285f6b
gh-130704: Strength reduce LOAD_FAST{_LOAD_FAST} (#130708)
Optimize `LOAD_FAST` opcodes into faster versions that load borrowed references onto the operand stack when we can prove that the lifetime of the local outlives the lifetime of the temporary that is loaded onto the stack.
2025-04-01 10:18:42 -07:00