Commit graph

34551 commits

Author SHA1 Message Date
Stan Ulbrych
a5530656c1
gh-133390: Extend completion for .commands in sqlite3 (GH-135432) 2025-08-25 14:58:00 +02:00
Serhiy Storchaka
6620ef0ff6
gh-137754: Fix import of zoneinfo if _datetime is not available (GH-137845)
Both modules should use the Python implementation in that case.
2025-08-23 12:12:13 +03:00
Kumar Aditya
b9bcd02e9f
gh-137384: fix crash when accessing warnings state late in runtime shutdown (#138027) 2025-08-22 19:10:43 +05:30
Serhiy Storchaka
5b0f00e616
gh-135386: Skip readonly tests for the root user (GH-138058) 2025-08-22 16:22:14 +03:00
Bénédikt Tran
766614f88a
gh-136134: smtplib: fix CRAM-MD5 on FIPS-only environments (#136623) 2025-08-22 11:45:01 +00:00
General_K1ng
c0ae92b7c0
gh-135386: Fix "unable to open database file" errors on readonly DB (GH-135566)
Add immutable=1 flag for read-only SQLite access to avoid WAL/SHM errors on readonly DB.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-22 14:11:59 +03:00
Pranjal Prajapati
f27af8ba8e
gh-130425: Add "Did you mean [...]" suggestions for del obj.attr (GH-136588)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-08-22 12:21:16 +02:00
Bénédikt Tran
4519b8acb5
gh-136134: imaplib: fix CRAM-MD5 on FIPS-only environments (#136615) 2025-08-22 12:08:55 +02:00
Pablo Galindo Salgado
539a4ca1b9
gh-137967: Restore suggestions on nested attribute access (#137968) 2025-08-21 16:56:57 +01:00
Scott Noyes
3143ceeb1d
gh-137481: Fix abbreviation of day names in TextCalendar (GH-137482)
Use the length of the longest day name in the current locale, rather
than a constant 9, to decide if the names should be abbreviated.
2025-08-20 19:55:50 +03:00
Serhiy Storchaka
eae9d7de1c
gh-137477: Fix inspect.getblock() for generator expressions (GH-137488)
This fixes also inspect.getsourcelines() and inspect.getsource().
2025-08-20 16:18:08 +03:00
Steve Dower
7d06a0af17
gh-120037: Disable user site packages when a ._pth file is used (GH-137428) 2025-08-19 21:28:28 +01:00
Serhiy Storchaka
ac37b77441
gh-137044: Fix test_resource on 32-bit Linux (GH-137941) 2025-08-19 15:22:30 +03:00
Petr Viktorin
719e5c3f71
gh-123681: Check NORMALIZE_CENTURY behavior at runtime; require C99 (GH-136022)
A runtime check is needed to support cross-compiling.

Remove the _Py_NORMALIZE_CENTURY macro.
Remove _pydatetime.py's _can_support_c99.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-19 12:59:03 +02:00
Peter Bierma
b07a267953
gh-137883: Check the recursion limit for specialized keyword argument calls (GH-137887) 2025-08-19 09:53:38 +01:00
Mikhail Efimov
06dd63501a
gh-136438: Make sure test_dis pass with all optimization levels (GH-136593)
Now tests pass with all combinations of -OO and --without-doc-strings.
2025-08-19 10:48:35 +02:00
Serhiy Storchaka
6e2b9a2130
gh-137512: Add new constants in the resource module (GH-137513)
* RLIMIT_NTHR
* RLIMIT_THREADS
* RLIMIT_UMTXP
* RLIM_SAVED_CUR
* RLIM_SAVED_MAX

* Document RLIMIT_PIPEBUF. Other doc fixes.
2025-08-19 08:52:45 +02:00
Jason R. Coombs
3706ef66ef
Revert "gh-132947: Apply changes from importlib_metadata 8.7 (#137885)" (#137924)
This reverts commit 5292fc00f2.
2025-08-18 20:57:36 +00:00
Jason R. Coombs
5292fc00f2
gh-132947: Apply changes from importlib_metadata 8.7 (#137885)
* Copied files from python/importlib_metadata@b67ac80c49.
2025-08-18 10:54:10 -07:00
Adam Turner
918e3ba6c0
GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
Serhiy Storchaka
0324c726de
gh-137044: Make resource.RLIM_INFINITY always positive (GH-137511)
It is now a positive integer larger larger than any limited resource value.
This simplifies comparison of the resource values.
Previously, it could be negative, such as -1 or -3, depending on platform.

Deprecation warning is emitted if the old negative value is passed.
2025-08-18 19:28:56 +03:00
Petr Viktorin
7dfa048bbb
gh-135228: Create __dict__ and __weakref__ descriptors for object (GH-136966)
This partially reverts #137047, keeping the tests for GC collectability of the
original class that dataclass adds `__slots__` to.
The reference leaks solved there are instead solved by having the `__dict__` &
`__weakref__` descriptors not tied to (and referencing) their class.

Instead, they're shared between all classes that need them (within
an interpreter).
The `__objclass__` ol the descriptors is set to `object`, since these
descriptors work with *any* object. (The appropriate checks were already
made in the get/set code, so the `__objclass__` check was redundant.)

The repr of these descriptors (and any others whose `__objclass__` is `object`)
now doesn't mention the objclass.

This change required adjustment of introspection code that checks
`__objclass__` to determine an object's “own” (i.e. not inherited) `__dict__`.
Third-party code that does similar introspection of the internals will also
need adjusting.


Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-08-18 14:25:51 +02:00
Petr Viktorin
d8a9466e29
bpo-38735: Don't fail when importing from / with sys.pycache_prefix set (GH-30456)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-18 13:53:01 +02:00
Serhiy Storchaka
0c8fecc4cf
gh-137729: Fix support for locales with @-modifiers (GH-137253) 2025-08-18 10:11:15 +03:00
Hood Chatham
bc2872445b
gh-127146: Emscripten: Add test_sample_profiler skips where needed (#137815)
Emscripten doesn't have the `socket.SO_REUSEADDR` constant; skip tests that
require that symbol to exist.
2025-08-18 07:57:15 +08:00
Serhiy Storchaka
7636a66635
gh-135661: Fix parsing unterminated bogus comments in HTMLParser (GH-137873)
Bogus comments that start with "<![CDATA[" should not include the starting "!"
in its value.
2025-08-17 13:37:50 +03:00
Victor Stinner
5c0231c27a
gh-137725: Convert faulthandler to Argument Clinic (#137726)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-16 15:16:04 +02:00
Jason R. Coombs
ec4021c6d7
gh-120492: Sync importlib_metadata 8.2.0 (#124033)
* Sync with importlib_metadata 8.2.0

Removes deprecated behaviors, including support for `PackageMetadata.__getitem__` returning None for missing keys and Distribution subclasses not implementing abstract methods.
Prioritizes valid dists to invalid dists when retrieving by name (python/cpython/#120492). Adds SimplePath to `importlib.metadata.__all__`.

* Add blurb
2025-08-15 14:19:23 -07:00
ggqlq
03f5519d77
gh-131178: Add tests for site command-line interface (GH-133582) 2025-08-15 14:00:43 -04:00
Pablo Galindo Salgado
4e08a9f97a
gh-137078: Fix keyword typo recognition when executed over files (#137079) 2025-08-15 15:14:13 +00:00
Justin Applegate
781294019d
gh-135241: Make unpickling of booleans in protocol 0 more strict (GH-135242)
The Python pickle module looks for "00" and "01" but _pickle only looked
for 2 characters that parsed to 0 or 1, meaning some payloads like "+0" or
" 0" would lead to different results in different implementations.
2025-08-14 22:22:37 +03:00
Serhiy Storchaka
0cbbfc4621
gh-135661: Fix CDATA section parsing in HTMLParser (GH-135665)
"] ]>" and "]] >" no longer end the CDATA section.

Make CDATA section parsing  context depending.
Add private method HTMLParser._set_support_cdata() to change the context.
If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>".
If called with False, "<[CDATA[" starts a bogus comments which ends with ">".
2025-08-14 18:13:22 +00:00
adam j hartz
04f8ef663b
gh-137576: Fix for Basic REPL showing incorrect code in tracebacks with PYTHONSTARTUP (#137625)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-08-14 20:58:11 +03:00
Yoav Nir
c87b66bc7c
gh-74185: repr() of ImportError now contains attributes name and path (#136770)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: ynir3 <ynir3@bloomberg.net>
2025-08-14 15:14:00 +02:00
Serhiy Storchaka
c47ffbf1a3
gh-125854: Improve error messages for invalid category in the warnings module (GH-137750)
Include the type name if the category is a type, but not a Warning
subclass, instead of just 'type'.
2025-08-14 14:59:04 +03:00
Semyon Moroz
968f6e523a
gh-130821: Add type information to error messages for invalid return type (GH-130835) 2025-08-14 11:04:41 +03:00
Sam Gross
a10152f8fd
gh-137400: Fix thread-safety issues when profiling all threads (gh-137518)
There were a few thread-safety issues when profiling or tracing all
threads via PyEval_SetProfileAllThreads or PyEval_SetTraceAllThreads:

* The loop over thread states could crash if a thread exits concurrently
  (in both the free threading and default build)
* The modification of `c_profilefunc` and `c_tracefunc` wasn't
  thread-safe on the free threading build.
2025-08-13 14:15:12 -04:00
Dino Viehland
b78e9c05b6
gh-137681: Always initialize exception handler for new instruction (#137655)
Always initialize exception handler for new instruction
2025-08-13 08:58:26 -07:00
Jelle Zijlstra
089a324a42
gh-137226: Fix behavior of ForwardRef.evaluate with type_params (#137227)
The previous behavior was copied from earlier typing code. It works around the way
typing.get_type_hints passes its namespaces, but I don't think the behavior is logical
or correct.
2025-08-13 06:47:47 -07:00
Adam Turner
6baf552484
GH-137623: Begin enforcing docstring length in Argument Clinic (#137624) 2025-08-12 20:17:35 +00:00
Adam Turner
be56464c4b
GH-137630: Convert `_interpreters` to use Argument Clinic (#137631) 2025-08-12 16:23:13 +01:00
Jelle Zijlstra
6859b95cff
gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047)
Remove the `__dict__` and `__weakref__` descriptors from the original class when creating a dataclass from it.

An interesting hack, but more localized in scope than gh-135230.

This may be a breaking change if people intentionally keep the original class around
when using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on the
original class.


Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-12 13:16:54 +02:00
Brett Cannon
7140b99b0d
GH-137426: Remove code deprecation of importlib.abc.ResourceLoader (GH-137567)
Enough other classes in `importlib.abc` inherit from the class and the deprecation was to redirect people to `TraversableResources`. The documentation now makes it clear the class only exists for backwards compatibility.

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-11 16:18:54 -07:00
Sam Gross
362692852f
gh-137400: Fix a crash when disabling profiling across all threads (gh-137471)
The `PyEval_SetProfileAllThreads` function and other related functions
had a race condition on `tstate->c_profilefunc` that could lead to a
crash when disable profiling or tracing on all threads while another
thread is starting to profile or trace a a call.

There are still potential crashes when threads exit concurrently with
profiling or tracing be enabled/disabled across all threads.
2025-08-11 11:41:44 -04:00
AN Long
deb0020e3d
gh-115766: Fix IPv4Interface.is_unspecified (GH-137326) 2025-08-11 15:04:47 +02:00
László Kiss Kollár
4497ad409e
gh-135953: Profile a module or script with sampling profiler (#136777) 2025-08-11 12:36:43 +01:00
Serhiy Storchaka
1bde13b0e9
Add test for opening an SQLite with bytes path (GH-136331) 2025-08-11 09:16:54 +03:00
Malcolm Smith
b36d23f58e
Update pre-commit hooks (#137591)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-10 22:32:50 +00:00
Peter Bierma
55788a9096
gh-137583: Only lock the SSL context, not the SSL socket (GH-137588)
Fixes a deadlock in 3.13.6.
2025-08-10 14:47:11 +00:00
Serhiy Storchaka
046a4e39b3
gh-136571: Convert more code in datetime to Argument Clinic (GH-136573)
This adds signatures for some classes and methods.

date.fromisocalendar() can now raise OverflowError for arguments that
don't fit in the C int.
2025-08-09 18:25:49 +00:00