]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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>
2 years agogh-100049: fix `repr` for `mappingproxy` in dictionary view example doc (#100052)
ram vikram singh [Sat, 10 Dec 2022 09:16:00 +0000 (14:46 +0530)] 
gh-100049: fix `repr` for `mappingproxy` in dictionary view example doc (#100052)

2 years agogh-81057: Fix a Reference Leak in the posix Module (gh-100140)
Eric Snow [Fri, 9 Dec 2022 17:18:29 +0000 (10:18 -0700)] 
gh-81057: Fix a Reference Leak in the posix Module (gh-100140)

The leak was introduced in gh-100082.

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

2 years agogh-81057: Fix the wasm32-wasi Buildbot (gh-100139)
Eric Snow [Fri, 9 Dec 2022 17:17:54 +0000 (10:17 -0700)] 
gh-81057: Fix the wasm32-wasi Buildbot (gh-100139)

The build was broken by gh-100084.

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

2 years agoGH-98363: Shrink the physical size as well as the logical size (GH-100138)
Raymond Hettinger [Fri, 9 Dec 2022 17:02:35 +0000 (11:02 -0600)] 
GH-98363: Shrink the physical size as well as the logical size (GH-100138)

2 years agobpo-44512: Fix handling of extrasactions arg to csv.DictWriter with mixed or upper...
andrei kulakov [Fri, 9 Dec 2022 16:14:33 +0000 (11:14 -0500)] 
bpo-44512: Fix handling of extrasactions arg to csv.DictWriter with mixed or upper case (#26924)

2 years agobpo-43984: Allow winreg.SetValueEx to set -1 without treating it as an error (GH...
Shreyan Avigyan [Fri, 9 Dec 2022 12:47:18 +0000 (18:17 +0530)] 
bpo-43984: Allow winreg.SetValueEx to set -1 without treating it as an error (GH-25775)

2 years agoGH-98522: Add version number to code objects. (GH-98525)
Mark Shannon [Fri, 9 Dec 2022 12:18:45 +0000 (12:18 +0000)] 
GH-98522: Add version number to code objects. (GH-98525)

* Add version number to code object for better versioning of functions.

* Improves specialization for closures and list comprehensions.

2 years agogh-88267: Avoid DLL exporting functions from static builds on Windows(GH-99888)
Christian Rendina [Fri, 9 Dec 2022 11:16:15 +0000 (12:16 +0100)] 
gh-88267: Avoid DLL exporting functions from static builds on Windows(GH-99888)

2 years agoGH-100110: Specialize FOR_ITER for tuples (GH-100109)
Ken Jin [Fri, 9 Dec 2022 10:27:01 +0000 (18:27 +0800)] 
GH-100110: Specialize FOR_ITER for tuples (GH-100109)

* Specialize FOR_ITER for tuples

2 years agoGH-100113: remove remaining `yield from` usage from `asyncio` tests (#100114)
Kumar Aditya [Fri, 9 Dec 2022 03:52:18 +0000 (09:22 +0530)] 
GH-100113: remove remaining `yield from` usage from `asyncio` tests  (#100114)

2 years agogh-99087: Add missing newline for prompts in docs (GH-98993)
Stanley [Fri, 9 Dec 2022 03:31:19 +0000 (19:31 -0800)] 
gh-99087: Add missing newline for prompts in docs (GH-98993)

Add newline for prompts so copying to REPL does not cause errors.

2 years agogh-81057: Fix an ifdef in the time module (#100125)
Eric Snow [Fri, 9 Dec 2022 01:16:37 +0000 (18:16 -0700)] 
gh-81057: Fix an ifdef in the time module (#100125)

An earlier commit only defined check_ticks_per_second() when HAVE_TIMES is defined. However, we also need it when HAVE_CLOCK is defined. This primarily affects Windows.

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

2 years agogh-81057: Move Threading-Related Globals to _PyRuntimeState (#100084)
Eric Snow [Fri, 9 Dec 2022 00:50:58 +0000 (17:50 -0700)] 
gh-81057: Move Threading-Related Globals to _PyRuntimeState (#100084)

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

2 years agogh-81057: Move Ceval Trampoline Globals to _PyRuntimeState (gh-100083)
Eric Snow [Fri, 9 Dec 2022 00:17:20 +0000 (17:17 -0700)] 
gh-81057: Move Ceval Trampoline Globals to _PyRuntimeState (gh-100083)

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

2 years agoGH-98831: Generate things in the input order (#100123)
Guido van Rossum [Thu, 8 Dec 2022 23:54:07 +0000 (15:54 -0800)] 
GH-98831: Generate things in the input order (#100123)

This makes it easier to see what changed in the generated code
when converting an instruction to super or macro.

2 years agogh-81057: Move time Globals to _PyRuntimeState (gh-100122)
Eric Snow [Thu, 8 Dec 2022 23:46:09 +0000 (16:46 -0700)] 
gh-81057: Move time Globals to _PyRuntimeState (gh-100122)

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

2 years agogh-81057: Move OS-Related Globals to _PyRuntimeState (gh-100082)
Eric Snow [Thu, 8 Dec 2022 22:38:06 +0000 (15:38 -0700)] 
gh-81057: Move OS-Related Globals to _PyRuntimeState (gh-100082)

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

2 years agoGH-98831: Typed stack effects, and more instructions converted (#99764)
Guido van Rossum [Thu, 8 Dec 2022 21:31:27 +0000 (13:31 -0800)] 
GH-98831: Typed stack effects, and more instructions converted (#99764)

Stack effects can now have a type, e.g. `inst(X, (left, right -- jump/uint64_t)) { ... }`.

Instructions converted to the non-legacy format:

* COMPARE_OP
* COMPARE_OP_FLOAT_JUMP
* COMPARE_OP_INT_JUMP
* COMPARE_OP_STR_JUMP
* STORE_ATTR
* DELETE_ATTR
* STORE_GLOBAL
* STORE_ATTR_INSTANCE_VALUE
* STORE_ATTR_WITH_HINT
* STORE_ATTR_SLOT, and complete the store_attr family
* Complete the store_subscr family: STORE_SUBSCR{,DICT,LIST_INT}
  (STORE_SUBSCR was alread half converted,
  but wasn't using cache effects yet.)
* DELETE_SUBSCR
* PRINT_EXPR
* INTERPRETER_EXIT (a bit weird, ends in return)
* RETURN_VALUE
* GET_AITER (had to restructure it some)
  The original had mysterious `SET_TOP(NULL)` before `goto error`.
  I assume those just account for `obj` having been decref'ed,
  so I got rid of them in favor of the cleanup implied by `ERROR_IF()`.
* LIST_APPEND (a bit unhappy with it)
* SET_ADD (also a bit unhappy with it)

Various other improvements/refactorings as well.

2 years agoGH-98363: Have batched() return tuples (GH-100118)
Raymond Hettinger [Thu, 8 Dec 2022 21:08:16 +0000 (15:08 -0600)] 
GH-98363: Have batched() return tuples (GH-100118)

2 years agogh-96250: Improve sqlite3 injection attack example (#99270)
Jia Junjie [Thu, 8 Dec 2022 20:37:08 +0000 (04:37 +0800)] 
gh-96250: Improve sqlite3 injection attack example (#99270)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agotest_ast uses infinite_recursion() to prevent crash (#100104)
Victor Stinner [Thu, 8 Dec 2022 08:26:38 +0000 (09:26 +0100)] 
test_ast uses infinite_recursion() to prevent crash (#100104)

test.test_ast_recursion_limit() now uses infinite_recursion() of
test.support to prevent crashes on debug builds.

Before this change, the test crashed on ARM64 Windows 3.x buildbot
worker which builds Python in debug mode.

2 years agoFix `test_run_until_complete_baseexception` test to check for `KeyboardInterrupt...
Fantix King [Thu, 8 Dec 2022 08:21:04 +0000 (03:21 -0500)] 
Fix `test_run_until_complete_baseexception` test to check for `KeyboardInterrupt` in asyncio (#24477)

2 years agogh-100098: [Enum] insist on actual tuples, no subclasses, for auto (GH-100099)
Ethan Furman [Thu, 8 Dec 2022 06:58:08 +0000 (22:58 -0800)] 
gh-100098: [Enum] insist on actual tuples, no subclasses, for auto (GH-100099)

When checking for auto() instances, only top-level usage is supported,
which means either alone or as part of a regular tuple. Other
containers, such as lists, dicts, or namedtuples, will not have auto()
transformed into a value.

2 years agogh-98030: socket: add missing TCP socket options (#98031)
Matthieu Baerts [Thu, 8 Dec 2022 04:59:37 +0000 (05:59 +0100)] 
gh-98030: socket: add missing TCP socket options (#98031)

A few TCP socket options have been added to the Linux kernel these last
few years.

This commit adds all the ones available in Linux 6.0:

  https://elixir.bootlin.com/linux/v6.0/source/include/uapi/linux/tcp.h#L91

While at it, the TCP_FASTOPEN option has been moved lower in the list
just to keep the same order as in tcp.h to ease future synchronisations.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
2 years agogh-92120: The docstring of enum.Enum is invalid in reST (GH-92122)
Takeshi KOMIYA [Thu, 8 Dec 2022 02:24:52 +0000 (11:24 +0900)] 
gh-92120: The docstring of enum.Enum is invalid in reST (GH-92122)

Closes #92120

2 years agogh-98778: Update HTTPError to initialize properly even if fp is None (gh-99966)
Dong-hee Na [Thu, 8 Dec 2022 02:20:34 +0000 (11:20 +0900)] 
gh-98778: Update HTTPError to initialize properly even if fp is None (gh-99966)

2 years agogh-100086: Add build info to test.libregrtest (#100093)
Victor Stinner [Thu, 8 Dec 2022 00:38:47 +0000 (01:38 +0100)] 
gh-100086: Add build info to test.libregrtest (#100093)

The Python test runner (libregrtest) now logs Python build information like
"debug" vs "release" build, or LTO and PGO optimizations.

2 years agogh-81057: Move More Globals to _PyRuntimeState (gh-100092)
Eric Snow [Wed, 7 Dec 2022 22:56:31 +0000 (15:56 -0700)] 
gh-81057: Move More Globals to _PyRuntimeState (gh-100092)

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

2 years agogh-90110: Clean Up the C-analyzer Globals Lists (gh-100091)
Eric Snow [Wed, 7 Dec 2022 22:02:47 +0000 (15:02 -0700)] 
gh-90110: Clean Up the C-analyzer Globals Lists (gh-100091)

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

2 years agogh-100072: only trigger netlify builds for doc changes (#100074)
Nikita Sobolev [Wed, 7 Dec 2022 19:07:30 +0000 (22:07 +0300)] 
gh-100072: only trigger netlify builds for doc changes (#100074)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-100077: make test_code.test_invalid_bytecode more robust and maintainable (#100078)
Irit Katriel [Wed, 7 Dec 2022 18:09:05 +0000 (18:09 +0000)] 
gh-100077: make test_code.test_invalid_bytecode more robust and maintainable (#100078)

2 years agogh-83035: handle decorator with nested parens in inspect.getsource (#99654)
Carl Meyer [Wed, 7 Dec 2022 16:55:12 +0000 (09:55 -0700)] 
gh-83035: handle decorator with nested parens in inspect.getsource (#99654)

2 years agogh-98724: Fix Py_CLEAR() macro side effects (#99100) (#100070)
Victor Stinner [Wed, 7 Dec 2022 14:22:38 +0000 (15:22 +0100)] 
gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#100070)

The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate
their arguments once. If an argument has side effects, these side
effects are no longer duplicated.

Use temporary variables to avoid duplicating side effects of macro
arguments. If available, use _Py_TYPEOF() to avoid type punning.
Otherwise, use memcpy() for the assignment to prevent a
miscompilation with strict aliasing caused by type punning.

Add _Py_TYPEOF() macro: __typeof__() on GCC and clang.

Add test_py_clear() and test_py_setref() unit tests to _testcapi.

2 years agogh-93018: Fix for the compatibility problems with expat (gh-93900)
Matěj Cepl [Wed, 7 Dec 2022 06:55:49 +0000 (07:55 +0100)] 
gh-93018: Fix for the compatibility problems with expat (gh-93900)

2 years ago[Enum] Remove unused code from `test_enum.py` (GH-96986)
Nikita Sobolev [Wed, 7 Dec 2022 02:44:47 +0000 (05:44 +0300)] 
[Enum] Remove unused code from `test_enum.py` (GH-96986)

2 years agogh-100050: Fix an assertion error when raising unclosed parenthesis errors in the...
Pablo Galindo Salgado [Tue, 6 Dec 2022 23:09:56 +0000 (23:09 +0000)] 
gh-100050: Fix an assertion error when raising unclosed parenthesis errors in the tokenizer (GH-100065)

Automerge-Triggered-By: GH:pablogsal
2 years agoPyUnicode_KIND() uses _Py_RVALUE() (#100060)
Victor Stinner [Tue, 6 Dec 2022 22:40:05 +0000 (23:40 +0100)] 
PyUnicode_KIND() uses _Py_RVALUE() (#100060)

The PyUnicode_KIND() macro is modified to use _Py_RVALUE(), so it can
no longer be used as a l-value.

2 years agogh-94943: [Enum] improve repr() when inheriting from a dataclass (GH-99740)
Ethan Furman [Tue, 6 Dec 2022 21:43:41 +0000 (13:43 -0800)] 
gh-94943: [Enum] improve repr() when inheriting from a dataclass (GH-99740)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agoPost 3.12.0a3
Thomas Wouters [Tue, 6 Dec 2022 21:20:28 +0000 (22:20 +0100)] 
Post 3.12.0a3

2 years agoPython 3.12.0a3 v3.12.0a3
Thomas Wouters [Tue, 6 Dec 2022 18:31:10 +0000 (19:31 +0100)] 
Python 3.12.0a3

2 years agogh-93453: No longer create an event loop in get_event_loop() (#98440)
Serhiy Storchaka [Tue, 6 Dec 2022 17:42:12 +0000 (19:42 +0200)] 
gh-93453: No longer create an event loop in get_event_loop() (#98440)

asyncio.get_event_loop() now always return either running event loop or
the result of get_event_loop_policy().get_event_loop() call. The latter
should now raise an RuntimeError if no current event loop was set
instead of creating and setting a new event loop.

It affects also a number of asyncio functions and constructors which
call get_event_loop() implicitly: ensure_future(), shield(), gather(),
etc.

DeprecationWarning is no longer emitted if there is no running event loop but
the current event loop was set.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agoGH-99729: Unlink frames before clearing them (GH-100030)
Brandt Bucher [Tue, 6 Dec 2022 14:01:38 +0000 (06:01 -0800)] 
GH-99729: Unlink frames before clearing them (GH-100030)

2 years agobpo-37860: re-add netlify.toml to set up deploy previews for docs (#92852)
Ashwin Ramaswami [Tue, 6 Dec 2022 13:37:41 +0000 (08:37 -0500)] 
bpo-37860: re-add netlify.toml to set up deploy previews for docs (#92852)

* Revert "bpo-46184: remove `netlify.toml` (#30272)"

This reverts commit fbaf2e604cd354f1ebc6be029480010c6715a8ca.

* Delete runtime.txt

* Create runtime.txt

* Delete runtime.txt

* Update netlify.toml

* Update netlify.toml

* Add netlify badge

* Update Doc/tools/templates/layout.html

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* Update layout.html

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-100008: VS 2017 is required since Python 3.11 (#100045)
Victor Stinner [Tue, 6 Dec 2022 13:35:32 +0000 (14:35 +0100)] 
gh-100008: VS 2017 is required since Python 3.11 (#100045)

2 years agoGH-100026: Include the number of raw input files in summarize_stats.py (GH-100027)
Michael Droettboom [Tue, 6 Dec 2022 11:14:47 +0000 (06:14 -0500)] 
GH-100026: Include the number of raw input files in summarize_stats.py (GH-100027)

2 years agogh-99957: Add `frozen_default` parameter on `dataclass_transform` (#99958)
Erik De Bonte [Tue, 6 Dec 2022 03:35:43 +0000 (19:35 -0800)] 
gh-99957: Add `frozen_default` parameter on `dataclass_transform` (#99958)

2 years agogh-100001: Remove doc typo, add versionadded (#100042)
Gregory P. Smith [Mon, 5 Dec 2022 23:15:13 +0000 (15:15 -0800)] 
gh-100001: Remove doc typo, add versionadded (#100042)

gh-100001: Remove new doc typo, add versionadded.

2 years agogh-100001: Also escape \s in http.server log messages. (#100038)
Gregory P. Smith [Mon, 5 Dec 2022 22:27:55 +0000 (14:27 -0800)] 
gh-100001: Also escape \s in http.server log messages. (#100038)

Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.

2 years agogh-99984: Fix Compiler Warnings (#100036)
Eric Snow [Mon, 5 Dec 2022 21:41:06 +0000 (14:41 -0700)] 
gh-99984: Fix Compiler Warnings (#100036)

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

2 years agoUse sphinxext-opengraph to generate OpenGraph metadata (#99931)
Hugo van Kemenade [Mon, 5 Dec 2022 21:26:28 +0000 (23:26 +0200)] 
Use sphinxext-opengraph to generate OpenGraph metadata (#99931)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agogh-100001: Omit control characters in http.server stderr logs. (#100002)
Gregory P. Smith [Mon, 5 Dec 2022 20:55:45 +0000 (12:55 -0800)] 
gh-100001: Omit control characters in http.server stderr logs. (#100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.

2 years agogh-99741: Implement Multi-Phase Init for the _xxsubinterpreters Module (gh-99742)
Eric Snow [Mon, 5 Dec 2022 20:40:20 +0000 (13:40 -0700)] 
gh-99741: Implement Multi-Phase Init for the _xxsubinterpreters Module (gh-99742)

_xxsubinterpreters is an internal module used for testing.

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

2 years agodataclasses.rst: Prevent horizontal scrolling (gh-100025)
Ram Rachum [Mon, 5 Dec 2022 18:56:13 +0000 (20:56 +0200)] 
dataclasses.rst: Prevent horizontal scrolling (gh-100025)

2 years agobpo-44817: Ignore additional errors in ntpath.realpath (GH-27574)
Michael Förderer [Mon, 5 Dec 2022 17:34:00 +0000 (18:34 +0100)] 
bpo-44817: Ignore additional errors in ntpath.realpath (GH-27574)

2 years agogh-98680: Add PyBUF_* constants to the Limited API listing (GH-100018)
Petr Viktorin [Mon, 5 Dec 2022 17:02:36 +0000 (18:02 +0100)] 
gh-98680: Add PyBUF_* constants to the Limited API listing (GH-100018)

``PyBUF_*`` constants are marked as part of Limited API of Python 3.11+.
These were available in 3.11.0 with `Py_LIMITED_API` defined for 3.11,
and are necessary to use the buffer API. Omitting them in `stable_abi.toml`
was a mistake.

2 years agogh-60203: Revert changes in cycle.__setstate__ (#99982)
Serhiy Storchaka [Mon, 5 Dec 2022 16:27:40 +0000 (18:27 +0200)] 
gh-60203: Revert changes in cycle.__setstate__ (#99982)

In case if only True/False be supported as boolean arguments in future,
we should continue to support 1/0 here.

2 years agogh-99892: test_unicodedata: skip test on download failure (#100011)
Victor Stinner [Mon, 5 Dec 2022 15:37:40 +0000 (16:37 +0100)] 
gh-99892: test_unicodedata: skip test on download failure (#100011)

Skip test_normalization() of test_unicodedata if it fails to download
NormalizationTest.txt file from pythontest.net.

2 years agogh-100008: Document Python build requirements (#100009)
Victor Stinner [Mon, 5 Dec 2022 14:41:44 +0000 (15:41 +0100)] 
gh-100008: Document Python build requirements (#100009)

Document also configure --without-freelists option added to Python
3.11.

2 years agogh-100005: Skip test_script_as_dev_fd() on FreeBSD (#100006)
Victor Stinner [Mon, 5 Dec 2022 13:23:35 +0000 (14:23 +0100)] 
gh-100005: Skip test_script_as_dev_fd() on FreeBSD (#100006)

On FreeBSD, skip test_script_as_dev_fd() of test_cmd_line_script if
fdescfs is not mounted (at /dev/fd).

2 years agogh-93464: [Enum] Add versionchanged tag (#99997)
Ethan Furman [Mon, 5 Dec 2022 10:35:31 +0000 (02:35 -0800)] 
gh-93464: [Enum] Add versionchanged tag (#99997)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agono-issue: Fix typo in pycore_object.h (gh-99994)
Ikko Ashimine [Mon, 5 Dec 2022 05:42:38 +0000 (14:42 +0900)] 
no-issue: Fix typo in pycore_object.h (gh-99994)

2 years agogh-98248: Normalizing the error messages in function struct.pack (GH-98252)
Felix Ye [Sun, 4 Dec 2022 20:24:18 +0000 (15:24 -0500)] 
gh-98248: Normalizing the error messages in function struct.pack (GH-98252)

Provide consistent and informative error messages in function struct.pack when its integral arguments are not in range.

2 years ago[Enum] Fix typos in the documentation (GH-99960)
Géry Ogam [Sun, 4 Dec 2022 19:49:31 +0000 (20:49 +0100)] 
[Enum] Fix typos in the documentation (GH-99960)

2 years agogh-98458: unittest: bugfix for infinite loop while handling chained exceptions that...
AlexTate [Sun, 4 Dec 2022 19:37:55 +0000 (12:37 -0700)] 
gh-98458: unittest: bugfix for infinite loop while handling chained exceptions that contain cycles (#98459)

* Bugfix addressing infinite loop while handling self-referencing chained exception in TestResult._clean_tracebacks()
* Bugfix extended to properly handle exception cycles in _clean_tracebacks. The "seen" set follows the approach used in the TracebackException class (thank you @iritkatriel for pointing it out)
* adds a test for a single chained exception that holds a self-loop in its __cause__ and __context__ attributes