Commit Graph

121643 Commits

Author SHA1 Message Date
Jason R. Coombs 9c93b7402b
gh-117348: restore import time performance of configparser (#117703)
Reduces import time by over 50% (10431µs vs 4350µs on Apple M3 Pro).
2024-04-14 11:10:09 +00:00
Jelle Zijlstra c99d374fc7
dataclasses docs: add some link anchors (#117601) 2024-04-14 01:03:16 -07:00
Erlend E. Aasland 0dcfd0d522
Autoconf: aarch64-apple-darwin/clang is now a tier 1 platform (#117861)
See also python/pep#3705
2024-04-14 09:21:29 +02:00
Gouvernathor f303651b45
Simpler example of shallow dict export of a dataclass (#117812) 2024-04-13 17:14:43 -07:00
Gouvernathor e7cce2a9c6
Tweak wording for dataclasses.replace (gh-117758) 2024-04-13 20:03:09 -04:00
Barney Gale a74f117dab
GH-115060: Speed up `pathlib.Path.glob()` by omitting initial `stat()` (#117831)
Since 6258844c, paths that might not exist can be fed into pathlib's
globbing implementation, which will call `os.scandir()` / `os.lstat()` only
when strictly necessary. This allows us to drop an initial `self.is_dir()`
call, which saves a `stat()`.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-04-14 00:08:03 +01:00
Erlend E. Aasland 3095d02642
gh-96398: Fix mpicc check in configure.ac (#117857) 2024-04-13 21:22:06 +00:00
Hugo van Kemenade 56ed979d04
gh-68583: webbrowser: replace `getopt` with `argparse`, add long options (#117047) 2024-04-13 08:56:56 -06:00
Michiel W. Beijen 022ba6d161
gh-102247: http: support rfc9110 status codes (GH-117611)
rfc9110 obsoletes the earlier rfc 7231. This document also includes some
status codes that were previously only used for WebDAV and assigns more
generic names to these status codes.

ref: https://www.rfc-editor.org/rfc/rfc9110.html#name-changes-from-rfc-7231

- http.HTTPStatus.CONTENT_TOO_LARGE (413, previously
  REQUEST_ENTITY_TOO_LARGE)
- http.HTTPStatus.URI_TOO_LONG (414, previously REQUEST_URI_TOO_LONG)
- http.HTTPStatus.RANGE_NOT_SATISFYABLE (416, previously
  REQUEST_RANGE_NOT_SATISFYABLE)
- http.HTTPStatus.UNPROCESSABLE_CONTENT (422, previously
  UNPROCESSABLE_ENTITY)

The new constants are added to http.HTTPStatus and the old constant names are
preserved for backwards compatibility.

References in documentation to the obsoleted rfc 7231 are updated
2024-04-13 07:33:20 -07:00
Hugo van Kemenade dd724239dd
gh-117840: Fix indent to fix shlex syntax highlighting (#117843) 2024-04-13 05:31:01 -06:00
Shantanu 37a4cbd872
gh-114466: explicitly define heap invariant (#117778)
I think the choice of wording in these docs is great and doesn't
need to change. However, it could be useful to explicitly define
this term / the cost of doing so seems relatively low.
2024-04-13 00:05:27 -07:00
Erlend E. Aasland c2a551a30b
gh-96398: Detect GCC compatible compilers in configure (#117825)
Introduce a cached variable $ac_cv_gcc_compat and set it to 'yes' if
the C preprocessor defines the __GNUC__ macro.
2024-04-13 09:05:07 +02:00
Eric Snow eca53620e3
gh-94673: Clarify About Runtime State Related to Static Builtin Types (gh-117761)
Guido pointed out to me that some details about the per-interpreter state for the builtin types aren't especially clear.  I'm addressing that by:

* adding a comment explaining that state
* adding some asserts to point out the relationship between each index and the interp/global runtime state
2024-04-12 16:39:27 -06:00
Barney Gale 30f0643e36
GH-117727: Speed up `pathlib.Path.iterdir()` by using `os.scandir()` (#117728)
Replace use of `os.listdir()` with `os.scandir()`. Forgo setting `_drv`,
`_root` and `_tail_cached`, as these usually aren't needed. Use
`os.DirEntry.path` to set `_str`.
2024-04-12 22:02:39 +00:00
Barney Gale 0eb52f5f26
GH-115060: Speed up `pathlib.Path.glob()` by not scanning literal parts (#117732)
Don't bother calling `os.scandir()` to scan for literal pattern segments,
like `foo` in `foo/*.py`. Instead, append the segment(s) as-is and call
through to the next selector with `exists=False`, which signals that the
path might not exist. Subsequent selectors will call `os.scandir()` or
`os.lstat()` to filter out missing paths as needed.
2024-04-12 22:19:21 +01:00
Victor Stinner 069de14cb9
gh-115627: Fix ssl test_pha_required_nocert() (#117821)
Accept also BrokenPipeError error message.
2024-04-12 20:41:16 +02:00
Savannah Ostrowski a97650912e
gh-117739: Update definition of global interpreter lock for 3.13 (#117740)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-04-12 14:19:41 -04:00
Sam Gross 4ad8f090cc
gh-117376: Partial implementation of deferred reference counting (#117696)
This marks objects as using deferred refrence counting using the
`ob_gc_bits` field in the free-threaded build and collects those objects
during GC.
2024-04-12 17:36:20 +00:00
Serhiy Storchaka c50cb6dd09
gh-117764: Add more tests for signatures of builtins (GH-117816)
Test signatures of all public builtins and methods of builtin classes
in modules builtins, types, sys, and several other modules (either
included in the list of standard builtin modules sys.builtin_module_names,
or providing a public interface for such modules).

Most builtins should have supported signatures, with few known exceptions.
When more builtins will be converted to Argument Clinic or support of
new signatures be implemented, they will be removed from the exception
lists.
2024-04-12 14:55:29 +00:00
Erlend E. Aasland 4ce10da36f
gh-96398: Detect emcc and mpicc in compiler names in configure (#117819)
- emcc defines __EMSCRIPTEN__
- mpicc doesn't define anything in particular; detect it using basename
2024-04-12 16:33:29 +02:00
Serhiy Storchaka 2d3d9b4461
gh-117764: Add docstrings and signatures for the types of None, Ellipsis and NotImplemented (GH-117813) 2024-04-12 15:45:23 +03:00
Serhiy Storchaka 39a6b29756
gh-117764: Use Argument Clinic for signal.set_wakeup_fd() (GH-117777) 2024-04-12 11:21:00 +00:00
Serhiy Storchaka 3a8c1ca7e7
gh-117764: Fix and add signatures for many builtins (GH-117769) 2024-04-12 13:56:41 +03:00
Hugo van Kemenade 94e9c35cd0
Fix version directive indents (#117719) 2024-04-12 13:30:42 +03:00
Serhiy Storchaka 245e426b55
gh-117764: Add signatures for functions in the faulthandler module (GH-117771) 2024-04-12 13:14:31 +03:00
Serhiy Storchaka 2e098abf95
gh-117764: Add signature for functools.partial() (GH-117775) 2024-04-12 10:00:38 +00:00
Serhiy Storchaka ffbd97428d
gh-117764: Add signatures and improve docstrings in the _thread module (GH-117772) 2024-04-12 09:49:59 +00:00
Erlend E. Aasland 1ddbeae040
gh-117752: Autoconf: fix PGO builds for 'make -C build' incantations (#117803) 2024-04-12 09:36:40 +00:00
Serhiy Storchaka 49af71a04a
gh-117764: Add signatures for some objects in the itertools module (GH-117774) 2024-04-12 12:36:27 +03:00
Serhiy Storchaka 3a26e29215
gh-117764: Add signatures in the atexit module (GH-117776) 2024-04-12 12:35:56 +03:00
Serhiy Storchaka 35f60c3def
gh-117764: Add signatures for __reduce__ and __reduce_ex__ in the _io module (GH-117773)
__reduce__() does not have parameters, __reduce_ex__() has a single
parameter.
2024-04-12 12:22:17 +03:00
Serhiy Storchaka 2638c28be0
gh-117764: Add signatures for some functions in the sys module (GH-117770)
Use Argument Clinic if possible.
2024-04-12 09:12:48 +00:00
Serhiy Storchaka 6e05537676
gh-117764: Add docstrings and signatures for the __replace__ methods (GH-117768) 2024-04-12 08:46:20 +00:00
Erlend E. Aasland deb921f851
gh-117431: Adapt bytes and bytearray .find() and friends to Argument Clinic (#117502)
This change gives a significant speedup, as the METH_FASTCALL calling
convention is now used. The following bytes and bytearray methods are adapted:

- count()
- find()
- index()
- rfind()
- rindex()

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2024-04-12 07:40:55 +00:00
Erlend E. Aasland 49fc1414b5
gh-117752: Autoconf: fix -fno-semantic-interposition check (#117789)
Force the compiler to issue an error if the flag is not supported.
2024-04-12 09:37:38 +02:00
Erlend E. Aasland 396b831850
gh-117752: Autoconf: store all LLVM profile data in the build directory (#117790)
This prevents spurious 'env changed' and llvm-profdata merge errors.
2024-04-12 07:23:39 +02:00
Eric Snow fd259fdabe
gh-76785: Handle Legacy Interpreters Properly (gh-117490)
This is similar to the situation with threading._DummyThread.  The methods (incl. __del__()) of interpreters.Interpreter objects must be careful with interpreters not created by interpreters.create().  The simplest thing to start with is to disable any method that modifies or runs in the interpreter.  As part of this, the runtime keeps track of where an interpreter was created.  We also handle interpreter "refcounts" properly.
2024-04-11 23:23:25 +00:00
Eli Schwartz fd2bab9d28
gh-117787: Autoconf: fix bashisms/semantic breakage of iOS checks (#117788) 2024-04-12 01:03:54 +02:00
Brett Simmers f268e328ed
gh-116738: Make _abc module thread-safe (#117488)
A collection of small changes aimed at making the `_abc` module safe to
use in a free-threaded build.
2024-04-11 18:13:25 -04:00
Sam Gross 1b10efad66
gh-117649: Fix file descriptor leak in (expected) failing test case (#117780)
The test case is currently expected to fail in the free-threaded build.
However, it fails before it gets a chance to close the write end of
the pipe.
2024-04-11 21:35:46 +00:00
Sam Gross 25f6ff5d3e
gh-117649: Raise ImportError for unsupported modules in free-threaded build (#117651)
The free-threaded build does not currently support the combination of
single-phase init modules and non-isolated subinterpreters. Ensure that
`check_multi_interp_extensions` is always `True` for subinterpreters in
the free-threaded build so that importing these modules raises an
`ImportError`.
2024-04-11 15:00:54 -04:00
Sam Gross 39d381f91e
gh-111506: Error if the limited API is used in free-threaded build (#117762)
Issue a build time error if both `Py_LIMITED_API` and `Py_GIL_DISABLED`
are defined.
2024-04-11 13:49:52 -04:00
Tomas R c06be6bbb8
gh-104269: Document `glob.glob` duplicates when using multiple `**` patterns (#105406) 2024-04-11 15:16:39 +00:00
Will Childs-Klein b8eaad3009
gh-117233: Detect support for several hashes at hashlib build time (GH-117234)
Detect libcrypto BLAKE2, Shake, SHA3, and Truncated-SHA512 support at hashlib build time

## BLAKE2

While OpenSSL supports both "b" and "s" variants of the BLAKE2 hash
function, other cryptographic libraries may lack support for one or both
of the variants. This commit modifies `hashlib`'s C code to detect
whether or not the linked libcrypto supports each BLAKE2 variant, and
elides references to each variant's NID accordingly. In cases where the
underlying libcrypto doesn't fully support BLAKE2, CPython's
`./configure` script can be given the following flag to use CPython's
interned BLAKE2 implementation: `--with-builtin-hashlib-hashes=blake2`.

## SHA3, Shake, & truncated SHA512.

Detect BLAKE2, SHA3, Shake, & truncated SHA512 support in the
OpenSSL-ish libcrypto library at build time.  This helps allow hashlib's
`_hashopenssl` to be used with libraries that do not to support every
algorithm that upstream OpenSSL does.  Such as AWS-LC & BoringSSL.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2024-04-11 16:49:41 +02:00
Bruce Merry 01a51f9494
gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)
gh-16429 introduced support for an iterable of separators in
Stream.readuntil. Since bytes-like types are themselves iterable, this
can introduce ambiguities in deciding whether the argument is an
iterator of separators or a singleton separator. In gh-16429, only 'bytes'
was considered a singleton, but this will break code that passes other
buffer object types.

Fix it by only supporting tuples rather than arbitrary iterables.

Closes gh-117722.
2024-04-11 07:41:55 -07:00
Mikhail B 898f6de63f
gh-101549: fix documentation of xml.etree.ElementInclude (#101550)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-04-11 14:23:52 +00:00
Kirill Podoprigora 91d7605ac3
gh-115142: Skip ``test_capi/test_opt.py`` if ``_testinternalcapi`` is not available (GH-117574) 2024-04-11 16:19:19 +02:00
Nikita Sobolev be82058064
Fix markup of `win32_ver` in `platform.rst` (#116492) 2024-04-11 17:13:53 +03:00
Erlend E. Aasland 044dc496e0
gh-117709: Add vectorcall support for str() with positional-only arguments (#117746)
Fall back to tp_call() for cases when arguments are passed by name.

Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-04-11 13:55:37 +00:00
Victor Stinner 671cb22094
gh-113317: Add ParseArgsCodeGen class (#117707) 2024-04-11 13:49:07 +00:00