]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
3 years agoSupport comparing two sets of pystats (GH-98816)
Michael Droettboom [Fri, 4 Nov 2022 10:15:54 +0000 (06:15 -0400)] 
Support comparing two sets of pystats (GH-98816)

This adds support for comparing pystats collected from two different builds.

- The `--json-output` can be used to load in a set of raw stats and output a
  JSON file.
- Two of these JSON files can be provided on the next run, and then comparative
  results between the two are output.

3 years agogh-94808: Cover `LOAD_GLOBAL` for custom dict subtypes (GH-96767)
Nikita Sobolev [Fri, 4 Nov 2022 09:58:38 +0000 (12:58 +0300)] 
gh-94808: Cover `LOAD_GLOBAL` for custom dict subtypes (GH-96767)

3 years agoDocs: add `named` to the list of styles in the sqlite3.paramstyle attr docs (#99078)
Nick Pope [Thu, 3 Nov 2022 23:21:01 +0000 (23:21 +0000)] 
Docs: add `named` to the list of styles in the sqlite3.paramstyle attr docs (#99078)

3 years agogh-90716: bugfixes and more tests for _pylong. (#99073)
Gregory P. Smith [Thu, 3 Nov 2022 23:18:38 +0000 (16:18 -0700)] 
gh-90716: bugfixes and more tests for _pylong. (#99073)

* Properly decref on _pylong import error.
* Improve the error message on _pylong TypeError.
* Fix the assertion error in pydebug builds to be a TypeError.
* Tie the return value comments together.

These are minor followups to issues not caught among the reviewers on
https://github.com/python/cpython/pull/96673.

3 years agogh-73691: Increase size limits in _xxtestfuzz (#99070)
Gregory P. Smith [Thu, 3 Nov 2022 21:41:20 +0000 (14:41 -0700)] 
gh-73691:  Increase size limits in _xxtestfuzz (#99070)

Now that our int<->str conversions are size limited and we have the
_pylong module handling larger integers, we don't need to limit
everything just to avoid wasting time in the quadratic time DoS-like
case while fuzzing.

We can tweak these further after seeing how this goes.

3 years agoGH-90699: Remove `_Py_IDENTIFIER` usage from `_ctypes` (GH-99054)
Kumar Aditya [Thu, 3 Nov 2022 20:20:10 +0000 (01:50 +0530)] 
GH-90699: Remove `_Py_IDENTIFIER` usage from `_ctypes`  (GH-99054)

3 years agogh-92584: Remove the distutils package (#99061)
Victor Stinner [Thu, 3 Nov 2022 18:27:27 +0000 (19:27 +0100)] 
gh-92584: Remove the distutils package (#99061)

Remove the distutils package. It was deprecated in Python 3.10 by PEP
632 "Deprecate distutils module". For projects still using distutils
and cannot be updated to something else, the setuptools project can
be installed: it still provides distutils.

* Remove Lib/distutils/ directory
* Remove test_distutils
* Remove references to distutils
* Skip test_check_c_globals and test_peg_generator since they use
  distutils

3 years agogh-98978: Fix Py_SetPythonHome(NULL) (#99066)
Victor Stinner [Thu, 3 Nov 2022 17:34:32 +0000 (18:34 +0100)] 
gh-98978: Fix Py_SetPythonHome(NULL) (#99066)

Fix use-after-free in Py_SetPythonHome(NULL), Py_SetProgramName(NULL)
and _Py_SetProgramFullPath(NULL) function calls.

Issue reported by Benedikt Reinartz.

3 years agogh-94172: Remove keyfile, certfile and check_hostname parameters (#94173)
Victor Stinner [Thu, 3 Nov 2022 17:32:25 +0000 (18:32 +0100)] 
gh-94172: Remove keyfile, certfile and check_hostname parameters (#94173)

Remove the keyfile, certfile and check_hostname parameters,
deprecated since Python 3.6, in modules: ftplib, http.client,
imaplib, poplib and smtplib. Use the context parameter (ssl_context
in imaplib) instead.

Parameters following the removed parameters become keyword-only
parameters.

ftplib: Remove the FTP_TLS.ssl_version class attribute: use the
context parameter instead.

3 years agogh-90716: Remove _pylong._DEBUG flag (#99063)
Victor Stinner [Thu, 3 Nov 2022 17:16:28 +0000 (18:16 +0100)] 
gh-90716: Remove _pylong._DEBUG flag (#99063)

To debug the _pylong module, it's trivial to add this code again
locally. There is not need to keep it in Python releases.

3 years agogh-98884: [pathlib] remove `hasattr` check for `lru_cache` (#98885)
Nikita Sobolev [Thu, 3 Nov 2022 17:14:12 +0000 (20:14 +0300)] 
gh-98884: [pathlib] remove `hasattr` check for `lru_cache` (#98885)

3 years agogh-92584: Remove references to removed _bootsubprocess (#99062)
Victor Stinner [Thu, 3 Nov 2022 17:12:45 +0000 (18:12 +0100)] 
gh-92584: Remove references to removed _bootsubprocess (#99062)

The _bootsubprocess module was removed in gh-93939
by commit 81dca70d704d0834d8c30580e648a973250b2973.

3 years agogh-97909: PyMemberDef & PyGetSetDef members are not marked up (GH-98810)
Johnny11502 [Thu, 3 Nov 2022 16:57:30 +0000 (12:57 -0400)] 
gh-97909: PyMemberDef & PyGetSetDef members are not marked up (GH-98810)

3 years agogh-98401: Invalid escape sequences emits SyntaxWarning (#99011)
Victor Stinner [Thu, 3 Nov 2022 16:53:25 +0000 (17:53 +0100)] 
gh-98401: Invalid escape sequences emits SyntaxWarning (#99011)

A backslash-character pair that is not a valid escape sequence now
generates a SyntaxWarning, instead of DeprecationWarning.  For
example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an
invalid escape sequence), use raw strings for regular expression:
re.compile(r"\d+\.\d+"). In a future Python version, SyntaxError will
eventually be raised, instead of SyntaxWarning.

Octal escapes with value larger than 0o377 (ex: "\477"), deprecated
in Python 3.11, now produce a SyntaxWarning, instead of
DeprecationWarning. In a future Python version they will be
eventually a SyntaxError.

codecs.escape_decode() and codecs.unicode_escape_decode() are left
unchanged: they still emit DeprecationWarning.

* The parser only emits SyntaxWarning for Python 3.12 (feature
  version), and still emits DeprecationWarning on older Python
  versions.
* Fix SyntaxWarning by using raw strings in Tools/c-analyzer/ and
  wasm_build.py.

3 years agoGH-98831: Remove redundant extract_cases.py script (GH-99065)
Guido van Rossum [Thu, 3 Nov 2022 16:50:35 +0000 (09:50 -0700)] 
GH-98831: Remove redundant extract_cases.py script (GH-99065)

Debt I owe from PR GH-98830.

3 years agogh-97616: test_list_resize_overflow() uses sys.maxsize (#99057)
Victor Stinner [Thu, 3 Nov 2022 14:56:12 +0000 (15:56 +0100)] 
gh-97616: test_list_resize_overflow() uses sys.maxsize (#99057)

3 years agogh-83004: Clean up refleak in _io initialisation (#98840)
Shantanu [Thu, 3 Nov 2022 14:29:11 +0000 (07:29 -0700)] 
gh-83004: Clean up refleak in _io initialisation (#98840)

3 years agogh-98948: Remove obsolete readelf dependency (#98949)
serge-sans-paille [Thu, 3 Nov 2022 13:31:37 +0000 (13:31 +0000)] 
gh-98948: Remove obsolete readelf dependency (#98949)

This got introduced in commit 5884449539510313c826d69835829c7957c7154a
to determine if readline is already linked against curses or tinfo in
the setup.py, which is no longer present.

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 =
                                    ^
```