Commit Graph

124525 Commits

Author SHA1 Message Date
Hugo van Kemenade
3c6d2d1230
gh-89416: Add RFC 9559 MIME types for Matroska formats (#126412)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-11-11 21:08:54 +00:00
Gregory P. Smith
4f3253a0cc
gh-84559: gh-103134: Whats new 3.14 entries for multiprocessing. (GH-126697) 2024-11-11 19:19:08 +00:00
谭九鼎
6e25eb1541
Update documentation links to Microsoft's documentation pages (GH-126379) 2024-11-11 17:10:49 +00:00
Serhiy Storchaka
25aee21aa8
gh-126374: Add support of options with optional arguments in the getopt module (GH-126375) 2024-11-11 18:29:28 +02:00
Serhiy Storchaka
79805d2284
gh-117941: Reject option names starting with "--no-" in argparse.BooleanOptionalAction (GH-125894)
They never worked correctly.
2024-11-11 18:28:30 +02:00
Serhiy Storchaka
819830f34a
gh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557)
* upper-case non-BMP character was ignored
* the ASCII flag was ignored when matching a character range whose
  upper bound is beyond the BMP region
2024-11-11 18:27:26 +02:00
sobolevn
9fc2808eaf
gh-126654: Fix crash in several functions in _interpreters module (#126678) 2024-11-11 17:05:56 +05:30
Stephen Morton
6ee542d491
gh-126417: validate ABC methods on multiprocessing proxy types (#126454)
Checks that appropriate dunder __ methods exist on the dict and list proxy types.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-11-10 23:08:58 -08:00
Rafael Fontenelle
82269c7d58
Add missing fullstop . to whatsnew/3.8.rst (GH-126553) 2024-11-10 22:59:23 -08:00
vivodi
25257d61cf
gh-126664: Use else instead of finally in "The with statement" documentation. (GH-126665) 2024-11-10 22:47:56 -08:00
Gregory P. Smith
5c488caeb8
gh-117378: Clear up the NEWS entry wording (GH-126634)
gh-117378: Clear up the NEWS entry wording.

Docs are hard.  Lets go shopping!
2024-11-10 22:39:58 -08:00
Pedro Fonini
434b29767f
gh-126543: Docs: change "bound type var" to "bounded" when used in the context of the 'bound' kw argument to TypeVar (#126584) 2024-11-10 16:40:25 -08:00
Kirill Podoprigora
f435de6765
gh-126647: Doc/using/configure.rst: Add an entry for `--enable-experimental-jit` option (#126648)
Add an entry for the ``--enable-experimental-jit`` option in ``Doc/using/configure.rst``.
This was added as an experimental option in CPython 3.13.
Possible values for it:
* `no` - don't build the JIT.
* `yes` - build the JIT.
* `yes-off` - build the JIT but disable it by default.
* `interpreter` - don't build the JIT but enable tier 2 interpreter instead.


Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-10 23:44:56 +02:00
Gregory P. Smith
ca878b6e45
gh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635)
The first version had it running two forkserver and one spawn tests underneath each of the _fork, _forkserver, and _spawn test suites that build off the generic one.

This adds to the existing complexity of the multiprocessing test suite by offering BaseTestCase classes another attribute to control which suites they are invoked under. Practicality vs purity here. :/

Net result: we don't over-run the new test and their internal logic is simplified.
2024-11-10 13:17:05 -08:00
CF Bolz-Tereick
0f6bb28ff3
Skip test in test_socket.py if sys.getrefcount isn't available (#126640)
Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for  PyPy and other Python implementations that do not have `sys.getrefcount`.
2024-11-10 17:16:36 +02:00
Jan Hicken
160758a574
gh-126565: Skip zipfile.Path.exists check in write mode (#126576)
When `zipfile.Path.open` is called, the implementation will check
whether the path already exists in the ZIP file. However, this check is
only required when the ZIP file is in read mode. By swapping arguments
of the `and` operator, the short-circuiting will prevent the check from
being run in write mode.

This change will improve the performance of `open()`, because checking
whether a file exists is slow in write mode, especially when the archive
has many members.
2024-11-10 09:57:24 -05:00
Hugo van Kemenade
450db61a78
Postpone module.__loader__ deprecation to Python 3.16 (#126482) 2024-11-09 16:48:33 -08:00
Gregory P. Smith
9d08423b6e
gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538)
gh-117378: Fix multiprocessing forkserver preload sys.path inheritance.

`sys.path` was not properly being sent from the parent process when launching
the multiprocessing forkserver process to preload imports.  This bug has been
there since the forkserver start method was introduced in Python 3.4.  It was
always _supposed_ to inherit `sys.path` the same way the spawn method does.

Observable behavior change: A `''` value in `sys.path` will now be replaced in
the forkserver's `sys.path` with an absolute pathname
`os.path.abspath(os.getcwd())` saved at the time that `multiprocessing` was
imported in the parent process as it already was when using the spawn start
method. **This will only be observable during forkserver preload imports**.

The code invoked before calling things in another process already correctly sets `sys.path`.
Which is likely why this went unnoticed for so long as a mere performance issue in
some configurations.

A workaround for the bug on impacted Pythons is to set PYTHONPATH in the
environment before multiprocessing's forkserver process was started. Not perfect
as that is then inherited by other children, etc, but likely good enough for many
people's purposes.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-09 23:01:32 +00:00
Barney Gale
266328552e
pathlib ABCs: tighten up resolve() and absolute() (#126611)
In `PathBase.resolve()`, raise `UnsupportedOperation` if a non-POSIX path
parser is used (our implementation uses `posixpath._realpath()`, which
produces incorrect results for non-POSIX path flavours.) Also tweak code to
call `self.absolute()` upfront rather than supplying an emulated `getcwd()`
function.

Adjust `PathBase.absolute()` to work somewhat like `resolve()`. If a POSIX
path parser is used, we treat the root directory as the current directory.
This is the simplest useful behaviour for concrete path types without a
current directory cursor.
2024-11-09 18:47:49 +00:00
Barney Gale
0f47a3199c
pathlib ABCs: support initializing paths with no arguments (#126608)
In the past I've equivocated about whether to require at least one argument
in the `PurePathBase` (and `PathBase`) initializer, and what the default
should be if we make it optional. I now have a local use case that has
persuaded me to make it optional and default to the empty string (a
`zipp.Path`-like class that treats relative and absolute paths similarly.)
Happily this brings the base class more in line with `PurePath` and `Path`.
2024-11-09 18:21:53 +00:00
Ken Jin
6293d00e72
gh-120619: Strength reduce function guards, support 2-operand uop forms (GH-124846)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2024-11-09 11:35:33 +08:00
Hood Chatham
f8276bf5f3
gh-126187 Add emscripten.py script to automate emscripten build (#126190)
Add emscripten.py script to automate emscripten build.

This is modeled heavily on `Tools/wasm/wasi.py`. This will form the basis of an Emscripten build bot.
2024-11-09 10:12:55 +08:00
Barney Gale
54c63a32d0
GH-126212: Fix removal of slashes in file URIs on Windows (#126214)
Adjust `urllib.request.pathname2url()` and `url2pathname()` so that they
don't remove slashes from Windows DOS drive paths and URLs. There was no
basis for this behaviour, and it conflicts with how UNC and POSIX paths are
handled.
2024-11-08 16:47:51 +00:00
Mark Shannon
fa40922597
GH-126547: Pre-assign version numbers for a few common classes (GH-126551) 2024-11-08 16:44:44 +00:00
Steve Dower
fd5580cd15
gh-126497: Add missing venv redirectors to freethreaded installer (GH-126556) 2024-11-08 16:09:34 +00:00
RUANG (James Roy)
75ffac296e
gh-125298: Remove misleading text in os.kill documentation (GH-125749)
Windows has not accepted process handles in many releases.
2024-11-08 15:29:16 +00:00
Xuanteng Huang
6ec886531f
gh-126072: Set docstring attribute for module and class (#126231) 2024-11-08 15:13:18 +00:00
Kumar Aditya
b19d12f447
remove minor redundant code from _asyncio (#126578) 2024-11-08 13:17:03 +00:00
Serhiy Storchaka
a93fc0969e
gh-126579: Adapt sys.audit() to Argument Clinic (GH-126580) 2024-11-08 13:11:44 +00:00
Kumar Aditya
a3e8e7bbc3
GH-107803: use circular double linked list for tasks in _asyncio (#126577) 2024-11-08 12:51:11 +00:00
Serhiy Storchaka
061e50f196
gh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)
Remove _PyArg_UnpackKeywordsWithVararg.
Add comments for integer arguments of _PyArg_UnpackKeywords.
2024-11-08 14:23:50 +02:00
Serhiy Storchaka
ee0746af7d
gh-122943: Move code generation for var-positional parameter to converters (GH-126575) 2024-11-08 14:12:15 +02:00
Hood Chatham
403410fa1b
gh-89640: Restore configure error message on failure to detect float word order (#126569)
Before #126387, if we didn't detect float word order we'd raise the following
configure error:

    Unknown float word ordering. You need to manually preset
    ax_cv_c_float_words_bigendian=no (or yes) according to your system.

This puts it back (except for ARM or WASM, which as hardcoded).
2024-11-08 11:57:17 +00:00
Valery Fedorenko
9ecd8f7f40
gh-126171: fix possible null dereference in _imp_find_frozen_impl (#126566) 2024-11-08 15:49:15 +05:30
Serhiy Storchaka
06a8b0bb5e
gh-122943: Remove the object converter for var-positional parameter (GH-126560) 2024-11-08 05:41:54 +00:00
Bénédikt Tran
c222441fa7
gh-120017: use 'do-while(0)' in some {codegen,compile}.c multi-line macros (#120018) 2024-11-07 23:03:11 +00:00
Brett Cannon
bbe9b21d06
GH-123877: default to wasm32-wasip1 instead of wasm32-wasi to be more specific (GH-126552)
Eventually wasm32-wasi will represent WASI 1.0, and so it's currently deprecated so it can be used for that eventual purpose. wasm32-wasip1 is also more specific to what version of WASI is currently supported.

---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-11-07 13:40:56 -08:00
Serhiy Storchaka
1f777396f5
gh-122943: Rework support of var-positional parameter in Argument Clinic (GH-122945)
Move creation of a tuple for var-positional parameter out of
_PyArg_UnpackKeywordsWithVararg().
Merge _PyArg_UnpackKeywordsWithVararg() with _PyArg_UnpackKeywords().
Add a new parameter in _PyArg_UnpackKeywords().

The "parameters" and "converters" attributes of ParseArgsCodeGen no
longer contain the var-positional parameter. It is now available as the
"varpos" attribute. Optimize code generation for var-positional
parameter and reuse the same generating code for functions with and without
keyword parameters.

Add special converters for var-positional parameter. "tuple" represents it as
a Python tuple and "array" represents it as a continuous array of PyObject*.
"object" is a temporary alias of "tuple".
2024-11-07 23:40:03 +02:00
alm
09d6f5dc78
GH-126464 Fix JIT CI on aarch64-apple-darwin (GH-126494) 2024-11-07 10:55:31 -08:00
Michael Droettboom
a38e82bd8c
gh-126298: Don't deduplicate slice constants based on equality (#126398)
* gh-126298: Don't deduplicated slice constants based on equality

* NULL check for PySlice_New

* Fix refcounting

* Fix refcounting some more

* Fix refcounting

* Make tests more complete

* Fix tests
2024-11-07 16:39:23 +00:00
Eric Snow
9357fdcaf0
gh-76785: Minor Cleanup of "Cross-interpreter" Code (gh-126457)
The primary objective here is to allow some later changes to be cleaner. Mostly this involves renaming things and moving a few things around.

* CrossInterpreterData -> XIData
* crossinterpdatafunc -> xidatafunc
* split out pycore_crossinterp_data_registry.h
* add _PyXIData_lookup_t
2024-11-07 09:32:42 -07:00
Aditya Borikar
3d9f9ae5a7
Chore: Fix typo in pyarena.c (#126527) 2024-11-07 16:37:41 +01:00
Valerii
19c2481853
gh-126529: Update devguide links to relative filenames in InternalDocs (#126530)
Update devguide links to relative filenames in InternalDocs/parser.md
and InternalDocs/compiler.md.
2024-11-07 16:35:29 +01:00
Richard Hansen
e3510bd3dd
Doc: C API: Demote sections to subsections for consistency (#126535)
The entire file should be a single section; the headings below the
first heading should be subsections.
2024-11-07 16:29:31 +01:00
Mark Shannon
85036c8d61
GH-126222: Fix _PyUop_num_popped (GH-126507) 2024-11-07 10:48:27 +00:00
Petr Viktorin
c9cda1608e
gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)
If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.
2024-11-07 11:07:02 +01:00
Petr Viktorin
78ad7e6322
gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)
The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
2024-11-07 11:06:27 +01:00
Gregory P. Smith
1fe67df8e3
gh-48020: [docs] Remove the logging howto suggested future FileHandler multiprocessing support (GH-126531)
Docs: Remove the logging howto potential promise of multiprocessing support in the future.

Stick to the facts and suggestions, don't provide hope where we're not going to
implement complexity that we'd rather the user implement themselves when
needed.
2024-11-07 01:57:01 -08:00
Erlend E. Aasland
a5b94d0660
gh-96398: Improve accuracy of compiler checks in configure.ac (#117815)
The following variables are now used in compiler checks:
- $ac_cv_gcc_compat is set to 'yes' for GCC compatible compilers
  (the C preprocessor defines the __GNUC__ macro)
- for compiler basename checks, use $CC_BASENAME
  (may contain platform triplets)
- for the rest, use $ac_cv_cc_name
  (does not contain platform triplets)
2024-11-07 10:49:58 +01:00
Duprat
75f7cf91ec
gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (#125680) 2024-11-07 08:10:57 +00:00