]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoGH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426)
Raymond Hettinger [Fri, 23 Dec 2022 22:35:58 +0000 (14:35 -0800)] 
GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426)

2 years agobpo-40447: accept all path-like objects in compileall.compile_file (#19883)
Filipe Laíns [Fri, 23 Dec 2022 20:19:16 +0000 (20:19 +0000)] 
bpo-40447: accept all path-like objects in compileall.compile_file (#19883)

Signed-off-by: Filipe Laíns <lains@archlinux.org>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)
Nikita Sobolev [Fri, 23 Dec 2022 20:17:24 +0000 (23:17 +0300)] 
gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)

2 years agogh-83076: 3.8x speed improvement in (Async)Mock instantiation (#100252)
Carl Meyer [Fri, 23 Dec 2022 19:41:37 +0000 (12:41 -0700)] 
gh-83076: 3.8x speed improvement in (Async)Mock instantiation (#100252)

2 years agogh-94155: Reduce hash collisions for code objects (#100183)
Dennis Sweeney [Fri, 23 Dec 2022 18:15:47 +0000 (13:15 -0500)] 
gh-94155: Reduce hash collisions for code objects (#100183)

* Uses a better hashing algorithm to get better dispersion and remove commutativity.

* Incorporates `co_firstlineno`, `Py_SIZE(co)`, and bytecode instructions.

* This is now the entire set of criteria used in `code_richcompare`, except for `_PyCode_ConstantKey` (which would incorporate the types of `co_consts` rather than just their values).

2 years agoRevert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289...
Ken Jin [Fri, 23 Dec 2022 17:48:43 +0000 (01:48 +0800)] 
Revert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)" (#100468)

This reverts commit c3c7848a48b74a321632202e4bdcf2f465fb1cc6.

2 years agogh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)
Ken Jin [Fri, 23 Dec 2022 16:26:42 +0000 (00:26 +0800)] 
gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)

2 years agogh-92216: improve performance of `hasattr` for type objects (GH-99979)
Pieter Eendebak [Fri, 23 Dec 2022 15:23:36 +0000 (16:23 +0100)] 
gh-92216: improve performance of `hasattr` for type objects (GH-99979)

2 years agogh-98712: Clarify "readonly bytes-like object" semantics in C arg-parsing docs (...
Petr Viktorin [Fri, 23 Dec 2022 15:00:21 +0000 (16:00 +0100)] 
gh-98712: Clarify "readonly bytes-like object" semantics in C arg-parsing docs (#98710)

2 years agogh-99110: Initialize `frame->previous` in init_frame to fix segmentation fault when...
Bill Fisher [Fri, 23 Dec 2022 14:45:53 +0000 (07:45 -0700)] 
gh-99110: Initialize `frame->previous` in init_frame to fix segmentation fault when accessing `frame.f_back` (#100182)

2 years agoGH-100459: fix copy-paste errors in specialization stats (GH-100460)
Irit Katriel [Fri, 23 Dec 2022 14:42:24 +0000 (14:42 +0000)] 
GH-100459: fix copy-paste errors in specialization stats (GH-100460)

2 years agogh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576)
Eric Wieser [Fri, 23 Dec 2022 08:23:19 +0000 (08:23 +0000)] 
gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576)

The itemsize returned in a memoryview of a ctypes array is now computed from the item type, instead of dividing the total size by the length and assuming that the length is not zero.

2 years agoFix typo in 3.12 What's New (#100449)
Shantanu [Fri, 23 Dec 2022 06:22:31 +0000 (00:22 -0600)] 
Fix typo in 3.12 What's New (#100449)

2 years agogh-48496: Added example and link to faq for UnboundLocalError in reference (#93068)
Stanley [Thu, 22 Dec 2022 23:23:25 +0000 (15:23 -0800)] 
gh-48496: Added example and link to faq for UnboundLocalError in reference (#93068)

2 years agogh-57762: fix misleading tkinter.Tk docstring (#98837)
Shantanu [Thu, 22 Dec 2022 22:35:32 +0000 (16:35 -0600)] 
gh-57762: fix misleading tkinter.Tk docstring (#98837)

Mentioned as a desired change by terryjreedy on the corresponding issue,
since Tk is not a subclass of Toplevel.

2 years agogh-85432: Harmonise parameter names between C and pure-Python implementations of...
Alex Waygood [Thu, 22 Dec 2022 21:57:18 +0000 (21:57 +0000)] 
gh-85432: Harmonise parameter names between C and pure-Python implementations of `datetime.time.strftime`, `datetime.datetime.fromtimestamp` (#99993)

2 years agoGH-99554: Trim trailing whitespace (GH-100435)
Brandt Bucher [Thu, 22 Dec 2022 20:13:51 +0000 (12:13 -0800)] 
GH-99554: Trim trailing whitespace (GH-100435)

Automerge-Triggered-By: GH:brandtbucher
2 years agogh-100344: Add C implementation for `asyncio.current_task` (#100345)
Itamar Ostricher [Thu, 22 Dec 2022 13:38:12 +0000 (15:38 +0200)] 
gh-100344: Add C implementation for `asyncio.current_task` (#100345)

Co-authored-by: pranavtbhat
2 years agogh-78997: fix bad rebase of moved test file (#100424)
Eli Schwartz [Thu, 22 Dec 2022 13:28:25 +0000 (08:28 -0500)] 
gh-78997: fix bad rebase of moved test file (#100424)

2 years agoGH-99770: Make the correct call specialization fail kind show up in the stats (GH...
penguin_wwy [Thu, 22 Dec 2022 12:44:59 +0000 (20:44 +0800)] 
GH-99770: Make the correct call specialization fail kind show up in the stats (GH-99771)

2 years agogh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for single digit...
Pieter Eendebak [Thu, 22 Dec 2022 11:30:18 +0000 (12:30 +0100)] 
gh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for single digit integers  (#100064)

2 years agoCorrect typo in typing.py (#100423)
david-why [Thu, 22 Dec 2022 11:20:52 +0000 (19:20 +0800)] 
Correct typo in typing.py (#100423)

In the docstring of `ParamSpec`, the name of `P = ParamSpec('P')` was
mistakenly written as `'T'`.

2 years agoGH-99554: Pack location tables more effectively (GH-99556)
Brandt Bucher [Thu, 22 Dec 2022 00:41:18 +0000 (16:41 -0800)] 
GH-99554: Pack location tables more effectively (GH-99556)

2 years agoGH-69564: Clarify use of octal format of mode argument in help(os.chmod) (#20621)
amaajemyfren [Wed, 21 Dec 2022 17:48:25 +0000 (20:48 +0300)] 
GH-69564: Clarify use of octal format of mode argument in help(os.chmod) (#20621)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-78878: Fix crash when creating an instance of `_ctypes.CField` (#14837)
Hai Shi [Wed, 21 Dec 2022 17:31:17 +0000 (01:31 +0800)] 
gh-78878: Fix crash when creating an instance of `_ctypes.CField` (#14837)

2 years agoRemove unused variable from `dis._find_imports` (#100396)
Nikita Sobolev [Wed, 21 Dec 2022 16:55:02 +0000 (19:55 +0300)] 
Remove unused variable from `dis._find_imports` (#100396)

2 years agogh-100129: Add tests for pickling all builtin types and functions (GH-100142)
Serhiy Storchaka [Wed, 21 Dec 2022 14:31:22 +0000 (16:31 +0200)] 
gh-100129: Add tests for pickling all builtin types and functions (GH-100142)

2 years agogh-100374: Fixed a bug in socket.getfqdn() (gh-100375)
Dominic Socular [Wed, 21 Dec 2022 13:25:04 +0000 (21:25 +0800)] 
gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)

2 years agoGH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output (#100154)
Kumar Aditya [Wed, 21 Dec 2022 09:50:26 +0000 (15:20 +0530)] 
GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output (#100154)

2 years agoGH-100363: Speed up `asyncio.get_running_loop` (#100364)
Kumar Aditya [Wed, 21 Dec 2022 09:49:44 +0000 (15:19 +0530)] 
GH-100363: Speed up `asyncio.get_running_loop` (#100364)

2 years agogh-85267: Improvements to inspect.signature __text_signature__ handling (#98796)
Shantanu [Wed, 21 Dec 2022 03:29:02 +0000 (21:29 -0600)] 
gh-85267: Improvements to inspect.signature __text_signature__ handling (#98796)

This makes a couple related changes to inspect.signature's behaviour
when parsing a signature from `__text_signature__`.

First, `inspect.signature` is documented as only raising ValueError or
TypeError. However, in some cases, we could raise RuntimeError.  This PR
changes that, thereby fixing #83685.

(Note that the new ValueErrors in RewriteSymbolics are caught and then
reraised with a message)

Second, `inspect.signature` could randomly drop parameters that it
didn't understand (corresponding to `return None` in the `p` function).
This is the core issue in #85267. I think this is very surprising
behaviour and it seems better to fail outright.

Third, adding this new failure broke a couple tests. To fix them (and to
e.g. allow `inspect.signature(select.epoll.register)` as in #85267), I
add constant folding of a couple binary operations to RewriteSymbolics.

(There's some discussion of making signature expression evaluation
arbitrary powerful in #68155. I think that's out of scope. The
additional constant folding here is pretty straightforward, useful, and
not much of a slippery slope)

Fourth, while #85267 is incorrect about the cause of the issue, it turns
out if you had consecutive newlines in __text_signature__, you'd get
`tokenize.TokenError`.

Finally, the `if name is invalid:` code path was dead, since
`parse_name` never returned `invalid`.

2 years agogh-91081: Add note on WeakKeyDictionary behavior when deleting a replaced entry ...
Stanley [Wed, 21 Dec 2022 03:27:02 +0000 (19:27 -0800)] 
gh-91081: Add note on WeakKeyDictionary behavior when deleting a replaced entry (#91499)

Co-authored-by: Pieter Eendebak <P.T.eendebak@tudelft.nl>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-99991: improve docs on str.encode and bytes.decode (#100198)
Bisola Olasehinde [Wed, 21 Dec 2022 02:02:14 +0000 (02:02 +0000)] 
gh-99991: improve docs on str.encode and bytes.decode (#100198)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agogh-100188: Reduce misses in BINARY_SUBSCR_(LIST/TUPLE)_INT (#100189)
Dennis Sweeney [Tue, 20 Dec 2022 20:46:16 +0000 (15:46 -0500)] 
gh-100188: Reduce misses in BINARY_SUBSCR_(LIST/TUPLE)_INT (#100189)

Don't specialize if the index is negative.

2 years agogh-99576: Fix cookiejar file that was not truncated for some classes (GH-99616)
Nikita Sobolev [Tue, 20 Dec 2022 16:51:26 +0000 (19:51 +0300)] 
gh-99576: Fix cookiejar file that was not truncated for some classes (GH-99616)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agoClarify that every thread has its own default context in contextvars (#99246)
Pablo Galindo Salgado [Tue, 20 Dec 2022 11:35:48 +0000 (11:35 +0000)] 
Clarify that every thread has its own default context in contextvars (#99246)

2 years agogh-99925: Fix inconsistency in `json.dumps()` error messages (GH-99926)
František Nesveda [Tue, 20 Dec 2022 10:54:56 +0000 (10:54 +0000)] 
gh-99925: Fix inconsistency in `json.dumps()` error messages (GH-99926)

2 years agogh-100348: Fix ref cycle in `asyncio._SelectorSocketTransport` with `_read_ready_cb...
Richard Kojedzinszky [Tue, 20 Dec 2022 10:40:56 +0000 (11:40 +0100)] 
gh-100348: Fix ref cycle in `asyncio._SelectorSocketTransport` with `_read_ready_cb` (#100349)

2 years agogh-88211: Change lower-case and upper-case to match recommendations in imaplib docs...
Brad Wolfe [Tue, 20 Dec 2022 10:10:31 +0000 (11:10 +0100)] 
gh-88211: Change lower-case and upper-case to match recommendations in imaplib docs (#99625)

2 years agogh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)
Thomas Grainger [Tue, 20 Dec 2022 07:10:30 +0000 (07:10 +0000)] 
gh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Fixes https://github.com/python/cpython/issues/89051

2 years agogh-69929: re docs: Add more specific definition of \w (#92015)
Stanley [Tue, 20 Dec 2022 03:07:31 +0000 (19:07 -0800)] 
gh-69929: re docs: Add more specific definition of \w (#92015)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-89727: Fix os.walk RecursionError on deep trees (#99803)
Jon Burdo [Mon, 19 Dec 2022 18:59:01 +0000 (13:59 -0500)] 
gh-89727: Fix os.walk RecursionError on deep trees (#99803)

Use a stack to implement os.walk iteratively instead of recursively to
avoid hitting recursion limits on deeply nested trees.

2 years agoDocs: Don't upload CI artifacts (#100330)
Hugo van Kemenade [Mon, 19 Dec 2022 08:40:11 +0000 (10:40 +0200)] 
Docs: Don't upload CI artifacts (#100330)

2 years agogh-94912: Added marker for non-standard coroutine function detection (#99247)
Carlton Gibson [Sun, 18 Dec 2022 19:13:24 +0000 (20:13 +0100)] 
gh-94912: Added marker for non-standard coroutine function detection (#99247)

This introduces a new decorator `@inspect.markcoroutinefunction`,
which, applied to a sync function, makes it appear async to
`inspect.iscoroutinefunction()`.

2 years agoCorrect CVE-2020-10735 documentation (#100306)
Jeremy Paige [Sun, 18 Dec 2022 07:11:21 +0000 (23:11 -0800)] 
Correct CVE-2020-10735 documentation (#100306)

2 years agogh-100272: Fix JSON serialization of OrderedDict (GH-100273)
Serhiy Storchaka [Sat, 17 Dec 2022 12:32:48 +0000 (14:32 +0200)] 
gh-100272: Fix JSON serialization of OrderedDict (GH-100273)

It now preserves the order of keys.

2 years agogh-93649: Split tracemalloc tests from _testcapimodule.c (#99551)
Erlend E. Aasland [Sat, 17 Dec 2022 08:53:36 +0000 (09:53 +0100)] 
gh-93649: Split tracemalloc tests from _testcapimodule.c (#99551)

2 years agoDocs: Use `PY_VERSION_HEX` for version comparison (#100179)
Hugo van Kemenade [Sat, 17 Dec 2022 07:42:18 +0000 (09:42 +0200)] 
Docs: Use `PY_VERSION_HEX` for version comparison (#100179)

2 years agogh-97909: Fix markup for `PyMethodDef` members (#100089)
ram vikram singh [Sat, 17 Dec 2022 07:12:39 +0000 (12:42 +0530)] 
gh-97909: Fix markup for `PyMethodDef` members (#100089)

2 years agogh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing...
colorfulappl [Sat, 17 Dec 2022 06:40:51 +0000 (14:40 +0800)] 
gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (#99890)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing...
colorfulappl [Sat, 17 Dec 2022 06:37:44 +0000 (14:37 +0800)] 
gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (#99890)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agoGH-98831: Add DECREF_INPUTS(), expanding to DECREF() each stack input (#100205)
Guido van Rossum [Sat, 17 Dec 2022 04:45:55 +0000 (20:45 -0800)] 
GH-98831: Add DECREF_INPUTS(), expanding to DECREF() each stack input (#100205)

The presence of this macro indicates that a particular instruction
may be considered for conversion to a register-based format
(see https://github.com/faster-cpython/ideas/issues/485).

An invariant (currently unchecked) is that `DEOPT_IF()` may only
occur *before* `DECREF_INPUTS()`, and `ERROR_IF()` may only occur
*after* it. One reason not to check this is that there are a few
places where we insert *two* `DECREF_INPUTS()` calls, in different
branches of the code. The invariant checking would have to be able
to do some flow control analysis to understand this.

Note that many instructions, especially specialized ones,
can't be converted to use this macro straightforwardly.
This is because the generator currently only generates plain
`Py_DECREF(variable)` statements, and cannot generate
things like `_Py_DECREF_SPECIALIZED()` let alone deal with
`_PyList_AppendTakeRef()`.

2 years agogh-78707: deprecate passing >1 argument to `PurePath.[is_]relative_to()` (GH-94469)
Barney Gale [Sat, 17 Dec 2022 00:14:27 +0000 (00:14 +0000)] 
gh-78707: deprecate passing >1 argument to `PurePath.[is_]relative_to()` (GH-94469)

This brings `relative_to()` and `is_relative_to()` more in line with other pathlib methods like `rename()` and `symlink_to()`.

Resolves #78707.

2 years agogh-99540: Constant hash for _PyNone_Type to aid reproducibility (GH-99541)
yonillasky [Fri, 16 Dec 2022 20:36:13 +0000 (22:36 +0200)] 
gh-99540: Constant hash for _PyNone_Type to aid reproducibility (GH-99541)

Needed for ASLR builds of Python.

2 years agogh-100039: enhance __signature__ to work with str and callables (GH-100168)
Ethan Furman [Fri, 16 Dec 2022 20:30:47 +0000 (12:30 -0800)] 
gh-100039: enhance __signature__ to work with str and callables (GH-100168)

Callables should be either class- or static-methods.
Enum now uses the classmethod version to greatly improve the help
given for enums and flags.

2 years agogh-99830: asyncio: Document returns of remove_{reader,writer} (#100302)
Ben Darnell [Fri, 16 Dec 2022 19:04:55 +0000 (14:04 -0500)] 
gh-99830: asyncio: Document returns of remove_{reader,writer} (#100302)

2 years ago"Compound statement" docs: Fix with-statement step indexing (#100286)
Frank Dana [Fri, 16 Dec 2022 18:43:43 +0000 (13:43 -0500)] 
"Compound statement" docs: Fix with-statement step indexing (#100286)

Back in commit 226e6e7d4326cf91ef37e13528eb1f62de1bb832
an item was added to the list, renumbering all the rest of the
items, but the forward-reference wasn't updated to match.

2 years agoGH-90043: Handle NaNs in COMPARE_OP_FLOAT_JUMP (GH-100278)
Brandt Bucher [Fri, 16 Dec 2022 18:18:31 +0000 (10:18 -0800)] 
GH-90043: Handle NaNs in COMPARE_OP_FLOAT_JUMP (GH-100278)

2 years agoImprove stats presentation for calls. (GH-100274)
Mark Shannon [Fri, 16 Dec 2022 15:43:04 +0000 (15:43 +0000)] 
Improve stats presentation for calls. (GH-100274)

2 years agoBetter stats for `LOAD_ATTR` and `STORE_ATTR` (GH-100295)
Mark Shannon [Fri, 16 Dec 2022 15:41:23 +0000 (15:41 +0000)] 
Better stats for `LOAD_ATTR` and `STORE_ATTR` (GH-100295)

* Don't attempt to specialize for LOAD_ATTR on instance if class has attribute

* Improvement to LOAD_ATTR and STORE_ATTR specialization stats.

2 years agogh-81057: Move the Cached Parser Dummy Name to _PyRuntimeState (#100277)
Eric Snow [Fri, 16 Dec 2022 13:48:03 +0000 (06:48 -0700)] 
gh-81057: Move the Cached Parser Dummy Name to _PyRuntimeState (#100277)

2 years agoDocument that zipfile's pwd parameter is a `bytes` object (#100209)
JustAnotherArchivist [Fri, 16 Dec 2022 10:40:10 +0000 (10:40 +0000)] 
Document that zipfile's pwd parameter is a `bytes` object (#100209)

2 years agogh-99767: mark `PyTypeObject.tp_watched` as internal use only in table (#100271)
Carl Meyer [Fri, 16 Dec 2022 10:32:09 +0000 (03:32 -0700)] 
gh-99767: mark `PyTypeObject.tp_watched` as internal use only in table (#100271)

2 years agoFix typo in introduction.rst (#100266)
Mikhail Berkov [Fri, 16 Dec 2022 10:26:30 +0000 (11:26 +0100)] 
Fix typo in introduction.rst (#100266)

2 years agogh-78997: AttributeError if loading fails in LibraryLoader.__getattr__
Ateeq Sharfuddin [Thu, 15 Dec 2022 22:59:37 +0000 (17:59 -0500)] 
gh-78997: AttributeError if loading fails in LibraryLoader.__getattr__

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
2 years agoGH-100234: Set a default value for random.expovariate() (GH-100235)
Raymond Hettinger [Thu, 15 Dec 2022 18:40:45 +0000 (20:40 +0200)] 
GH-100234: Set a default value for random.expovariate() (GH-100235)

2 years agoRemove uninformative itertools recipe (GH-100253)
Raymond Hettinger [Thu, 15 Dec 2022 18:39:01 +0000 (20:39 +0200)] 
Remove uninformative itertools recipe (GH-100253)

2 years agoGH-99767: update PyTypeObject docs for type watchers (GH-99928)
Carl Meyer [Thu, 15 Dec 2022 11:26:08 +0000 (04:26 -0700)] 
GH-99767: update PyTypeObject docs for type watchers (GH-99928)

2 years agoMove stats for the method cache into the `Py_STAT` machinery (GH-100255)
Mark Shannon [Thu, 15 Dec 2022 09:45:03 +0000 (09:45 +0000)] 
Move stats for the method cache into the `Py_STAT` machinery (GH-100255)

2 years agoGH-100222: fix typo _py_set_opocde -> _py_set_opcode (GH-100259)
Carl Meyer [Thu, 15 Dec 2022 00:39:00 +0000 (17:39 -0700)] 
GH-100222: fix typo _py_set_opocde -> _py_set_opcode (GH-100259)

Typo introduced in #100223.

Automerge-Triggered-By: GH:brandtbucher
2 years agoGH-100000: Cleanup and polish various watchers code (GH-99998)
Itamar Ostricher [Wed, 14 Dec 2022 19:14:16 +0000 (11:14 -0800)] 
GH-100000: Cleanup and polish various watchers code (GH-99998)

* Initialize `type_watchers` array to `NULL`s
* Optimize code watchers notification
* Optimize func watchers notification

2 years agogh-90111: Minor Cleanup for Runtime-Global Objects (gh-100254)
Eric Snow [Wed, 14 Dec 2022 18:53:57 +0000 (11:53 -0700)] 
gh-90111: Minor Cleanup for Runtime-Global Objects (gh-100254)

* move _PyRuntime.global_objects.interned to _PyRuntime.cached_objects.interned_strings (and use _Py_CACHED_OBJECT())
* rename _PyRuntime.global_objects to _PyRuntime.static_objects

(This also relates to gh-96075.)

https://github.com/python/cpython/issues/90111

2 years agogh-100248: Add missing `ssl_shutdown_timeout` parameter in `asyncio` docs (#100249)
busywhitespace [Wed, 14 Dec 2022 16:57:02 +0000 (17:57 +0100)] 
gh-100248: Add missing `ssl_shutdown_timeout` parameter in `asyncio` docs (#100249)

2 years agoAssorted minor fixes for specialization stats. (GH-100219)
Mark Shannon [Wed, 14 Dec 2022 15:50:02 +0000 (15:50 +0000)] 
Assorted minor fixes for specialization stats. (GH-100219)

2 years agogh-100176: venv: Remove redundant compat code for Python <= 3.2 (#100177)
Hugo van Kemenade [Wed, 14 Dec 2022 11:37:11 +0000 (13:37 +0200)] 
gh-100176: venv: Remove redundant compat code for Python <= 3.2 (#100177)

gh-100176: Remove redundant compat code for Python 3.2 and older

Python 3.2 has been EOL since 2016-02-20 and 2.7 since 2020-01-01, so we
can remove this old compatibility check and unindent the old else-block.

Also, in the unindented block, replace a .format() call with an f-string.

Plus similar changes in the documentation.

2 years agoGH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code unit. (GH...
Mark Shannon [Wed, 14 Dec 2022 11:12:53 +0000 (11:12 +0000)] 
GH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code unit. (GH-100223)

2 years agogh-99955: undef ERROR and SUCCESS before redefining (fixes sanitizer warning) (#100215)
Irit Katriel [Tue, 13 Dec 2022 13:55:10 +0000 (13:55 +0000)] 
gh-99955: undef ERROR and SUCCESS before redefining (fixes sanitizer warning) (#100215)

2 years agoGH-100206: use versionadded for the addition of sysconfig.get_default_scheme (#100207)
Filipe Laíns [Tue, 13 Dec 2022 10:54:07 +0000 (10:54 +0000)] 
GH-100206: use versionadded for the addition of sysconfig.get_default_scheme (#100207)

2 years agogh-81057: Move _Py_RefTotal to the "Ignored Globals" List (gh-100203)
Eric Snow [Mon, 12 Dec 2022 23:51:27 +0000 (16:51 -0700)] 
gh-81057: Move _Py_RefTotal to the "Ignored Globals" List (gh-100203)

We can't move it to _PyRuntimeState because the symbol is exposed in the stable ABI. We'll have to sort that out before a per-interpreter GIL, but it shouldn't be too hard.

https://github.com/python/cpython/issues/81057

2 years agogh-81057: Move Signal-Related Globals to _PyRuntimeState (gh-100085)
Eric Snow [Mon, 12 Dec 2022 23:50:19 +0000 (16:50 -0700)] 
gh-81057: Move Signal-Related Globals to _PyRuntimeState (gh-100085)

https://github.com/python/cpython/issues/81057

2 years agogh-81057: Move faulthandler Globals to _PyRuntimeState (gh-100152)
Eric Snow [Mon, 12 Dec 2022 16:58:46 +0000 (09:58 -0700)] 
gh-81057: Move faulthandler Globals to _PyRuntimeState (gh-100152)

https://github.com/python/cpython/issues/81057

2 years agogh-81057: Move tracemalloc Globals to _PyRuntimeState (gh-100151)
Eric Snow [Mon, 12 Dec 2022 15:44:23 +0000 (08:44 -0700)] 
gh-81057: Move tracemalloc Globals to _PyRuntimeState (gh-100151)

https://github.com/python/cpython/issues/81057

2 years agoGH-100143: Improve collecting pystats for parts of runs (GH-100144)
Michael Droettboom [Mon, 12 Dec 2022 14:50:43 +0000 (09:50 -0500)] 
GH-100143: Improve collecting pystats for parts of runs (GH-100144)

* pystats off by default

* Add -Xpystats flag

* Always dump pystats, even if turned off

2 years agogh-99955: standardize return values of functions in compiler's code-gen (#100010)
Irit Katriel [Mon, 12 Dec 2022 14:22:15 +0000 (14:22 +0000)] 
gh-99955: standardize return values of functions in compiler's code-gen (#100010)

2 years agogh-79218: Define `MS_WIN64` macro for Mingw-w64 64bit on Windows (GH-100137)
GalaxySnail [Mon, 12 Dec 2022 13:39:23 +0000 (21:39 +0800)] 
gh-79218: Define `MS_WIN64` macro for Mingw-w64 64bit on Windows (GH-100137)

2 years agoFix: typo (Indention) (GH-99904)
jarrodcolburn [Mon, 12 Dec 2022 12:25:22 +0000 (06:25 -0600)] 
Fix: typo (Indention) (GH-99904)

Example needed to be indented. Was trying to call a context manger `pr` (from ` with cProfile.Profile() as pr:`) wot perform ` pr.print_stats()` once it had already exited.

Automerge-Triggered-By: GH:AlexWaygood
2 years agogh-96715 Remove redundant NULL check in `profile_trampoline` function (#96716)
chgnrdv [Mon, 12 Dec 2022 11:59:27 +0000 (14:59 +0300)] 
gh-96715 Remove redundant NULL check in `profile_trampoline` function (#96716)

Closes #96715

2 years agogh-100176: remove incorrect version compatibility check from argument clinic (#100190)
Shantanu [Mon, 12 Dec 2022 11:52:12 +0000 (03:52 -0800)] 
gh-100176: remove incorrect version compatibility check from argument clinic (#100190)

2 years agoclarify the 4300-digit limit on int-str conversion (#100175)
Ned Batchelder [Mon, 12 Dec 2022 11:39:54 +0000 (03:39 -0800)] 
clarify the 4300-digit limit on int-str conversion (#100175)

2 years agogh-70393: Clarify mention of "middle" scope (#98839)
Shantanu [Mon, 12 Dec 2022 04:15:55 +0000 (20:15 -0800)] 
gh-70393: Clarify mention of "middle" scope (#98839)

2 years agogh-99688: Fix outdated tests in test_unary (#99712)
Yesung(Isaac) Lee [Sun, 11 Dec 2022 23:44:29 +0000 (08:44 +0900)] 
gh-99688: Fix outdated tests in test_unary (#99712)

* Remove duplicates from "L" suffix removal
* test_invert now tests `~`.

2 years agogh-100174: [Enum] Correct PowersOfThree example. (GH-100178)
Beweeted [Sun, 11 Dec 2022 23:20:59 +0000 (15:20 -0800)] 
gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)

Changed from multiples of 3 to powers of 3 to match the class name.

2 years agogh-88500: Reduce memory use of `urllib.unquote` (#96763)
Gregory P. Smith [Sun, 11 Dec 2022 00:17:39 +0000 (16:17 -0800)] 
gh-88500: Reduce memory use of `urllib.unquote` (#96763)

`urllib.unquote_to_bytes` and `urllib.unquote` could both potentially generate `O(len(string))` intermediate `bytes` or `str` objects while computing the unquoted final result depending on the input provided. As Python objects are relatively large, this could consume a lot of ram.

This switches the implementation to using an expanding `bytearray` and a generator internally instead of precomputed `split()` style operations.

Microbenchmarks with some antagonistic inputs like `mess = "\u0141%%%20a%fe"*1000` show this is 10-20% slower for unquote and unquote_to_bytes and no different for typical inputs that are short or lack much unicode or % escaping. But the functions are already quite fast anyways so not a big deal.  The slowdown scales consistently linear with input size as expected.

Memory usage observed manually using `/usr/bin/time -v` on `python -m timeit` runs of larger inputs. Unittesting memory consumption is difficult and does not seem worthwhile.

Observed memory usage is ~1/2 for `unquote()` and <1/3 for `unquote_to_bytes()` using `python -m timeit -s 'from urllib.parse import unquote, unquote_to_bytes; v="\u0141%01\u0161%20"*500_000' 'unquote_to_bytes(v)'` as a test.

2 years agogh-99941: Ensure that asyncio.Protocol.data_received receives immutable bytes (#100053)
DarioDaF [Sat, 10 Dec 2022 23:07:02 +0000 (00:07 +0100)] 
gh-99941: Ensure that asyncio.Protocol.data_received receives immutable bytes (#100053)

2 years agogh-99728: correct typo in `datetime` format codes documentation (#99750)
Brad Wolfe [Sat, 10 Dec 2022 10:20:18 +0000 (11:20 +0100)] 
gh-99728: correct typo in `datetime` format codes documentation (#99750)

2 years agogh-99970 Adding missing `optionflags` parameter in the documentation of `doctest...
busywhitespace [Sat, 10 Dec 2022 10:12:40 +0000 (11:12 +0100)] 
gh-99970 Adding missing `optionflags` parameter in the documentation of `doctest` (#99971)

2 years agoFix potential flakiness in `test_run_until_complete_baseexception` (#100148)
Fantix King [Sat, 10 Dec 2022 10:05:24 +0000 (05:05 -0500)] 
Fix potential flakiness in `test_run_until_complete_baseexception` (#100148)

2 years agoFix potential flakiness in `test_run_until_complete_baseexception` (#100148)
Fantix King [Sat, 10 Dec 2022 10:04:50 +0000 (05:04 -0500)] 
Fix potential flakiness in `test_run_until_complete_baseexception` (#100148)

2 years agoFix potential flakiness in `test_run_until_complete_baseexception` (#100148)
Fantix King [Sat, 10 Dec 2022 10:04:22 +0000 (05:04 -0500)] 
Fix potential flakiness in `test_run_until_complete_baseexception` (#100148)

2 years agogh-99582: freeze `zipimport` into `_bootstrap_python` (#99583)
Kai Zhang [Sat, 10 Dec 2022 09:35:56 +0000 (17:35 +0800)] 
gh-99582: freeze `zipimport` into `_bootstrap_python` (#99583)

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