]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
3 years agogh-94199: Remove ssl.wrap_socket() documentation (#99023)
Victor Stinner [Thu, 3 Nov 2022 12:33:33 +0000 (13:33 +0100)] 
gh-94199: Remove ssl.wrap_socket() documentation (#99023)

The function has been removed. In the ssl documentation, replace
references to the ssl.wrap_socket() function with references to the
ssl.SSLContext.wrap_socket() method.

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
3 years agoGH-96793: Implement PEP 479 in bytecode. (GH-99006)
Mark Shannon [Thu, 3 Nov 2022 11:38:51 +0000 (04:38 -0700)] 
GH-96793: Implement PEP 479 in bytecode. (GH-99006)

* Handle converting StopIteration to RuntimeError in bytecode.

* Add custom instruction for converting StopIteration into RuntimeError.

3 years agogh-98740: Fix validation of conditional expressions in RE (GH-98764)
Serhiy Storchaka [Thu, 3 Nov 2022 07:23:46 +0000 (09:23 +0200)] 
gh-98740: Fix validation of conditional expressions in RE (GH-98764)

In very rare circumstances the JUMP opcode could be confused with the
argument of the opcode in the "then" part which doesn't end with the
JUMP opcode. This led to incorrect detection of the final JUMP opcode
and incorrect calculation of the size of the subexpression.

NOTE: Changed return value of functions _validate_inner() and
_validate_charset() in Modules/_sre/sre.c.  Now they return 0 on success,
-1 on failure, and 1 if the last op is JUMP (which usually is a failure).
Previously they returned 1 on success and 0 on failure.

3 years agoGH-98831: "Generate" the interpreter (#98830)
Guido van Rossum [Thu, 3 Nov 2022 04:31:26 +0000 (21:31 -0700)] 
GH-98831: "Generate" the interpreter (#98830)

The switch cases (really TARGET(opcode) macros) have been moved from ceval.c to generated_cases.c.h. That file is generated from instruction definitions in bytecodes.c (which impersonates a C file so the C code it contains can be edited without custom support in e.g. VS Code).

The code generator lives in Tools/cases_generator (it has a README.md explaining how it works). The DSL used to describe the instructions is a work in progress, described in https://github.com/faster-cpython/ideas/blob/main/3.12/interpreter_definition.md.

This is surely a work-in-progress. An easy next step could be auto-generating super-instructions.

**IMPORTANT: Merge Conflicts**

If you get a merge conflict for instruction implementations in ceval.c, your best bet is to port your changes to bytecodes.c. That file looks almost the same as the original cases, except instead of `TARGET(NAME)` it uses `inst(NAME)`, and the trailing `DISPATCH()` call is omitted (the code generator adds it automatically).

3 years agogh-98999: Raise `ValueError` in `_pyio` on closed buffers (gh-99009)
Nikita Sobolev [Thu, 3 Nov 2022 03:03:12 +0000 (06:03 +0300)] 
gh-98999: Raise `ValueError` in `_pyio` on closed buffers (gh-99009)

3 years agoDocs: Add 'as, match statement' to the index (#99001)
Hugo van Kemenade [Thu, 3 Nov 2022 02:15:00 +0000 (04:15 +0200)] 
Docs: Add 'as, match statement' to the index (#99001)

3 years agogh-98512: Add more tests for `ValuesView` (#98515)
Nikita Sobolev [Thu, 3 Nov 2022 02:10:42 +0000 (05:10 +0300)] 
gh-98512: Add more tests for `ValuesView` (#98515)

3 years agoargparse howto: Use f-string in preference to "...".format() (#98883)
Skip Montanaro [Thu, 3 Nov 2022 02:08:08 +0000 (21:08 -0500)] 
argparse howto: Use f-string in preference to "...".format() (#98883)

3 years agogh-96997: Clarify the contract of PyMem_SetAllocator() (#98977)
Pablo Galindo Salgado [Wed, 2 Nov 2022 21:49:12 +0000 (21:49 +0000)] 
gh-96997: Clarify the contract of PyMem_SetAllocator() (#98977)

3 years agoGH-90699: Remove `_Py_IDENTIFIER` usage from `_elementtree` module (GH-99012)
Kumar Aditya [Wed, 2 Nov 2022 20:29:41 +0000 (01:59 +0530)] 
GH-90699: Remove `_Py_IDENTIFIER` usage from `_elementtree` module (GH-99012)

3 years agogh-98393: Update test_os for bytes-like types (#98487)
Victor Stinner [Wed, 2 Nov 2022 19:45:58 +0000 (20:45 +0100)] 
gh-98393: Update test_os for bytes-like types (#98487)

Address Serhiy Storchaka's review.

3 years agogh-97731: Specify the full path to the docs for `make docclean` (GH-98982)
Brett Cannon [Wed, 2 Nov 2022 19:34:22 +0000 (12:34 -0700)] 
gh-97731: Specify the full path to the docs for `make docclean` (GH-98982)

Specify the full path to the docs for `make docclean`
This is to have `make clean` not error out on cross-builds.

3 years agogh-98415: Fix uuid.getnode() ifconfig implementation (#98423)
Chaim Sanders [Wed, 2 Nov 2022 18:41:20 +0000 (11:41 -0700)] 
gh-98415: Fix uuid.getnode() ifconfig implementation (#98423)

The uuid.getnode() function has multiple implementations, tested sequentially.
The ifconfig implementation was incorrect and always failed: fix it.

In practice, functions of libuuid library are preferred, if available:
uuid_generate_time_safe(), uuid_create() or uuid_generate_time().

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
3 years agogh-98790: When DLLs directory is missing on Windows, assume executable_dir contains...
Steve Dower [Wed, 2 Nov 2022 18:38:40 +0000 (18:38 +0000)] 
gh-98790: When DLLs directory is missing on Windows, assume executable_dir contains PYD files instead (GH-98936)

3 years agogh-99016: Make build scripts compatible with Python 3.8 (GH-99017)
Serhiy Storchaka [Wed, 2 Nov 2022 18:30:09 +0000 (20:30 +0200)] 
gh-99016: Make build scripts compatible with Python 3.8 (GH-99017)

3 years agoGH-98686: Quicken everything (GH-98687)
Brandt Bucher [Wed, 2 Nov 2022 17:42:57 +0000 (10:42 -0700)] 
GH-98686: Quicken everything (GH-98687)

3 years agoGH-90699: Remove `_Py_IDENTIFIER` usage from `_asyncio` module (#99010)
Kumar Aditya [Wed, 2 Nov 2022 17:16:06 +0000 (22:46 +0530)] 
GH-90699: Remove `_Py_IDENTIFIER` usage from `_asyncio` module (#99010)

3 years agogh-98989: configure: add 3.11 to list of Pythons (#98988)
Jelle Zijlstra [Wed, 2 Nov 2022 17:05:42 +0000 (10:05 -0700)] 
gh-98989: configure: add 3.11 to list of Pythons (#98988)

Closes #98989

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
3 years agoGH-90699: Remove `_Py_IDENTIFIER` usage from `_json` module (GH-98956)
Kumar Aditya [Wed, 2 Nov 2022 16:03:38 +0000 (21:33 +0530)] 
GH-90699: Remove `_Py_IDENTIFIER` usage from `_json` module (GH-98956)

3 years agogh-87092: remove unused SET_LOC/UNSET_LOC macros (GH-98914)
Irit Katriel [Wed, 2 Nov 2022 15:52:11 +0000 (15:52 +0000)] 
gh-87092: remove unused SET_LOC/UNSET_LOC macros (GH-98914)

3 years agoGH-90699: Remove `_Py_IDENTIFIER` usage from `_curses` module (GH-98957)
Kumar Aditya [Wed, 2 Nov 2022 15:41:11 +0000 (21:11 +0530)] 
GH-90699: Remove `_Py_IDENTIFIER` usage from `_curses` module (GH-98957)

3 years agogh-87092: do not allocate PyFutureFeatures dynamically (GH-98913)
Irit Katriel [Wed, 2 Nov 2022 15:13:07 +0000 (15:13 +0000)] 
gh-87092: do not allocate PyFutureFeatures dynamically (GH-98913)

3 years agogh-98903: Test suite fails with exit code 4 if no tests ran (#98904)
Victor Stinner [Wed, 2 Nov 2022 14:37:40 +0000 (15:37 +0100)] 
gh-98903: Test suite fails with exit code 4 if no tests ran (#98904)

The Python test suite now fails wit exit code 4 if no tests ran. It
should help detecting typos in test names and test methods.

* Add "EXITCODE_" constants to Lib/test/libregrtest/main.py.
* Fix a typo: "NO TEST RUN" becomes "NO TESTS RAN"

3 years agogh-96265: Formatting changes for faq/programming (#98242)
Stanley [Wed, 2 Nov 2022 04:58:44 +0000 (21:58 -0700)] 
gh-96265: Formatting changes for faq/programming (#98242)

* Formatting changes for faq/programming

* Add missing method formatting, use non-literal formatting

* Fix sphinx warnings

* Some extra formatting missed earlier

* More formatting suggestions from review

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* Add missing colon, avoid referening external module

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
3 years agogh-92679: Clarify asyncio.loop.start_tls parameters (#92682)
Oleg Iarygin [Wed, 2 Nov 2022 04:52:19 +0000 (08:52 +0400)] 
gh-92679: Clarify asyncio.loop.start_tls parameters (#92682)

3 years agogh-92871: Postpone the removal of typing.{io,re} to 3.13 (#98958)
Sebastian Rittau [Wed, 2 Nov 2022 03:51:45 +0000 (04:51 +0100)] 
gh-92871: Postpone the removal of typing.{io,re} to 3.13 (#98958)

3 years ago[doc] Update cookbook example for socket-based logging in a production sett… (GH...
Vinay Sajip [Tue, 1 Nov 2022 23:00:17 +0000 (23:00 +0000)] 
[doc] Update cookbook example for socket-based logging in a production sett… (GH-98922)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
3 years agogh-98925: Lower marshal recursion depth for WASI (GH-98938)
Brett Cannon [Tue, 1 Nov 2022 22:51:05 +0000 (15:51 -0700)] 
gh-98925: Lower marshal recursion depth for WASI (GH-98938)

For wasmtime 2.0, the stack depth cost is 6% higher. This causes the default max `marshal` recursion depth to blow the stack.

As the default marshal depth is 2000 and Windows is set to 1000, split the difference and choose 1500 for WASI to be safe.

3 years agogh-98689: Update Windows builds to zlib v1.2.13 (GH-98968)
Zachary Ware [Tue, 1 Nov 2022 18:02:51 +0000 (13:02 -0500)] 
gh-98689: Update Windows builds to zlib v1.2.13 (GH-98968)

3 years agoDoc: use "unnumbered" footnotes (#98954)
Manuel Kaufmann [Tue, 1 Nov 2022 13:25:33 +0000 (14:25 +0100)] 
Doc: use "unnumbered" footnotes (#98954)

Use unnumbered footnote in this file to avoid reseting the footnotes numbering.

Example: when building the tutorial into a PDF and using `latex_show_urls = "footnotes"`; this footnote become the number 8. However, without this change, the footnote shows the number 1.

3 years agogh-98931: Improve error message when the user types 'import x from y' instead of...
Pablo Galindo Salgado [Tue, 1 Nov 2022 13:01:20 +0000 (13:01 +0000)] 
gh-98931: Improve error message when the user types 'import x from y' instead of 'from y import x' (#98932)

3 years agogh-98852: Fix subscription of type aliases (GH-98920)
Serhiy Storchaka [Tue, 1 Nov 2022 07:33:09 +0000 (09:33 +0200)] 
gh-98852: Fix subscription of type aliases (GH-98920)

Fix subscription of type aliases containing bare generic types or types
like TypeVar: for example tuple[A, T][int] and tuple[TypeVar, T][int],
where A is a generic type, and T is a type variable.

3 years agoGH-98766: Modest speed-up from ChainMap.__iter__ (GH-98946)
Raymond Hettinger [Tue, 1 Nov 2022 04:44:40 +0000 (23:44 -0500)] 
GH-98766: Modest speed-up from ChainMap.__iter__ (GH-98946)

3 years agogh-98658: Add __class_getitem__ to array.array (#98661)
Jelle Zijlstra [Tue, 1 Nov 2022 04:10:18 +0000 (21:10 -0700)] 
gh-98658: Add __class_getitem__ to array.array (#98661)

Closes #98658

3 years agoRename JUMP_TO_INSTRUCTION to GO_TO_INSTRUCTION (#98934)
Guido van Rossum [Tue, 1 Nov 2022 02:53:32 +0000 (19:53 -0700)] 
Rename JUMP_TO_INSTRUCTION to GO_TO_INSTRUCTION (#98934)

This reduces confusion between jumps at the bytecode level
(e.g. JUMPTO(), JUMPBY(), and various JUMP_*() opcodes)
and jumps in the C code (which are 'goto' statements).

3 years agoFix wording in Functional Programming HOWTO (GH-98939)
partev [Tue, 1 Nov 2022 02:49:27 +0000 (22:49 -0400)] 
Fix wording in Functional Programming HOWTO (GH-98939)

3 years agoMissing PS1 prompt in tutorial example (GH-98921)
Manuel Kaufmann [Tue, 1 Nov 2022 02:24:26 +0000 (03:24 +0100)] 
Missing PS1 prompt in tutorial example (GH-98921)

3 years agoGH-98897: fix memory leak if `math.dist` raises exception (GH-98898)
Kumar Aditya [Tue, 1 Nov 2022 02:18:32 +0000 (07:48 +0530)] 
GH-98897: fix memory leak if `math.dist` raises exception (GH-98898)

3 years agogh-98692: Enable treating shebang lines as executables in py.exe launcher (GH-98732)
Steve Dower [Mon, 31 Oct 2022 21:05:50 +0000 (21:05 +0000)] 
gh-98692: Enable treating shebang lines as executables in py.exe launcher (GH-98732)

3 years agogh-98610: Adjust the Optional Restrictions on Subinterpreters (GH-98618)
Eric Snow [Mon, 31 Oct 2022 19:35:54 +0000 (13:35 -0600)] 
gh-98610: Adjust the Optional Restrictions on Subinterpreters (GH-98618)

Previously, the optional restrictions on subinterpreters were: disallow fork, subprocess, and threads.  By default, we were disallowing all three for "isolated" interpreters.  We always allowed all three for the main interpreter and those created through the legacy `Py_NewInterpreter()` API.

Those settings were a bit conservative, so here we've adjusted the optional restrictions to: fork, exec, threads, and daemon threads.  The default for "isolated" interpreters disables fork, exec, and daemon threads.  Regular threads are allowed by default.  We continue always allowing everything For the main interpreter and the legacy API.

In the code, we add `_PyInterpreterConfig.allow_exec` and  `_PyInterpreterConfig.allow_daemon_threads`.  We also add `Py_RTFLAGS_DAEMON_THREADS` and `Py_RTFLAGS_EXEC`.

3 years agoFix typo in sorting HOWTO (#98888)
partev [Mon, 31 Oct 2022 17:58:13 +0000 (13:58 -0400)] 
Fix typo in sorting HOWTO (#98888)

3 years agoDoc: Fix sphinx-lint issues (GH-98911)
Julien Palard [Mon, 31 Oct 2022 15:30:29 +0000 (16:30 +0100)] 
Doc: Fix sphinx-lint issues (GH-98911)

They were introduced right between GH-98441 and GH-98408.

3 years agogh-98576: Fix types in dataclass.InitVar example (gh-98577)
Shantanu [Mon, 31 Oct 2022 15:02:02 +0000 (08:02 -0700)] 
gh-98576: Fix types in dataclass.InitVar example (gh-98577)

3 years agogh-98410: move getbufferproc and releasebufferproc to buffer.h (#31158)
David Hewitt [Mon, 31 Oct 2022 14:01:32 +0000 (14:01 +0000)] 
gh-98410: move getbufferproc and releasebufferproc to buffer.h (#31158)

This adds them to the Limited API.

3 years agogh-98878: Use builtins from the bound frame when offering a suggestion (#98880)
Batuhan Taskaya [Mon, 31 Oct 2022 13:27:13 +0000 (16:27 +0300)] 
gh-98878: Use builtins from the bound frame when offering a suggestion (#98880)

3 years agogh-98811: use full source location to simplify __future__ imports error checking...
Irit Katriel [Mon, 31 Oct 2022 13:08:03 +0000 (13:08 +0000)] 
gh-98811: use full source location to simplify __future__ imports error checking. This also fixes an incorrect error offset. (GH-98812)

3 years agogh-96151: Use a private name for passing builtins to dataclass. This now allows for...
Shantanu [Mon, 31 Oct 2022 12:31:01 +0000 (05:31 -0700)] 
gh-96151: Use a private name for passing builtins to dataclass. This now allows for a field named BUILTIN (gh-98143)

3 years agogh-98879: Remove unreachable error case from COMPARE_OP_STR_JUMP (GH-98882)
Dennis Sweeney [Sun, 30 Oct 2022 23:07:11 +0000 (19:07 -0400)] 
gh-98879: Remove unreachable error case from COMPARE_OP_STR_JUMP (GH-98882)

Thanks to PEP 623 changes, the comparison cannot fail.

3 years agogh-97966: Update uname docs to clarify the special nature of the platform attribute...
Jason R. Coombs [Sun, 30 Oct 2022 15:53:58 +0000 (11:53 -0400)] 
gh-97966: Update uname docs to clarify the special nature of the platform attribute and to indicate when it became late-bound. (#97972)

3 years agogh-96853: Restore test coverage for Py_Initialize(Ex) (GH-98212)
Nick Coghlan [Sun, 30 Oct 2022 12:01:30 +0000 (22:01 +1000)] 
gh-96853: Restore test coverage for Py_Initialize(Ex) (GH-98212)

* As most of `test_embed` now uses `Py_InitializeFromConfig`, add
  a specific test case to cover `Py_Initialize` (and `Py_InitializeEx`)
* Rename `_testembed` init helper to clarify the API used
* Add a `PyConfig_Clear` call in `Py_InitializeEx` to make
  the code more obviously correct (it already didn't leak as
  none of the dynamically allocated config fields were being
  populated, but it's clearer if the wrappers follow the
  documented API usage guidelines)

3 years agogh-98783: Fix crashes when `str` subclasses are used in `_PyUnicode_Equal` (#98806)
Nikita Sobolev [Sun, 30 Oct 2022 06:23:20 +0000 (09:23 +0300)] 
gh-98783: Fix crashes when `str` subclasses are used in `_PyUnicode_Equal` (#98806)

3 years agogh-98793: Fix typecheck in `overlapped.c` (#98835)
Charlie Zhao [Sun, 30 Oct 2022 04:34:46 +0000 (12:34 +0800)] 
gh-98793: Fix typecheck in `overlapped.c` (#98835)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
3 years agoglossary.rst: Fix typo in package definition (GH-98865)
ab [Sat, 29 Oct 2022 22:42:59 +0000 (00:42 +0200)] 
glossary.rst: Fix typo in package definition (GH-98865)

This is a tiny typo fix of package definition in glossary.
According to https://devguide.python.org/documentation/help-documenting/ simple typos don’t require issues of their own, but, instead, a pull request can by submitted directly.

Automerge-Triggered-By: GH:AlexWaygood
3 years agoFix typo in docs (GH-98863)
Yuvi Panda [Sat, 29 Oct 2022 20:44:06 +0000 (13:44 -0700)] 
Fix typo in docs (GH-98863)

3 years agogh-93358: Fix python-config docs for how to embed Python (#98649)
Erlend E. Aasland [Sat, 29 Oct 2022 18:46:34 +0000 (20:46 +0200)] 
gh-93358: Fix python-config docs for how to embed Python (#98649)

3 years agoFix comment typos in `_operator.c` (#98853)
David Buchanan [Sat, 29 Oct 2022 18:25:09 +0000 (19:25 +0100)] 
Fix comment typos in `_operator.c` (#98853)

3 years agodataclasses docs: consistent indentation (4 spaces) in examples (#98855)
FC Stegerman [Sat, 29 Oct 2022 17:06:52 +0000 (17:06 +0000)] 
dataclasses docs: consistent indentation (4 spaces) in examples (#98855)

3 years agoGH-90352: fix _SelectorDatagramTransport to inherit from DatagramTransport (#98844)
Kumar Aditya [Sat, 29 Oct 2022 16:43:42 +0000 (22:13 +0530)] 
GH-90352: fix _SelectorDatagramTransport to inherit from DatagramTransport (#98844)

3 years agogh-98744: Prevent column-level decoding crashes on traceback module (#98824)
Batuhan Taskaya [Sat, 29 Oct 2022 12:28:20 +0000 (15:28 +0300)] 
gh-98744: Prevent column-level decoding crashes on traceback module (#98824)

3 years agogh-98286: handle empty filename in ZipFile/ZipInfo properly (#98346)
FC Stegerman [Sat, 29 Oct 2022 05:45:46 +0000 (05:45 +0000)] 
gh-98286: handle empty filename in ZipFile/ZipInfo properly (#98346)

effectively code modernization and a meaningful exception.

3 years agogh-98240: Updated Path.rename docs, when it is atomic (GH-98245)
Mateusz [Fri, 28 Oct 2022 23:31:37 +0000 (01:31 +0200)] 
gh-98240: Updated Path.rename docs, when it is atomic (GH-98245)

3 years agogh-84538: add strict argument to pathlib.PurePath.relative_to (GH-19813)
domragusa [Fri, 28 Oct 2022 23:20:14 +0000 (01:20 +0200)] 
gh-84538: add strict argument to pathlib.PurePath.relative_to (GH-19813)

By default, :meth:`pathlib.PurePath.relative_to` doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a *walk_up* parameter that can be set to allow for using ``..`` to calculate the relative path.

example:
```
>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/etc')
PurePosixPath('passwd')
>>> p.relative_to('/usr')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pathlib.py", line 940, in relative_to
    raise ValueError(error_message.format(str(self), str(formatted)))
ValueError: '/etc/passwd' does not start with '/usr'
>>> p.relative_to('/usr', strict=False)
PurePosixPath('../etc/passwd')
```

https://bugs.python.org/issue40358

Automerge-Triggered-By: GH:brettcannon
3 years agoFix typo in contextvars docs (#98823)
cburroughs [Fri, 28 Oct 2022 21:13:48 +0000 (17:13 -0400)] 
Fix typo in contextvars docs (#98823)

3 years agogh-92452: Avoid race in initialization of sysconfig._CONFIG_VARS
Gareth Rees [Fri, 28 Oct 2022 18:17:04 +0000 (19:17 +0100)] 
gh-92452: Avoid race in initialization of sysconfig._CONFIG_VARS

Co-authored-by: Filipe Laíns <lains@riseup.net>
3 years ago`argparse` docs: normalize constant references (#98765)
Skip Montanaro [Fri, 28 Oct 2022 12:15:39 +0000 (07:15 -0500)] 
`argparse` docs: normalize constant references (#98765)

3 years agogh-98776: Fix make regen-test-levenshtein for out-of-tree builds (GH-98779)
Miro Hrončok [Fri, 28 Oct 2022 11:31:33 +0000 (13:31 +0200)] 
gh-98776: Fix make regen-test-levenshtein for out-of-tree builds (GH-98779)

Fixes https://github.com/python/cpython/issues/98776

Automerge-Triggered-By: GH:erlend-aasland
3 years agogh-98657: [docs] `array.typecodes` is a module-level attribute (#98729)
Nikita Sobolev [Fri, 28 Oct 2022 10:26:01 +0000 (13:26 +0300)] 
gh-98657: [docs] `array.typecodes` is a module-level attribute (#98729)

* gh-98657: [docs] `array.typecodes` is a module-level attribute

* Update array.rst

3 years agogh-65002: Make note that null bytes are used to pad bytes (#98635)
Stanley [Fri, 28 Oct 2022 10:21:28 +0000 (03:21 -0700)] 
gh-65002: Make note that null bytes are used to pad bytes (#98635)

3 years agogh-98745: Allow py.exe launcher to install 3.11 by default and 3.12 on request (GH...
Steve Dower [Fri, 28 Oct 2022 09:12:22 +0000 (10:12 +0100)] 
gh-98745: Allow py.exe launcher to install 3.11 by default and 3.12 on request (GH-98780)

3 years agogh-98624 Add mutex to unittest.mock.NonCallableMock (#98688)
noah-weingarden [Fri, 28 Oct 2022 07:51:18 +0000 (03:51 -0400)] 
gh-98624 Add mutex to unittest.mock.NonCallableMock (#98688)

* Added lock to NonCallableMock in unittest.mock

* Add blurb

* Nitpick blurb

* Edit comment based on @Jason-Y-Z's review

* Add link to GH issue

3 years agogh-98789: Fix FOR_ITER assert on big-endian (GH-98792)
Dennis Sweeney [Fri, 28 Oct 2022 06:42:39 +0000 (02:42 -0400)] 
gh-98789: Fix FOR_ITER assert on big-endian (GH-98792)

Fix FOR_ITER assertion syntax

3 years agogh-98739: Update libexpat from 2.4.9 to 2.5.0 (#98742)
Shaun Walbridge [Thu, 27 Oct 2022 20:45:12 +0000 (16:45 -0400)] 
gh-98739: Update libexpat from 2.4.9 to 2.5.0 (#98742)

* Update libexpat from 2.4.9 to 2.5.0 to address CVE-2022-43680.

Co-authored-by: Shaun Walbridge <shaun.walbridge@gmail.com>
3 years agoobmalloc: Remove unused variable. (GH-98770)
Benjamin Peterson [Thu, 27 Oct 2022 16:06:49 +0000 (09:06 -0700)] 
obmalloc: Remove unused variable. (GH-98770)

3 years agogh-96143: Improve perf profiler docs (#96445)
Erlend E. Aasland [Thu, 27 Oct 2022 13:06:48 +0000 (15:06 +0200)] 
gh-96143: Improve perf profiler docs (#96445)

3 years agoGH-96793: Change `FOR_ITER` to not pop the iterator on exhaustion. (GH-96801)
Mark Shannon [Thu, 27 Oct 2022 10:55:03 +0000 (03:55 -0700)] 
GH-96793: Change `FOR_ITER` to not pop the iterator on exhaustion. (GH-96801)

Change FOR_ITER to have the same stack effect regardless of whether it branches or not.
Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).

3 years agogh-98586: Add vector call APIs to the Limited API (GH-98587)
Wenzel Jakob [Thu, 27 Oct 2022 09:45:42 +0000 (11:45 +0200)] 
gh-98586: Add vector call APIs to the Limited API (GH-98587)

Expose the facilities for making vector calls through Python's limited API.

3 years agoPython documents state elsewhere that a comma is not an operator, so … (GH-98736)
Gerardwx [Thu, 27 Oct 2022 06:33:42 +0000 (02:33 -0400)] 
Python documents state elsewhere that a comma is not an operator, so … (GH-98736)

…calling it an operator here is confusing. See https://docs.python.org/3/reference/lexical_analysis.html#operators and https://docs.python.org/3/faq/programming.html#id22.

3 years agogh-98627: Use a Switch in PyModule_FromDefAndSpec2() (gh-98734)
Eric Snow [Thu, 27 Oct 2022 03:20:54 +0000 (21:20 -0600)] 
gh-98627: Use a Switch in PyModule_FromDefAndSpec2() (gh-98734)

This helps simplify some changes in follow-up PRs.  It also matches what we're doing in PyModule_ExecDef().

3 years agogh-98703: Add tests for closing `_ProactorSocketTransport` with proactor event loop...
Kumar Aditya [Thu, 27 Oct 2022 03:07:31 +0000 (08:37 +0530)] 
gh-98703: Add tests for closing `_ProactorSocketTransport` with proactor event loop (GH-98730)

3 years agogh-98703: Fix asyncio proactor_events calling _call_connection_lost multiple times...
Ken Jin [Thu, 27 Oct 2022 02:37:12 +0000 (10:37 +0800)] 
gh-98703: Fix asyncio proactor_events calling _call_connection_lost multiple times (GH-98704)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
3 years agogh-94808: cover `PyFunction_GetDefaults` and `PyFunction_SetDefaults` (#98449)
Nikita Sobolev [Thu, 27 Oct 2022 00:47:29 +0000 (03:47 +0300)] 
gh-94808: cover `PyFunction_GetDefaults` and `PyFunction_SetDefaults` (#98449)

3 years agoFix readline.c compiler warning. (GH-98738)
Benjamin Peterson [Wed, 26 Oct 2022 22:53:25 +0000 (15:53 -0700)] 
Fix readline.c compiler warning. (GH-98738)

```
Modules/readline.c:1260:37: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    completer_word_break_characters =
                                    ^
```

3 years agogh-98741: Remove useless check_home usage from is_python_build usage (GH-98743)
Henry Schreiner [Wed, 26 Oct 2022 21:40:47 +0000 (17:40 -0400)] 
gh-98741: Remove useless check_home usage from is_python_build usage (GH-98743)

3 years agogh-98727: Remove old style classes from `test_cmath` (GH-98728)
Nikita Sobolev [Wed, 26 Oct 2022 18:08:34 +0000 (21:08 +0300)] 
gh-98727: Remove old style classes from `test_cmath` (GH-98728)

3 years agogh-98608: Change _Py_NewInterpreter() to _Py_NewInterpreterFromConfig() (gh-98609)
Eric Snow [Wed, 26 Oct 2022 17:16:30 +0000 (11:16 -0600)] 
gh-98608: Change _Py_NewInterpreter() to _Py_NewInterpreterFromConfig() (gh-98609)

(see https://github.com/python/cpython/issues/98608)

This change does the following:

1. change the argument to a new `_PyInterpreterConfig` struct
2. rename the function to `_Py_NewInterpreterFromConfig()`, inspired by `Py_InitializeFromConfig()` (takes a `_PyInterpreterConfig`  instead of `isolated_subinterpreter`)
3. split up the boolean `isolated_subinterpreter` into the corresponding multiple granular settings
   * allow_fork
   * allow_subprocess
   * allow_threads
4. add `PyInterpreterState.feature_flags` to store those settings
5. add a function for checking if a feature is enabled on an opaque `PyInterpreterState *`
6. drop `PyConfig._isolated_interpreter`

The existing default (see `Py_NewInterpeter()` and `Py_Initialize*()`) allows fork, subprocess, and threads and the optional "isolated" interpreter (see the `_xxsubinterpreters` module) disables all three.  None of that changes here; the defaults are preserved.

Note that the given `_PyInterpreterConfig` will not be used outside `_Py_NewInterpreterFromConfig()`, nor preserved.  This contrasts with how `PyConfig` is currently preserved, used, and even modified outside `Py_InitializeFromConfig()`.  I'd rather just avoid that mess from the start for `_PyInterpreterConfig`.  We can preserve it later if we find an actual need.

This change allows us to follow up with a number of improvements (e.g. stop disallowing subprocess and support disallowing exec instead).

(Note that this PR adds "private" symbols.  We'll probably make them public, and add docs, in a separate change.)

3 years agoFix small typo in the removed/deprecated section of the 3.11 whats new (GH-98722)
Pablo Galindo Salgado [Wed, 26 Oct 2022 17:05:00 +0000 (18:05 +0100)] 
Fix small typo in the removed/deprecated section of the 3.11 whats new (GH-98722)

3 years agogh-98716: Revert gh-96081: Escape lone stars in sqlite3 docs (#98720)
Erlend E. Aasland [Wed, 26 Oct 2022 14:53:46 +0000 (16:53 +0200)] 
gh-98716: Revert gh-96081: Escape lone stars in sqlite3 docs (#98720)

3 years agogh-98644: point people to tomllib from configparser’s docs (#98645)
Philipp A [Wed, 26 Oct 2022 14:06:20 +0000 (16:06 +0200)] 
gh-98644: point people to tomllib from configparser’s docs (#98645)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agogh-98713: Use `@cpython_only` for a test that fails on PyPy (#98714)
Nikita Sobolev [Wed, 26 Oct 2022 13:15:39 +0000 (16:15 +0300)] 
gh-98713: Use `@cpython_only` for a test that fails on PyPy (#98714)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
3 years agogh-90716: add _pylong.py module (#96673)
Neil Schemenauer [Wed, 26 Oct 2022 05:00:50 +0000 (22:00 -0700)] 
gh-90716: add _pylong.py module (#96673)

Add Python implementations of certain longobject.c functions. These use
asymptotically faster algorithms that can be used for operations on
integers with many digits. In those cases, the performance overhead of
the Python implementation is not significant since the asymptotic
behavior is what dominates runtime. Functions provided by this module
should be considered private and not part of any public API.

Co-author: Tim Peters <tim.peters@gmail.com>
Co-author: Mark Dickinson <dickinsm@gmail.com>
Co-author: Bjorn Martinsson

3 years agogh-94808: cover `PyMapping_HasKeyString` and `PyMapping_HasKey` (#98486)
Nikita Sobolev [Wed, 26 Oct 2022 04:33:32 +0000 (07:33 +0300)] 
gh-94808: cover `PyMapping_HasKeyString` and `PyMapping_HasKey` (#98486)

3 years agogh-98348: Mention ReferenceError in weakref.proxy documentation (#98355)
fancidev [Wed, 26 Oct 2022 03:48:24 +0000 (11:48 +0800)] 
gh-98348: Mention ReferenceError in weakref.proxy documentation (#98355)

3 years agodocs: Change links to label refs (#98454)
Stanley [Wed, 26 Oct 2022 03:26:28 +0000 (20:26 -0700)] 
docs: Change links to label refs (#98454)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
3 years agogh-77753: Add example for values that compare equal in stdtypes (#98497)
Stanley [Wed, 26 Oct 2022 02:54:27 +0000 (19:54 -0700)] 
gh-77753: Add example for values that compare equal in stdtypes (#98497)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agogh-84747: Add `async for` comment for StreamReader (#98633)
Stanley [Wed, 26 Oct 2022 02:16:18 +0000 (19:16 -0700)] 
gh-84747: Add `async for` comment for StreamReader (#98633)

3 years agofix a typo in whatsnew/3.11 (#98603)
July Tikhonov [Tue, 25 Oct 2022 23:42:54 +0000 (02:42 +0300)] 
fix a typo in whatsnew/3.11 (#98603)

3 years agogh-94808: Improve coverage of `unicode_find` and `unicode_rfind` (#98648)
Nikita Sobolev [Tue, 25 Oct 2022 23:37:53 +0000 (02:37 +0300)] 
gh-94808: Improve coverage of `unicode_find` and `unicode_rfind` (#98648)

3 years agoFix typos in deprecation section of 3.11 What's New (#98628)
Jacob Walls [Tue, 25 Oct 2022 23:35:53 +0000 (19:35 -0400)] 
Fix typos in deprecation section of 3.11 What's New (#98628)

3 years agogh-97937: dis docs: add adaptive=False (#97939)
Jelle Zijlstra [Tue, 25 Oct 2022 22:58:04 +0000 (15:58 -0700)] 
gh-97937: dis docs: add adaptive=False (#97939)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
3 years agogh-91058: Add error suggestions to 'import from' import errors (#98305)
Pablo Galindo Salgado [Tue, 25 Oct 2022 22:56:59 +0000 (23:56 +0100)] 
gh-91058: Add error suggestions to 'import from' import errors (#98305)