Commit Graph

30097 Commits

Author SHA1 Message Date
Red4Ru 1e40c5ba47
gh-104745: Limit starting a patcher more than once without stopping it (#126649)
Previously, this would cause an `AttributeError` if the patch stopped more than once after this, and would also disrupt the original patched object.

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-13 08:20:38 +00:00
Andrew Svetlov 2e39d77dde
bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (#30196)
* Strip IsolatedAsyncioTestCase frames from reported stacktraces

* Update Misc/NEWS.d/next/Library/2021-12-19-10-47-24.bpo-46128.Qv3EK1.rst

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

---------

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-11-13 05:24:33 +01:00
Nice Zombies 4b00aba42e
gh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938) 2024-11-12 21:18:03 +00:00
Sam Gross 5610860840
gh-126688: Reinit import lock after fork (#126692)
The PyMutex implementation supports unlocking after fork because we
clear the list of waiters in parking_lot.c. This doesn't work as well
for _PyRecursiveMutex because on some systems, such as SerenityOS, the
thread id is not preserved across fork().
2024-11-12 15:53:58 -05:00
Barney Gale bf224bd7ce
GH-120423: `pathname2url()`: handle forward slashes in Windows paths (#126593)
Adjust `urllib.request.pathname2url()` so that forward slashes in Windows
paths are handled identically to backward slashes.
2024-11-12 19:52:30 +00:00
Serhiy Storchaka 7577307ebd
gh-116897: Deprecate generic false values in urllib.parse.parse_qsl() (GH-116903)
Accepting objects with false values (like 0 and []) except empty strings
and byte-like objects and None in urllib.parse functions parse_qsl() and
parse_qs() is now deprecated.
2024-11-12 21:10:29 +02:00
Bénédikt Tran 03924b5dee
gh-89083: add support for UUID version 8 (RFC 9562) (#123224)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-11-12 19:08:49 +01:00
Stephen Morton a83472f49b
gh-126705: Make os.PathLike more like a protocol (#126706)
it can now be used as a base class in other protocols
2024-11-12 17:54:13 +00:00
RUANG (James Roy) 8ff7efb46d
gh-126061: Add PyLong_IsPositive/Zero/Negative() functions (#126065)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-12 14:18:06 +01:00
Sayandip Dutta abb90ba46c
gh-125916: Allow functools.reduce() 'initial' to be a keyword argument (#125917) 2024-11-12 13:11:58 +00:00
Bénédikt Tran 6e3bb8a913
gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (#126617) 2024-11-12 14:10:10 +01:00
Daehee Kim 0ef84b0e2b
gh-126209: Fix inconsistency of `skip_file_prefixes` in `warnings.warn`'s C and Python implementations (GH-126329)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-11-12 13:01:56 +01:00
Stephen Morton feb3e0b19c
gh-126699: allow AsyncIterator to be used as a base for Protocols (#126702) 2024-11-12 09:17:07 +00:00
Sahil Prajapati 599bfc986d
gh-84852: Add MIME types for .eot, ,otf, .ttf, .woff and .woff2 fonts (#20199)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-11-12 08:48:38 +02:00
Diego Russo c45be8aa71
GH-126195: Use M1 JIT memory protection APIs (GH-126196) 2024-11-11 17:20:10 -08:00
Beomsoo Kim 494360afd0
gh-58749: Remove incorrect language spec claims about the global statement (GH-126523)
* Removes erroneous explanation of the `global` statement restrictions; a name declared as global can be subsequently bound using any kind of name binding operation.
* Updates `test_global.py` to also test various name-binding scenarios for global
variables to ensure correct behavior
2024-11-12 10:11:40 +10:00
Ned Batchelder 036930d844
Docs: re-create pages for removed modules to document their removal. (#126622)
Will also need to change the redirects that were created here:
https://github.com/python/psf-salt/pull/521/files
2024-11-11 17:49:48 -05:00
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
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
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
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
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
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
Steve Dower fd5580cd15
gh-126497: Add missing venv redirectors to freethreaded installer (GH-126556) 2024-11-08 16:09:34 +00:00
Xuanteng Huang 6ec886531f
gh-126072: Set docstring attribute for module and class (#126231) 2024-11-08 15:13:18 +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
Mark Shannon 85036c8d61
GH-126222: Fix `_PyUop_num_popped` (GH-126507) 2024-11-07 10:48:27 +00:00
Duprat 75f7cf91ec
gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (#125680) 2024-11-07 08:10:57 +00:00
Serhiy Storchaka dbb6e22cb1
gh-125926: Fix urllib.parse.urljoin() for base URI with undefined authority (GH-125989)
Although this goes beyond the application of RFC 3986, urljoin()
should support relative base URIs for backward compatibility.
2024-11-07 09:09:59 +02:00
Serhiy Storchaka 223d3dc554
gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler (GH-125752)
pickle.Pickler.persistent_id and pickle.Unpickler.persistent_load can
again be overridden as instance attributes.
2024-11-07 08:53:02 +02:00
Brett Cannon 2a6b6b33df
GH-126458: disable SIMD for HACL under WASI (#126512)
Requires an extra `-msimd128` flag and the `*mmintrin.h` header files are exclusive to x86-family CPUs.
2024-11-06 14:33:46 -08:00
Stephen Morton 5dc36dc565
gh-126451: Register contextvars.Context to collections.abc.Mapping (#126452)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-11-07 01:12:45 +03:00
Serhiy Storchaka 8fa4dc4ba8
gh-126489: Do not call persistent_id() for a persistent id in Python pickle (GH-126490) 2024-11-06 22:25:14 +02:00
blhsing 83ba8c2bba
gh-70764: inspect.getclosurevars now identifies global variables with LOAD_GLOBAL (#120143) 2024-11-05 15:53:54 -08:00
Steve Dower f51fd84034
gh-126074: Removes unnecessary DLLs from embeddable package (GH-126143) 2024-11-05 20:43:52 +00:00
Stephen Morton 78842e4a98
gh-126417: Register multiprocessing proxy types to an appropriate collections.abc class (#126419) 2024-11-05 15:35:45 +05:30
Peter Bierma 1371295e67
gh-126366: Fix crash if `__iter__` raises an exception during `yield from` (#126369) 2024-11-05 15:26:36 +05:30
Victor Stinner 4a0d574273
gh-120057: Add os.reload_environ() function (#126268)
Replace the os.environ.refresh() method with a new
os.reload_environ() function.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-11-05 08:43:34 +01:00
Serhiy Storchaka d3840503b0
gh-126303: Fix pickling and copying of os.sched_param objects (GH-126336) 2024-11-05 08:23:17 +02:00
Erlend E. Aasland 532fc08102
gh-89640: Hardcode WASM float word ordering as little endian (#126387) 2024-11-04 21:48:09 +01:00
Barney Gale 9b7294c3a5
GH-126363: Speed up pattern parsing in `pathlib.Path.glob()` (#126364)
The implementation of `Path.glob()` does rather a hacky thing: it calls
`self.with_segments()` to convert the given pattern to a `Path` object, and
then peeks at the private `_raw_path` attribute to see if pathlib removed a
trailing slash from the pattern.

In this patch, we make `glob()` use a new `_parse_pattern()` classmethod
that splits the pattern into parts while preserving information about any
trailing slash. This skips the cost of creating a `Path` object, and avoids
some path anchor normalization, which makes `Path.glob()` slightly faster.
But mostly it's about making the code less naughty.

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-11-04 19:29:57 +00:00
Nice Zombies 3032fcd90e
gh-119793: Add optional length-checking to `map()` (GH-120471)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2024-11-04 15:00:19 +01:00
Kumar Aditya fe5a6ab7be
gh-126353: remove implicit creation of loop from `asyncio.get_event_loop` (#126354)
Remove implicit creation of loop from `asyncio.get_event_loop`. This is a step forward of deprecating the policy system of asyncio.
2024-11-04 14:21:20 +05:30
Bénédikt Tran 19d9358437
gh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351) 2024-11-03 15:08:34 +00:00
Cody Maloney 556dc9b8a7
gh-113977, gh-120754: Remove unbounded reads from zipfile (GH-122101)
GH-113977, GH-120754: Remove unbounded reads from zipfile

Read without a size may read an unbounded amount of data + allocate
unbounded size buffers. Move to capped size reads to prevent potential
issues.

Co-authored-by: Daniel Hillier <daniel.hillier@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-11-02 22:28:51 -07:00
Cody Maloney 9ad57cf58b
gh-120754: Add a strace helper and test set of syscalls for open().read(), Take 2 (#123413) 2024-11-02 20:37:21 -07:00
Nico-Posada f032f6ba8f
gh-126138: Fix use-after-free in `_asyncio.Task` by evil `__getattribute__` (#126305)
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-11-02 13:16:00 +05:30
Sergey B Kirpichev 8477951a1c
gh-120026: soft deprecate Py_HUGE_VAL macro (#120027)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-11-01 22:04:31 +00:00
sobolevn 28b148fb32
gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (#126271)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-11-02 00:53:29 +03:00
Bénédikt Tran 464a7a91d0
gh-97850: remove ``find_loader`` and ``get_loader`` from ``pkgutil`` (#119656)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2024-11-01 18:35:22 +02:00
Erlend E. Aasland 43447cb634
gh-126206: make clinic now forcefully regenerates clinic code (#126244) 2024-11-01 08:17:54 +00:00
Barney Gale 260843df1b
GH-125413: Add `pathlib.Path.scandir()` method (#126060)
Add `pathlib.Path.scandir()` as a trivial wrapper of `os.scandir()`. This
will be used to implement several `PathBase` methods more efficiently,
including methods that provide `Path.copy()`.
2024-11-01 01:19:01 +00:00
J. Nick Koston dd3c0fa3fd
gh-126156: Improve performance of creating `Morsel` objects (#126157)
Replaces the manually constructed loop with a call to `dict.update`
2024-10-31 12:05:40 -07:00
Bénédikt Tran 0e8665554b
gh-126080: fix UAF on `task->task_context` in `task_call_step_soon` due to an evil `loop.__getattribute__` (#126120) 2024-10-31 10:14:47 -07:00
Peter Bierma 01415213d7
gh-126223: Propagate unicode errors in `_interpreters.create()` (#126224)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-31 17:14:37 +03:00
Sergey B Kirpichev 8c22eba877
gh-90370: Argument Clinic: avoid temporary tuple creation for varargs (#126064)
Avoid temporary tuple creation when all arguments either positional-only
or vararg.

Objects/setobject.c and Modules/gcmodule.c adapted. This fixes slight
performance regression for set methods, introduced by gh-115112.
2024-10-31 11:37:03 +01:00
Nico-Posada d07dcce693
gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (#126103) 2024-10-31 10:47:57 +03:00
Barney Gale 951cb2c369
GH-126205: Fix conversion of UNC paths to file URIs (#126208)
File URIs for Windows UNC paths should begin with two slashes, not four.
2024-10-30 22:56:58 +00:00
Johan Förberg 2b2d607095
gh-121267: Improve performance of tarfile (#121267) (#121269)
Tarfile in the default write mode spends much of its time resolving UIDs
into usernames and GIDs into group names. By caching these mappings, a
significant speedup can be achieved.

In my simple benchmark[1], this extra caching speeds up tarfile by 8x.

[1] https://gist.github.com/jforberg/86af759c796199740c31547ae828aef2

---------

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-10-30 15:08:30 -07:00
Steve Dower 60c415bd53
gh-125315: Avoid crashing in _wmimodule due to slow WMI calls on some Windows machines (GH-126141) 2024-10-30 19:59:51 +00:00
Savannah Ostrowski c29bbe2101
GH-125498: Update JIT builds to use LLVM 19 and preserve_none (GH-125499) 2024-10-30 12:03:31 -07:00
Furkan Onder 4f826214b3
gh-60712: Include the "object" type in the lists of documented types (GH-103036)
* add test for the predefined object's attributes

* Include the "object" type in the lists of documented types

* remove 'or' from augment tuple

* 📜🤖 Added by blurb_it.

* Add cross-reference to news

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Fix format for the function parameter

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Add space

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* add reference for the 'object'

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* add reference for NotImplemented

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Change ref:`string <textseq>`  as class:`str`

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* remove hyphen from `newly-created`

* Update Doc/reference/datamodel.rst

'dictionaries' to 'dict'

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Update predefined attribute types in testPredefinedAttrs

* Change `universal type` as `top type`

* Don't mention about the top type

* Update the description of richcmpfuncs

* Update Doc/library/stdtypes.rst

Co-authored-by: Éric <merwok@netwok.org>

* Revert: Hierarchy Section in Data Model Documentation

* Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity.

* Update Doc/reference/datamodel.rst

Co-authored-by: Éric <merwok@netwok.org>

* Remove blank line

Co-authored-by: Éric <merwok@netwok.org>

* Use ref:`str <textseq>` instead of :class:`str

Co-authored-by: Éric <merwok@netwok.org>

* Revert changes the description of Other Built-in Types in stdtypes.rst

* Update Doc/reference/datamodel.rst

Co-authored-by: Éric <merwok@netwok.org>

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-30 11:20:02 -07:00
Serhiy Storchaka cc9a183993
gh-126068: Fix exceptions in the argparse module (GH-126069)
* Only error messages for ArgumentError and ArgumentTypeError are now
  translated.
* ArgumentError is now only used for command line errors, not for logical
  errors in the program.
* TypeError is now raised instead of ValueError for some logical errors.
2024-10-30 18:14:27 +02:00
sobolevn 1f16df4bfe
gh-125669: Do not run `-ugui` tests by default on `make test` (#125730)
Adds `make ci` target for use in CI and keeping `make test` for the local development.
2024-10-30 17:14:22 +03:00
Sergey B Kirpichev dcad8fecbd
gh-125206: Correct detection of complex numbers support in libffi (#126104) 2024-10-30 10:12:39 +01:00
Xuanteng Huang 35df4eb959
gh-126072: do not add `None` to `co_consts` if there is no docstring (GH-126101) 2024-10-30 09:01:09 +00:00
Pablo Galindo Salgado 2d37c719ed
gh-124855: Don't allow the JIT and perf support to be active at the same time (#124856) 2024-10-30 00:12:45 +00:00
Brian Schubert 224c370a36
gh-126139: Improve error message location for future statement with unknown feature (#126140) 2024-10-29 23:57:59 +00:00
Pablo Galindo Salgado 9dfef4e5f4
gh-125588: Teach the python PEG generator the new f-string tokens (#125589)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-10-29 23:40:12 +00:00
Hood Chatham b1f13bce62
gh-124932: Distinguish build prefix from host prefix in cross builds (#124933)
In Emscripten and other cross builds, the build file system and the host file
system look different. For instance, we may want to install into
`cross-build/$TARGET/lib`, and then mount that as `/lib` in the host file
system. This change adds a distinction between:

* `prefix` -- the path in the build file system where we want to install the files
* `host_prefix` -- the path in the host file system where getpath.c will look for the files

And similarly for `exec_prefix` and `host_exec_prefix`. At present, this is only
used for Emscripten.
2024-10-30 05:45:49 +08:00
Christian Ullrich 802d405ff1
gh-126084: Fix venvwlauncher.exe to run pythonw.exe (GH-126088) 2024-10-29 19:52:52 +00:00
Tomas R. aab58a93ef
gh-118423: Add `INSTRUCTION_SIZE` macro to code generator (GH-125467) 2024-10-29 17:25:05 +00:00
sobolevn b2eaa75b17
gh-126105: Fix crash in `ast` module, when `._fields` is deleted (#126115)
Previously, if the `ast.AST._fields` attribute was deleted, attempts to create a new `as`t node would crash due to the assumption that `_fields` always had a non-NULL value. Now it has been fixed by adding an extra check to ensure that `_fields` does not have a NULL value (this can happen when you manually remove `_fields` attribute).
2024-10-29 17:42:48 +02:00
Mark Shannon faa3272fb8
GH-125837: Split `LOAD_CONST` into three. (GH-125972)
* Add LOAD_CONST_IMMORTAL opcode

* Add LOAD_SMALL_INT opcode

* Remove RETURN_CONST opcode
2024-10-29 11:15:42 +00:00
sobolevn a64a1c9206
gh-126106: Fix `NULL` possible derefrence in `Modules/_ssl.c` (#126111)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-29 12:03:18 +03:00
Hood Chatham dc2552d429
gh-124928: Emscripten node support: Clean up old node <= 16 flags (#124929)
Clean up configure flags for old node versions

These flags are only needed for node <= 16. Node 16 has been end of life since
October of 2023.
2024-10-29 06:28:54 +00:00
Hugo van Kemenade dcda92f8fc
Pre-commit: prevent spaces in news entry paths (#126063) 2024-10-28 23:04:10 +02:00
Bénédikt Tran ed5059eeb1
gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (#125967) 2024-10-27 22:40:10 +05:30
Tomas R. 0922a4ae0d
gh-124295: Add translation tests for argparse (GH-124803) 2024-10-27 18:52:31 +02:00
Bénédikt Tran f819d4301d
gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (#126003) 2024-10-27 20:34:43 +05:30
devdanzin 80eec52fc8
gh-126018: Avoid aborting due to unnecessary assert in `sys.audit` (#126020)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-27 07:41:42 -07:00
Brian Schubert dc76a4ad3c
gh-126012: Add `__class_getitem__` to `memoryview` (#126013)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-27 13:36:03 +03:00
Zhikang Yan dad3453129
gh-125633: Add function `ispackage` to stdlib `inspect` (#125634)
---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-10-27 14:57:43 +10:00
devdanzin 44becb8cba
gh-125666: Avoid PyREPL exiting when a null byte is in input (#125732) 2024-10-27 01:23:53 +00:00
Bogdan Romanyuk 51b012b2a8
gh-125593: Use colors to highlight error locations in tracebacks from exception group (#125681) 2024-10-27 01:57:10 +01:00
Erlend E. Aasland 26d627779f
gh-89640: properly detect float word ordering on Linux (#125571)
autoconf-archive patch by Dan Amelang.
2024-10-26 15:46:46 +00:00
Bénédikt Tran c5b99f5c2c
gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (#125970)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-25 23:45:09 +05:30
Kumar Aditya cae853e3b4
GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922)
Fix `asyncio.Future._callbacks` to always return a copy of the internal list of callbacks to avoid mutation from user code affecting the internal state.
2024-10-25 18:19:30 +05:30
Victor Stinner db96327203
gh-121654: Add PyType_Freeze() function (#122457)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-25 11:12:48 +02:00
Malcolm Smith 371c537dff
Increase minimum Android API level to 24 (#125946)
Minimum Android API level has been increased to 24 (Android 7.0).
2024-10-25 08:41:07 +08:00
Malcolm Smith b08570c90e
gh-125942: Android: set stdout to `errors="backslashreplace"` (#125943)
Android stdout/err streams now use `backslashreplace` encoding to ensure readability of the Android log.
2024-10-25 08:35:41 +08:00
Malcolm Smith e68d4b08ff
gh-125940: Android: support 16 KB pages (#125941)
Modify Android build tooling to use 16kB pages.
2024-10-25 07:51:16 +08:00
Sam Gross fed501d724
gh-125245: Fix race condition when importing `collections.abc` (#125415)
If multiple threads concurrently imported `collections.abc`, some of the
threads might incorrectly see the "shim" `Lib/collections/abc.py` module
instead of the correct `Lib/_collections_abc.py` module.  This affected
both the free threading build and the default GIL-enabled build.
2024-10-24 18:12:51 -04:00
Shantanu 500f5338a8
gh-123930: Better error for "from imports" when script shadows module (#123929) 2024-10-24 12:11:12 -07:00
Javad Shafique 3f24bde0b6
gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (#118960)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-10-24 17:41:16 +00:00
Sam Gross ad6110a93f
gh-125842: Fix `sys.exit(0xffff_ffff)` on Windows (#125896)
On Windows, `long` is a signed 32-bit integer so it can't represent
`0xffff_ffff` without overflow. Windows exit codes are unsigned 32-bit
integers, so if a child process exits with `-1`, it will be represented
as `0xffff_ffff`.

Also fix a number of other possible cases where `_Py_HandleSystemExit`
could return with an exception set, leading to a `SystemError` (or
fatal error in debug builds) later on during shutdown.
2024-10-24 12:03:50 -04:00