Commit graph

131625 commits

Author SHA1 Message Date
Sepehr Rasouli
60fdb3192b
gh-149738: Fix segmentation fault bug in sqllite3 (#149754)
Deleting the `row_factory` or `text_factory` attribute is no longer allowed.
2026-06-02 11:07:08 +02:00
Bartosz Sławecki
5a2d2736a6
gh-150052: Resolve un-loaded lazily loaded submodules via module.__getattr__ instead of publishing lazy values (#150055) (#150744) 2026-06-02 09:58:51 +01:00
Bernát Gábor
35c314d2b7
gh-89554: Document typing.ParamSpecArgs and ParamSpecKwargs as classes (GH-150677)
Use the directive "class" instead of "data" for ParamSpecArgs and ParamSpecKwargs.
2026-06-02 11:07:51 +03:00
Bernát Gábor
bc055444e4
gh-89554: Document standard type objects in types as classes (GH-150676)
Use the directive and the role "class" instead of "data" for classes
exposed in the types module.
2026-06-02 11:03:36 +03:00
Bernát Gábor
10c421970b
gh-89554: Document weakref type objects as classes (#150678)
Use the "class" directive instead of "data" for ReferenceType,
ProxyType and CallableProxyType.
2026-06-02 10:59:15 +03:00
Bernát Gábor
e40190e104
gh-89554: Document NoneType, NotImplementedType and EllipsisType as classes (GH-150682)
Always use the directive and the role "class" instead of "data" for
NoneType, NotImplementedType and EllipsisType.
2026-06-02 10:55:01 +03:00
Bernát Gábor
c79e18a8e5
gh-150717: Avoid mark-array allocation for groupless regex patterns (GH-150719)
state_init() always did PyMem_New(state->mark, groups*2), which for a
pattern with no capturing groups is PyMem_Malloc(0) -- a real allocation
(plus matching free) on every match/search/fullmatch call, for an array
that is never read: groupless patterns emit no MARK opcodes and group 0's
span is taken from state->start/ptr.

Guard the allocation with `if (pattern->groups)`. state->mark stays NULL
(set by the preceding memset), and both the error path and state_fini
already PyMem_Free(NULL) safely.
2026-06-02 10:45:30 +03:00
Barry Warsaw
27ebd9abce
gh-150228: Improve the PEP 829 batch processing APIs (#150542)
* gh-150228: Improve the PEP 829 batch processing APIs

As previously discussed with @ncoghlan and approved for 3.15b2 by @hugovk,
this implements the batch processing APIs for addsitedir() and friends.  We
remove the `defer_processing_start_files` flag which required some implicit
module global state, and promote StartupState to the public documented API.

This also moves the bulk of the module global functions into methods of the
`StartupState` class, so it removes the awkward APIs in 3.15b1.  Now, instances
of this class are an accumulator for startup state, using `StartupState.process()`
to process them.  Callers can now batch up startup state themselves by using
the methods on this class.  The module global functions are shims for this
which preserve the legacy APIs and semantics using the new state class.

This PR also fixes the interleaving regression identified by @ncoghlan in the
same issue.  Now, .pth file sys.path extensions are added to sys.path after
the sitedir that the .pth file is found in, restoring the legacy behavior.

Along the way, I've made a lot of improvements to function docstrings,
site.rst documentation, and comments in the code explaining what's going on.

* Add a note that if known_paths is provided to StartupState.__init__(), it
  will get mutated in place.
* Improve some conditional flows.
* Improve some comments.
* Improve the what's new entry.

* Make test_impl_exec_imports_suppressed_by_matching_start() more robust

Based on PR comment, we need to read both the .pth and .start files, and prove
that the .pth file's import line (which passes a bigger increment) is not
called, but the .start file's entry point (which uses the default increment)
is called.

* As per review, move some methods to the private API

_read_pth_file() and _read_start_file() are not intended to be part of the
public API surface outside of the site module, so even though they are used by
methods outside of the StartupState class, make them privately named.

* Resolve several review feedbacks

* Move a `versionadded`
* Better list comprehension formatting (use the output from
  `ruff format --line-length 78`)

* Add docs for site.makepath() and point the case-normalization requirement to
  this utility function.
* Note that StartupState.process() is not idempotent.

* Address another feedback comment

This time, we get rid of the legacy implementation `reset` local, which was
always difficult to understand, and just implement a return value based on the
processing mode selected.

* Changes based on gh-150228 review

The comment by @encukou that started this change:

```
I still see two red flags here though: an argument that doesn't combine with
other arguments, and (another instance of) changing the return type based on
an argument.

Did you consider adding a StartupState.addsitedir(sitedir) method, instead of
the startup_state argument?
```

As it turns out, this is an even cleaner design.  By moving the bulk of the
previous module global functions into `StartupState` methods, we can get rid
of all the awkward `startup_state` keyword-only arguments which conflict
with `known_path` (Petr's first point).  We can also get rid of the
return value dichotomy (Petr's second point) because now we can preserve
exactly the Python 3.14 API in the module global functions, and implement
the better APIs in the class methods.  We also generally don't have to
pass around `process_known_sitedirs`.

Now the following module global functions are essentially shims around
class methods:

* site.addsitedir() -> StartupState.addsitedir()
* site.addusersitepackages() -> StartupState.addusersitepackages()
* site.addsitepackages() -> StartupState.addsitepackages()
* Additional minor changes
* Remove a now unused parameter


Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-06-01 18:43:18 -07:00
László Kiss Kollár
f4426654fd
gh-150720: Remove '-d 1' in test_script_error_treatment (#150736) 2026-06-02 00:51:51 +00:00
Russell Keith-Magee
71fc4c66d3
gh-150644: Tag Apple system log messages as public. (#150645)
macOS 26 changed the default visibility of "dynamic" system messages. This
changes the logging strategy to tag all messages as "public" so they are
visible in the system log without special configuration.
2026-06-02 06:25:46 +08:00
Pablo Galindo Salgado
ce073ec4cc
gh-150429: Fix sampling profiler generator stack test (#150433) 2026-06-01 21:27:39 +01:00
Serhiy Storchaka
b23646adf1
gh-93417: Improve test_mimetypes (GH-150725)
* Separate tests for module-level API and for the MimeTypes class.
* Add tests for mimetypes.init() and MimeTypes() with knownfiles and with
  explicitly passed files.
2026-06-01 23:02:40 +03:00
Taeknology
9ba2a89179
gh-148672: Document namespace subpackages inside regular packages (#150056) 2026-06-01 12:22:42 -07:00
Sergey B Kirpichev
59abdf8207
gh-115119: Remove superfluous TEST_COVERAGE private macro from _decimal module (GH-149756)
It was previously shared with `libmpdec`, which is no longer vendored.
2026-06-01 13:41:21 -05:00
Mark Shannon
633b6be8f5
GH-148960: Reduce the size of the debug stencils to less than half. (GH-150551)
For AArch64 linux, reduces the total bytes in the code bodies from 489kb to 218kb.
Reduces the size of the stencils files from 394k lines to 167k lines.
2026-06-01 17:56:16 +01:00
Mark Shannon
4996b99695
GH-150478: Add "show_jit" option to dis.dis to show jit entry points (GH-150554)
* Shows `ENTER_EXECUTOR` instructions
2026-06-01 17:52:40 +01:00
Victor Stinner
e8034dd841
gh-150436: Skip subprocess test on STATUS_DLL_INIT_FAILED (#150704)
If a subprocess spawned with CREATE_NEW_CONSOLE creation flag fails
with STATUS_DLL_INIT_FAILED return code, skip the test. It's likely a
memory allocation failure in the desktop heap memory which caused the
DLL init failure.
2026-06-01 14:50:15 +00:00
Thomas Kowalski
c5516e7e37
gh-150157: Fix critical section for PyDict_Next() in _pickle.c (GH-150158) 2026-06-01 17:32:13 +03:00
sobolevn
cc0269334f
gh-149534: Fix unification of defaultdict and frozendict with | (#149539) 2026-06-01 16:26:49 +03:00
Thomas Kowalski
c98773633c
gh-149046: fix: correctly handle str subclasses in io.StringIO (#149047) 2026-06-01 13:01:57 +00:00
Sergey B Kirpichev
46b5e3e941
gh-80480: Remove deprecated 'u' array type code (#149535)
Reuse array.typecodes in tests.
2026-06-01 11:57:55 +00:00
Dawid Konrad Kohnke
9d64c355b5
gh-150368: Change Windows user group to secure identifier in test_tempfile (#150369) 2026-06-01 11:35:48 +00:00
Russell Keith-Magee
540b3d0a7f
gh-148508: Add another common pattern for iOS SSL failures to test_ssl (#150442)
Match also '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'.
2026-06-01 11:37:53 +02:00
Stéphane Bidoul
f4bda4d6cb
gh-150685: update bundled pip to 26.1.2 (gh-150686) 2026-05-31 20:28:02 +01:00
M. Greyson Christoforo
2f8f569ba9
Clarify docs for scheduler.run(blocking=False) (GH-129575) 2026-05-31 12:11:17 +00:00
Serhiy Storchaka
1de909b324
gh-150636: Clarify difference between copy.copy() and the copy() methods (GH-150637)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-31 15:08:55 +03:00
Victor Stinner
350e9de765
gh-148605: Remove irepeat() thread test from test_bytes (#150576) 2026-05-31 14:57:10 +05:30
Stan Ulbrych
1837c17bc7
gh-140553: Mark *gettext parameters as positionaly only in documentation (#140598) 2026-05-31 09:08:17 +01:00
htjworld
2b94b92394
gh-131178: Fix mimetypes CLI docs, mention that errors go to stdout (#149683)
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-31 07:45:48 +00:00
Sergey B Kirpichev
5b5ffce05c
Correct frexp() docs for zero and non-finite numbers (GH-149753)
0.5 <= abs(m) < 1 is only true for finite nonzero numbers
2026-05-31 07:29:44 +00:00
sobolevn
90c1d86f34
gh-149609: Raise deprecation warnings for abc.{abstractclassmethod,abstractstaticmethod,abstractproperty} (#149636) 2026-05-31 07:26:52 +00:00
Patrick Rauscher
73d8e9a47c
gh-117291: Explain usage of null bytes in Array(c_char).value (GH-117292) 2026-05-31 10:20:49 +03:00
Paper Moon
0f1f7c7889
gh-141444:fix broken URLs and examples in urllib.request.rst (#144863)
* Doc: fix broken URLs and examples in urllib.request.rst (gh-141444)

* Doc: update urllib.request examples to handle gzip compression

---------

Co-authored-by: Senthil Kumaran <senthil@python.org>
2026-05-30 19:08:18 -07:00
Itamar Oren
61ec3c2065
Add @itamaro to CODEOWNERS (#150635)
Added myself as a code owner across CI and build-system areas
2026-05-30 13:49:11 -07:00
Thomas Kowalski
56bd9ea676
gh-150372: Add missing null check on completer_word_break_characters in readline.c (GH-150251) 2026-05-30 19:26:05 +00:00
Joshix-1
af10734907
gh-150524: Remove outdated note in binascii.a2b_hex() documentation (GH-150525)
bytes.fromhex() accepts ASCII bytes and bytes-like objects as input since 3.14
2026-05-30 19:18:39 +00:00
Gustaf
2c20f9ce17
gh-123138: Updated email.headerregistry docs to include required keyword parse_tree (GH-134450) 2026-05-30 20:59:42 +03:00
Thomas Kowalski
1e18c45495
gh-150406: Check result of PyThread_allocate_lock() for netdb_lock (GH-150407) 2026-05-30 16:25:40 +00:00
Dhruv Singla
9baa7c63be
gh-129851: Fix the documentation for -m command (GH-129862) 2026-05-30 15:47:14 +00:00
Brij Kapadia
f586fd9e30
gh-144774: Add critical section in BaseException.__setstate__ (#150578) 2026-05-30 21:07:27 +05:30
Jean-François B.
25a5d874f2
Remove unneeded LaTeX code from latex_elements['preamble'] (GH-124630)
It was a workaround for Sphinx < 1.5.
2026-05-30 15:19:56 +00:00
Fang Li
6ecd197c03
gh-109503: Fix document for shutil.move() on usage of os.rename() since it's inaccurate (GH-109507)
Nonatomic move might be used even if the files are
on the same filesystem in some cases.
2026-05-30 14:26:03 +00:00
Neil Schemenauer
62a45fa91c
gh-135898: Add section to free-threading howto about memory usage (#143279)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-30 10:41:33 +00:00
Tomi Belan
6d7a19e533
gh-121109: Fix performance of tarfile reading with "r|*" (GH-121296) 2026-05-30 09:23:50 +00:00
Jonathan Dung
678fd8452c
gh-150501: Correct inspect.getattr_static docs signature (#150504) 2026-05-30 11:18:25 +02:00
Serhiy Storchaka
1c7011d8fe
gh-150560: Fix crash in XML parser on invalid XML with multi-byte encoding (GH-150568) 2026-05-30 00:23:32 +03:00
Serhiy Storchaka
bcd29e466f
gh-149489: Fix ElementTree serialization to HTML (GH-149490)
* The content of comments, processing instructions and elements "xmp",
  "iframe", "noembed", "noframes", and "plaintext" is no longer escaped.
* The "plaintext" element no longer have the closing tag.
* Add support of empty attributes (with value None).
2026-05-30 00:04:50 +03:00
Thomas Kowalski
f87d9605d3
gh-149056: Properly pass array_hook in json.load() to json.loads() (GH-149057) 2026-05-29 22:53:21 +03:00
Oral Ersoy Dokumacı
779694faba
gh-150403: Document frozendict in language reference Mappings section (GH-150404) 2026-05-29 22:40:22 +03:00
esadomer
26696a65f9
gh-132372: Speed up logging.config existing logger handling (GH-150242)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-05-29 16:50:05 +01:00