]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoMerge branch 'main' of https://github.com/python/cpython into main
Thomas Wouters [Tue, 4 Apr 2023 20:01:07 +0000 (22:01 +0200)] 
Merge branch 'main' of https://github.com/python/cpython into main

2 years agoPost 3.12.0a7
Thomas Wouters [Tue, 4 Apr 2023 20:00:41 +0000 (22:00 +0200)] 
Post 3.12.0a7

2 years agobpo-44844: Enable detection of Microsoft Edge browser in webbrowser module (GH-29908)
Steve Dower [Tue, 4 Apr 2023 16:00:03 +0000 (17:00 +0100)] 
bpo-44844: Enable detection of Microsoft Edge browser in webbrowser module (GH-29908)

2 years agoPython 3.12.0a7 v3.12.0a7
Thomas Wouters [Tue, 4 Apr 2023 15:51:44 +0000 (17:51 +0200)] 
Python 3.12.0a7

2 years agoFix a compiler warning in _xxsubinterpretermodule.c (#103245)
T. Wouters [Tue, 4 Apr 2023 14:51:30 +0000 (16:51 +0200)] 
Fix a compiler warning in _xxsubinterpretermodule.c (#103245)

Fix a (correct) warning about potential uses of uninitialized memory in
_xxsubinterpreter. Unlike newly allocated PyObject structs or global
structs, stack-allocated structs are not initialised, and a few places in
the code expect the _sharedexception struct data to be either NULL or
initialised.

2 years agogh-103092: Isolate `_pickle` module (#102982)
Erlend E. Aasland [Tue, 4 Apr 2023 10:08:54 +0000 (12:08 +0200)] 
gh-103092: Isolate `_pickle` module (#102982)

Co-authored-by: Mohamed Koubaa <koubaa.m@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231)
Ethan Furman [Tue, 4 Apr 2023 00:47:40 +0000 (17:47 -0700)] 
gh-103056: [Enum] use staticmethod decorator for _gnv_ (GH-103231)

_gnv_ --> _generate_next_value_

2 years agoSpecify more settings for the C extension of VS Code for dev containers (GH-103229)
Brett Cannon [Mon, 3 Apr 2023 23:47:48 +0000 (16:47 -0700)] 
Specify more settings for the C extension of VS Code for dev containers (GH-103229)

Should help with auto-complete.

2 years agogh-100062: Remove error code tables from _ssl and err_names_to_codes (GH-100063)
David Benjamin [Mon, 3 Apr 2023 22:44:00 +0000 (07:44 +0900)] 
gh-100062: Remove error code tables from _ssl and err_names_to_codes (GH-100063)

Prior to https://github.com/python/cpython/pull/25300, the
make_ssl_data.py script used various tables, exposed in _ssl, to update
the error list.

After that PR, this is no longer used. Moreover, the err_names_to_codes
map isn't used at all. Clean those up. This gets them out of the way if,
in the future, OpenSSL provides an API to do what the code here is doing
directly. (https://github.com/openssl/openssl/issues/19848)

2 years agogh-98298, gh-74730: [Enum] update docs (GH-103163)
Ethan Furman [Mon, 3 Apr 2023 21:57:42 +0000 (14:57 -0700)] 
gh-98298, gh-74730: [Enum] update docs (GH-103163)

fix FlagBoundary statements
add warning about reloading modules and enum identity

2 years agogh-103215: Remove redundant if stmt from `enum.EnumType._find_data_type_` (GH-103222)
Sadra Barikbin [Mon, 3 Apr 2023 21:51:43 +0000 (01:21 +0330)] 
gh-103215: Remove redundant if stmt from `enum.EnumType._find_data_type_` (GH-103222)

2 years agogh-101100: Use list of 'dirty' docs, with warnings, instead of a clean list (#103191)
Hugo van Kemenade [Mon, 3 Apr 2023 18:59:47 +0000 (21:59 +0300)] 
gh-101100: Use list of 'dirty' docs, with warnings, instead of a clean list (#103191)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoGH-76846, GH-85281: Call `__new__()` and `__init__()` on pathlib subclasses (GH-102789)
Barney Gale [Mon, 3 Apr 2023 18:57:11 +0000 (19:57 +0100)] 
GH-76846, GH-85281: Call `__new__()` and `__init__()` on pathlib subclasses (GH-102789)

Fix an issue where `__new__()` and `__init__()` were not called on subclasses of `pathlib.PurePath` and `Path` in some circumstances.

Paths are now normalized on-demand. This speeds up path construction, `p.joinpath(q)`, and `p / q`.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2 years agogh-101865: Deprecate `co_lnotab` from code objects as per PEP 626 (#101866)
Nikita Sobolev [Mon, 3 Apr 2023 15:35:04 +0000 (18:35 +0300)] 
gh-101865: Deprecate `co_lnotab` from code objects as per PEP 626 (#101866)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agoGH-103182: use vectorcall in `_asyncio` instead of variadic calling APIs (#103175)
Kumar Aditya [Mon, 3 Apr 2023 12:44:32 +0000 (18:14 +0530)] 
GH-103182: use vectorcall in `_asyncio` instead of variadic calling APIs (#103175)

2 years agogh-102038: Skip a sometimes unnecessary stat in site.py (#102039)
Shantanu [Sun, 2 Apr 2023 22:47:31 +0000 (15:47 -0700)] 
gh-102038: Skip a sometimes unnecessary stat in site.py (#102039)

2 years agogh-102994: Profile docs has typo in example (#103074)
Nouran Ali [Sun, 2 Apr 2023 22:44:16 +0000 (00:44 +0200)] 
gh-102994: Profile docs has typo in example (#103074)

2 years agogh-103109: Document ignore_warnings() test support helper (#103110)
Charlie Zhao [Sun, 2 Apr 2023 22:18:25 +0000 (06:18 +0800)] 
gh-103109: Document ignore_warnings() test support helper (#103110)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agobpo-4080: unittest durations (#12271)
Giampaolo Rodola [Sun, 2 Apr 2023 22:12:51 +0000 (00:12 +0200)] 
bpo-4080: unittest durations (#12271)

2 years agofix typo in _ssl.c (GH-103192)
Ikko Eltociear Ashimine [Sun, 2 Apr 2023 15:25:46 +0000 (00:25 +0900)] 
fix typo in _ssl.c (GH-103192)

seperated -> separated

Automerge-Triggered-By: GH:AlexWaygood
2 years agogh-102433: Use `inspect.getattr_static` in `typing._ProtocolMeta.__instancecheck__...
Alex Waygood [Sun, 2 Apr 2023 13:22:19 +0000 (14:22 +0100)] 
gh-102433: Use `inspect.getattr_static` in `typing._ProtocolMeta.__instancecheck__` (#103034)

2 years agoGH-102456: Fix docstring and getopt options for base64 (gh-102457) 103190/head
Partha P. Mukherjee [Sun, 2 Apr 2023 05:05:50 +0000 (01:05 -0400)] 
GH-102456: Fix docstring and getopt options for base64 (gh-102457)

2 years agogh-102192: deprecate _PyErr_ChainExceptions (#102935)
Irit Katriel [Sat, 1 Apr 2023 20:30:23 +0000 (21:30 +0100)] 
gh-102192: deprecate _PyErr_ChainExceptions (#102935)

2 years agogh-102192: use PyErr_SetHandledException instead of the legacy PyErr_SetExcInfo ...
Irit Katriel [Sat, 1 Apr 2023 05:01:48 +0000 (06:01 +0100)] 
gh-102192: use PyErr_SetHandledException instead of the legacy PyErr_SetExcInfo (#103157)

2 years agoAdd missing variables to `bytecodes.c` (GH-103153)
Brett Cannon [Fri, 31 Mar 2023 21:23:55 +0000 (14:23 -0700)] 
Add missing variables to `bytecodes.c` (GH-103153)

The code works without this change, but it does cause C tooling to complain less about undeclared variables.

2 years agogh-74690: Micro-optimise `typing._get_protocol_attrs` (#103152)
Alex Waygood [Fri, 31 Mar 2023 20:54:50 +0000 (21:54 +0100)] 
gh-74690: Micro-optimise `typing._get_protocol_attrs` (#103152)

Improve performance of `isinstance()` checks against runtime-checkable protocols

2 years agogh-102549: [Enum] fail enum creation when data type raises in __init__ (GH-103149)
Ethan Furman [Fri, 31 Mar 2023 20:52:31 +0000 (13:52 -0700)] 
gh-102549: [Enum] fail enum creation when data type raises in __init__ (GH-103149)

2 years agogh-101659: Clean Up the General Import Tests for Subinterpreters (gh-103151)
Eric Snow [Fri, 31 Mar 2023 18:18:33 +0000 (12:18 -0600)] 
gh-101659: Clean Up the General Import Tests for Subinterpreters (gh-103151)

This involves 3 changes: some general cleanup, checks to match the kind of module, and switch from testing against sys to _imp.

This is a precursor to gh-103150, though the changes are meant to stand on their own.

2 years agogh-100227: Fix Cleanup of the Extensions Cache (gh-103150)
Eric Snow [Fri, 31 Mar 2023 18:09:10 +0000 (12:09 -0600)] 
gh-100227: Fix Cleanup of the Extensions Cache (gh-103150)

Decref the key in the right interpreter in _extensions_cache_set().

This is a follow-up to gh-103084. I found the bug while working on gh-101660.

2 years agogh-74690: typing: Don't unnecessarily call `_get_protocol_attrs` twice in `_ProtocolM...
Alex Waygood [Fri, 31 Mar 2023 17:37:24 +0000 (18:37 +0100)] 
gh-74690: typing: Don't unnecessarily call `_get_protocol_attrs` twice in `_ProtocolMeta.__instancecheck__` (#103141)

Speed up `isinstance()` calls against runtime-checkable protocols

2 years agogh-87092: move CFG related code from compile.c to flowgraph.c (#103021)
Irit Katriel [Fri, 31 Mar 2023 17:17:59 +0000 (18:17 +0100)] 
gh-87092: move CFG related code from compile.c to flowgraph.c (#103021)

2 years agogh-102871: Remove obsolete browsers from webbrowser (#102872)
James De Bias [Fri, 31 Mar 2023 15:02:47 +0000 (02:02 +1100)] 
gh-102871: Remove obsolete browsers from webbrowser (#102872)

2 years agoGH-84783: Mention Author for GH-101264 (make slices hashable) (#103146)
Furkan Onder [Fri, 31 Mar 2023 13:54:17 +0000 (16:54 +0300)] 
GH-84783: Mention Author for GH-101264 (make slices hashable) (#103146)

Will Bradshaw contributed original patch on bpo-40603.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agoQuote literal tokens in standard format specifier grammar (GH-102902)
Petr Viktorin [Fri, 31 Mar 2023 12:40:38 +0000 (14:40 +0200)] 
Quote literal tokens in standard format specifier grammar (GH-102902)

Reported by Damian Dureck: https://mail.python.org/archives/list/docs@python.org/thread/UZTWBJIXC3MBKTHXVTIBPGDPKBNWZ5LN/

2 years agogh-101100: Expand list of clean docs (GH-103135)
Hugo van Kemenade [Fri, 31 Mar 2023 10:48:46 +0000 (13:48 +0300)] 
gh-101100:  Expand list of clean docs (GH-103135)

Follow on from https://github.com/python/cpython/pull/103116.

Expand list of clean docs files from 3 to 181. These files have no Sphinx warnings, and their presence in this list means that any new warnings introduced will fail the build.

The list was created by subtracting the list of files with warnings from a list of all files.

I tested with all of those, but found that `touch`ing two clean files (https://github.com/python/cpython/blob/main/Doc/includes/wasm-notavail.rst and https://github.com/python/cpython/blob/main/Doc/whatsnew/changelog.rst) caused a cascade effect and resulted in a number of dirty files being rebuilt too, and failing the build. So those two have been omitted.

Automerge-Triggered-By: GH:hugovk
2 years agogh-102799: use exception instance instead of sys.exc_info() (#102885)
Irit Katriel [Fri, 31 Mar 2023 10:23:02 +0000 (11:23 +0100)] 
gh-102799: use exception instance instead of sys.exc_info() (#102885)

2 years agoMinor docs improvements fix for `codeop` (#103123)
gaogaotiantian [Thu, 30 Mar 2023 22:51:36 +0000 (15:51 -0700)] 
Minor docs improvements fix for `codeop` (#103123)

2 years agogh-102110: Add all tools description missed (GH-102625)
Missoupro [Thu, 30 Mar 2023 20:49:07 +0000 (21:49 +0100)] 
gh-102110: Add all tools description missed (GH-102625)

Added missing descriptions of some tools.

Automerge-Triggered-By: GH:hugovk
2 years agoAdd IPv6 into to the docstring for socket.getsockname (#102961)
Brian Haley [Thu, 30 Mar 2023 18:40:58 +0000 (14:40 -0400)] 
Add IPv6 into to the docstring for socket.getsockname (#102961)

Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
2 years agogh-101100: Fix Sphinx warning in gc.rst and refactor docs clean list (#103116)
Hugo van Kemenade [Thu, 30 Mar 2023 18:03:50 +0000 (21:03 +0300)] 
gh-101100: Fix Sphinx warning in gc.rst and refactor docs clean list (#103116)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agogh-103085: Fix python locale.getencoding not to emit deprecation warning (gh-103086)
Jeong, YunWon [Thu, 30 Mar 2023 16:23:43 +0000 (01:23 +0900)] 
gh-103085: Fix python locale.getencoding not to emit deprecation warning (gh-103086)

2 years agogh-103099: Link mypy docs from typing.rst (#103100)
Shantanu [Thu, 30 Mar 2023 08:32:09 +0000 (01:32 -0700)] 
gh-103099: Link mypy docs from typing.rst (#103100)

2 years agogh-100227: Make the Global PyModuleDef Cache Safe for Isolated Interpreters (gh-103084)
Eric Snow [Wed, 29 Mar 2023 23:15:43 +0000 (17:15 -0600)] 
gh-100227: Make the Global PyModuleDef Cache Safe for Isolated Interpreters (gh-103084)

Sharing mutable (or non-immortal) objects between interpreters is generally not safe.  We can work around that but not easily.
 There are two restrictions that are critical for objects that break interpreter isolation.

The first is that the object's state be guarded by a global lock.  For now the GIL meets this requirement, but a granular global lock is needed once we have a per-interpreter GIL.

The second restriction is that the object (and, for a container, its items) be deallocated/resized only when the interpreter in which it was allocated is the current one.  This is because every interpreter has (or will have, see gh-101660) its own object allocator.  Deallocating an object with a different allocator can cause crashes.

The dict for the cache of module defs is completely internal, which simplifies what we have to do to meet those requirements.  To do so, we do the following:

* add a mechanism for re-using a temporary thread state tied to the main interpreter in an arbitrary thread
   * add _PyRuntime.imports.extensions.main_tstate`
   * add _PyThreadState_InitDetached() and _PyThreadState_ClearDetached() (pystate.c)
   * add _PyThreadState_BindDetached() and _PyThreadState_UnbindDetached() (pystate.c)
* make sure the cache dict (_PyRuntime.imports.extensions.dict) and its items are all owned by the main interpreter)
* add a placeholder using for a granular global lock

Note that the cache is only used for legacy extension modules and not for multi-phase init modules.

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

2 years agoGH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)
Brandt Bucher [Wed, 29 Mar 2023 22:53:30 +0000 (15:53 -0700)] 
GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)

2 years agogh-90110: Bring the whitelists up to date. (gh-103114)
Eric Snow [Wed, 29 Mar 2023 22:08:40 +0000 (16:08 -0600)] 
gh-90110: Bring the whitelists up to date. (gh-103114)

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

2 years agoGH-102973: add a dev container (GH-102975)
Brett Cannon [Wed, 29 Mar 2023 20:28:08 +0000 (13:28 -0700)] 
GH-102973: add a dev container (GH-102975)

On content update, builds `python` and the docs. Also adds a Dockerfile that should include everything but autoconf 2.69 that's necessary to build CPython and the entire stdlib on Fedora.

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Dusty Phillips <dusty@phillips.codes>
2 years agogh-103112: Add http.client.HTTPResponse.read docstring and fix pydoc output (#103113)
Bernhard Wagner [Wed, 29 Mar 2023 19:21:56 +0000 (21:21 +0200)] 
gh-103112: Add http.client.HTTPResponse.read docstring and fix pydoc output (#103113)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Éric <merwok@netwok.org>
2 years agogh-103068: Check condition expression of breakpoints for pdb (#103069)
gaogaotiantian [Wed, 29 Mar 2023 10:09:12 +0000 (03:09 -0700)] 
gh-103068: Check condition expression of breakpoints for pdb (#103069)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Artem Mukhin <ortem00@gmail.com>
2 years agogh-102582: Fix invalid JSON in Doc/howto/logging-cookbook.rst (GH-102635)
Matěj Cepl [Wed, 29 Mar 2023 08:52:53 +0000 (10:52 +0200)] 
gh-102582: Fix invalid JSON in Doc/howto/logging-cookbook.rst (GH-102635)

2 years agogh-103054: typing: Improve `Callable` type substitution tests (#103055)
Nikita Sobolev [Wed, 29 Mar 2023 03:04:26 +0000 (06:04 +0300)] 
gh-103054: typing: Improve `Callable` type substitution tests (#103055)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
2 years agogh-103097: Add workaround for Windows ARM64 compiler bug (GH-103098)
Steve Dower [Tue, 28 Mar 2023 23:47:13 +0000 (00:47 +0100)] 
gh-103097: Add workaround for Windows ARM64 compiler bug (GH-103098)

See https://developercommunity.visualstudio.com/t/Regression-in-MSVC-1433-1434-ARM64-co/10224361 for details of the issue. It only applies to version 14.34.

2 years agogh-100227: Move the Dict of Interned Strings to PyInterpreterState (gh-102339)
Eric Snow [Tue, 28 Mar 2023 18:52:28 +0000 (12:52 -0600)] 
gh-100227: Move the Dict of Interned Strings to PyInterpreterState (gh-102339)

We can revisit the options for keeping it global later, if desired.  For now the approach seems quite complex, so we've gone with the simpler isolation solution in the meantime.

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

2 years agoGH-102711: Fix warnings found by clang (#102712)
Chenxi Mao [Tue, 28 Mar 2023 08:52:22 +0000 (16:52 +0800)] 
GH-102711: Fix warnings found by clang (#102712)

There are some warnings if build python via clang:

Parser/pegen.c:812:31: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
_PyPegen_clear_memo_statistics()
                              ^
                               void

Parser/pegen.c:820:29: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
_PyPegen_get_memo_statistics()
                            ^
                             void

Fix it to make clang happy.

Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
2 years agogh-102558: [Enum] better handling of non-Enum EnumType classes (GH-103060)
Ethan Furman [Mon, 27 Mar 2023 23:26:16 +0000 (16:26 -0700)] 
gh-102558: [Enum] better handling of non-Enum EnumType classes (GH-103060)

2 years agogh-103056: [Enum] ensure final _generate_next_value_ is a staticmethod (GH-103062)
Ethan Furman [Mon, 27 Mar 2023 23:25:19 +0000 (16:25 -0700)] 
gh-103056: [Enum] ensure final _generate_next_value_ is a staticmethod (GH-103062)

2 years agogh-74468: [tarfile] Fix incorrect name attribute of ExFileObject (GH-102424)
Oleg Iarygin [Mon, 27 Mar 2023 23:21:07 +0000 (03:21 +0400)] 
gh-74468: [tarfile] Fix incorrect name attribute of ExFileObject (GH-102424)

Co-authored-by: Simeon Visser <svisser@users.noreply.github.com>
2 years agogh-100227: Revert gh-102925 "gh-100227: Make the Global Interned Dict Safe for Isolat...
Eric Snow [Mon, 27 Mar 2023 22:53:05 +0000 (16:53 -0600)] 
gh-100227: Revert gh-102925 "gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters" (gh-103063)

This reverts commit 87be8d9.

This approach to keeping the interned strings safe is turning out to be too complex for my taste (due to obmalloc isolation). For now I'm going with the simpler solution, making the dict per-interpreter. We can revisit that later if we want a sharing solution.

2 years agogh-103046: Display current line correctly for `dis.disco()` with CACHE entries (...
gaogaotiantian [Mon, 27 Mar 2023 22:22:06 +0000 (15:22 -0700)] 
gh-103046: Display current line correctly for `dis.disco()` with CACHE entries (#103047)

2 years agogh-103023: Add SyntaxError check in pdb's `display` command (#103024)
gaogaotiantian [Mon, 27 Mar 2023 20:37:22 +0000 (13:37 -0700)] 
gh-103023: Add SyntaxError check in pdb's `display` command (#103024)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agogh-102941: Fix "‘subobj’ may be used uninitialized in this function" warning in ...
Nikita Sobolev [Mon, 27 Mar 2023 00:05:06 +0000 (03:05 +0300)] 
gh-102941: Fix "‘subobj’ may be used uninitialized in this function" warning in `bytes_methods.c` (#102942)

2 years agoFix typo in _swappedbytes_ in ctypes comment (#102773)
Matthias Görgens [Sat, 25 Mar 2023 23:38:24 +0000 (07:38 +0800)] 
Fix typo in _swappedbytes_ in ctypes comment (#102773)

It's a minor typo, but it makes for a misleading comment.  Let's fix it.

2 years agogh-98886: Fix issues with dataclass fields with special underscore names (#102032)
Shantanu [Sat, 25 Mar 2023 21:40:11 +0000 (14:40 -0700)] 
gh-98886: Fix issues with dataclass fields with special underscore names (#102032)

This commit prefixes `__dataclass` to several things in the locals dict:
- Names like `_dflt_` (which cause trouble, see first test)
- Names like `_type_` (not known to be able to cause trouble)
- `_return_type` (not known to able to cause trouble)
- `_HAS_DEFAULT_FACTORY` (which causes trouble, see second test)

In addition, this removes `MISSING` from the locals dict. As far as I can tell, this wasn't needed even in the initial implementation of dataclasses.py (and tests on that version passed with it removed). This makes me wary :-)

This is basically a continuation of #96151, where fixing this was welcomed in https://github.com/python/cpython/pull/98143#issuecomment-1280306360

2 years agoUpdate pdb docs for arguments (#102965)
gaogaotiantian [Sat, 25 Mar 2023 21:31:45 +0000 (14:31 -0700)] 
Update pdb docs for arguments (#102965)

2 years agoFix typos in faulthandler, testcapi error messages (#103020)
Liyang Zhang [Sat, 25 Mar 2023 21:27:02 +0000 (16:27 -0500)] 
Fix typos in faulthandler, testcapi error messages (#103020)

2 years agogh-103027: Update `dataclass.make_dataclass` docstring (gh-103028)
Nikita Sobolev [Sat, 25 Mar 2023 19:36:38 +0000 (22:36 +0300)] 
gh-103027: Update `dataclass.make_dataclass` docstring (gh-103028)

* gh-103027: Update `dataclass.make_dataclass` docstring

2 years agogh-103025: fix two ctypes doc issues (#103026)
Peter Jiping Xie [Sat, 25 Mar 2023 09:12:00 +0000 (17:12 +0800)] 
gh-103025: fix two ctypes doc issues  (#103026)

2 years agoGH-102833: Mention the key function in the docstrings (GH-103009)
Raymond Hettinger [Sat, 25 Mar 2023 07:19:20 +0000 (02:19 -0500)] 
GH-102833: Mention the key function in the docstrings (GH-103009)

2 years agogh-101100: Test only Doc/ files in nit-picky mode (#103019)
Hugo van Kemenade [Sat, 25 Mar 2023 07:15:02 +0000 (09:15 +0200)] 
gh-101100: Test only Doc/ files in nit-picky mode (#103019)

gh-101100: Filter only Doc/ files

2 years agogh-100131: Add optional delete parameter to tempfile.TemporaryDirectory() (#100132)
JakobDev [Fri, 24 Mar 2023 21:52:06 +0000 (22:52 +0100)] 
gh-100131: Add optional delete parameter to tempfile.TemporaryDirectory() (#100132)

Add optional delete parameter to tempfile.TemporaryDirectory().

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-102980: Add tests for pdf's display, alias and where commands (#102981)
gaogaotiantian [Fri, 24 Mar 2023 20:50:06 +0000 (13:50 -0700)] 
gh-102980: Add tests for pdf's display, alias and where commands (#102981)

2 years agogh-102873: logging.LogRecord docs: improve description of `msg` parameter (#102875)
Amin Alaee [Fri, 24 Mar 2023 15:00:32 +0000 (16:00 +0100)] 
gh-102873: logging.LogRecord docs: improve description of `msg` parameter (#102875)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-100372: Use BIO_eof to detect EOF for SSL_FILETYPE_ASN1 (GH-100373)
David Benjamin [Fri, 24 Mar 2023 13:04:30 +0000 (09:04 -0400)] 
gh-100372: Use BIO_eof to detect EOF for SSL_FILETYPE_ASN1 (GH-100373)

In PEM, we need to parse until error and then suppress `PEM_R_NO_START_LINE`, because PEM allows arbitrary leading and trailing data. DER, however, does not. Parsing until error and suppressing `ASN1_R_HEADER_TOO_LONG` doesn't quite work because that error also covers some cases that should be rejected.

Instead, check `BIO_eof` early and stop the loop that way.

Automerge-Triggered-By: GH:Yhg1s
2 years agogh-101100: Test docs in nit-picky mode (#102513)
Hugo van Kemenade [Fri, 24 Mar 2023 11:23:35 +0000 (13:23 +0200)] 
gh-101100: Test docs in nit-picky mode (#102513)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 years agoGH-100989: remove annotation from docstring (GH-102991)
Raymond Hettinger [Fri, 24 Mar 2023 05:39:12 +0000 (00:39 -0500)] 
GH-100989: remove annotation from docstring (GH-102991)

2 years agoGH-100989: Revert Improve the accuracy of collections.deque docstrings (GH-102979)
Raymond Hettinger [Fri, 24 Mar 2023 00:50:17 +0000 (19:50 -0500)] 
GH-100989: Revert Improve the accuracy of collections.deque docstrings (GH-102979)

2 years agogh-94684: uuid: support bytes in the name argument to uuid3/5 (#94709)
MonadChains [Thu, 23 Mar 2023 23:42:43 +0000 (00:42 +0100)] 
gh-94684: uuid: support bytes in the name argument to uuid3/5 (#94709)

RFC 4122 does not specify that name should be a string, so for completness the functions should also support a name given as a raw byte sequence.

2 years agogh-99726: Fix order of recently added fields for FILE_STAT_BASIC_INFORMATION (GH...
Steve Dower [Thu, 23 Mar 2023 23:27:46 +0000 (23:27 +0000)] 
gh-99726: Fix order of recently added fields for FILE_STAT_BASIC_INFORMATION (GH-102976)

2 years agoGH-100982: Break up COMPARE_AND_BRANCH (GH-102801)
Brandt Bucher [Thu, 23 Mar 2023 22:25:09 +0000 (15:25 -0700)] 
GH-100982: Break up COMPARE_AND_BRANCH (GH-102801)

2 years agogh-102558: [Enum] fix AttributeError during member repr() (GH-102601)
Dong-hee Na [Thu, 23 Mar 2023 20:30:18 +0000 (05:30 +0900)] 
gh-102558: [Enum] fix AttributeError during member repr() (GH-102601)

2 years agoMinor readability improvement to the factor() recipe (GH-102971)
Raymond Hettinger [Thu, 23 Mar 2023 19:46:15 +0000 (14:46 -0500)] 
Minor readability improvement to the factor() recipe (GH-102971)

2 years agogh-98239: Document that `inspect.getsource()` can raise `TypeError` (#101689)
Nikita Sobolev [Thu, 23 Mar 2023 19:35:02 +0000 (22:35 +0300)] 
gh-98239: Document that `inspect.getsource()` can raise `TypeError` (#101689)

2 years agogh-102936: typing: document performance pitfalls of protocols decorated with `@runtim...
Alex Waygood [Thu, 23 Mar 2023 18:18:53 +0000 (18:18 +0000)] 
gh-102936: typing: document performance pitfalls of protocols decorated with `@runtime_checkable` (#102937)

2 years agoMove binomialvariate() to a section for discrete distributions (GH-102955)
Raymond Hettinger [Thu, 23 Mar 2023 17:10:12 +0000 (12:10 -0500)] 
Move binomialvariate() to a section for discrete distributions (GH-102955)

2 years agogh-102810 Improve the sphinx docs for `asyncio.Timeout` (#102934)
JosephSBoyle [Thu, 23 Mar 2023 16:43:13 +0000 (16:43 +0000)] 
gh-102810 Improve the sphinx docs for `asyncio.Timeout` (#102934)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-102943: Stop checking localized error text in socket tests on Windows (GH-102944)
AN Long [Thu, 23 Mar 2023 16:34:48 +0000 (00:34 +0800)] 
gh-102943: Stop checking localized error text in socket tests on Windows (GH-102944)

2 years agogh-88965: typing: fix type substitution of a list of types after initial `ParamSpec...
Nikita Sobolev [Thu, 23 Mar 2023 16:26:11 +0000 (19:26 +0300)] 
gh-88965: typing: fix type substitution of a list of types  after initial `ParamSpec` substitution (#102808)

Previously, this used to fail:

```py
from typing import *
T = TypeVar("T")
P = ParamSpec("P")

class X(Generic[P]):
    f: Callable[P, int]

Y = X[[int, T]]
Z = Y[str]
```

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-102947: Improve traceback when calling `fields()` on a non-dataclass (#102948)
Alex Waygood [Thu, 23 Mar 2023 14:17:54 +0000 (14:17 +0000)] 
gh-102947: Improve traceback when calling `fields()` on a non-dataclass (#102948)

2 years agoDocs: fixup incorrect escape char in sqlite3 docs (#102945)
Erlend E. Aasland [Thu, 23 Mar 2023 13:21:32 +0000 (14:21 +0100)] 
Docs: fixup incorrect escape char in sqlite3 docs (#102945)

2 years agogh-102939: Fix "conversion from Py_ssize_t to long" warning in builtins (GH-102940)
Nikita Sobolev [Thu, 23 Mar 2023 10:37:04 +0000 (13:37 +0300)] 
gh-102939: Fix "conversion from Py_ssize_t to long" warning in builtins (GH-102940)

2 years agogh-100227: Make the Global Interned Dict Safe for Isolated Interpreters (gh-102925)
Eric Snow [Thu, 23 Mar 2023 00:30:04 +0000 (18:30 -0600)] 
gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters (gh-102925)

This is effectively two changes.  The first (the bulk of the change) is where we add _Py_AddToGlobalDict() (and _PyRuntime.cached_objects.main_tstate, etc.).  The second (much smaller) change is where we update PyUnicode_InternInPlace() to use _Py_AddToGlobalDict() instead of calling PyDict_SetDefault() directly.

Basically, _Py_AddToGlobalDict() is a wrapper around PyDict_SetDefault() that should be used whenever we need to add a value to a runtime-global dict object (in the few cases where we are leaving the container global rather than moving it to PyInterpreterState, e.g. the interned strings dict).  _Py_AddToGlobalDict() does all the necessary work to make sure the target global dict is shared safely between isolated interpreters.  This is especially important as we move the obmalloc state to each interpreter (gh-101660), as well as, potentially, the GIL (PEP 684).

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

2 years ago[doc] Fix error in tutorial example: type(exc) is the type rather than the instance...
Jens-Hilmar Bradt [Wed, 22 Mar 2023 18:43:41 +0000 (19:43 +0100)] 
[doc] Fix error in tutorial example: type(exc) is the type rather than the instance (#102751)

2 years agogh-102921: [doc] Clarify `exc` argument name in `BaseExceptionGroup` is plural (...
Kevin Kirsche [Wed, 22 Mar 2023 18:14:05 +0000 (14:14 -0400)] 
gh-102921: [doc] Clarify `exc` argument name in `BaseExceptionGroup` is plural (#102922)

2 years agogh-102859: Remove JUMP_IF_FALSE_OR_POP and JUMP_IF_TRUE_OR_POP (#102870)
Irit Katriel [Wed, 22 Mar 2023 18:10:48 +0000 (18:10 +0000)] 
gh-102859: Remove JUMP_IF_FALSE_OR_POP and JUMP_IF_TRUE_OR_POP (#102870)

2 years agogh-102780: Fix uncancel() call in asyncio timeouts (#102815)
Kristján Valur Jónsson [Wed, 22 Mar 2023 17:52:10 +0000 (17:52 +0000)] 
gh-102780: Fix uncancel() call in asyncio timeouts (#102815)

Also use `raise TimeOut from <CancelledError instance>` so that the CancelledError is set
in the `__cause__` field rather than in the `__context__` field.

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-102033: Fix syntax error in `Tools/c-analyzer` (GH-102066)
Nikita Sobolev [Wed, 22 Mar 2023 14:59:32 +0000 (17:59 +0300)] 
gh-102033: Fix syntax error in `Tools/c-analyzer` (GH-102066)

The easiest way to format strings with `{}` meaningful chars is via `%`.

2 years agoGH-101291: Rearrange the size bits in PyLongObject (GH-102464)
Mark Shannon [Wed, 22 Mar 2023 14:49:51 +0000 (14:49 +0000)] 
GH-101291: Rearrange the size bits in PyLongObject (GH-102464)

* Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts.

* Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints.

* Add functions to hide some internals of long object, and for setting sign and digit count.

* Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().

2 years agoGH-89727: Fix pathlib.Path.walk RecursionError on deep trees (GH-100282)
Stanislav Zmiev [Wed, 22 Mar 2023 14:45:25 +0000 (18:45 +0400)] 
GH-89727: Fix pathlib.Path.walk RecursionError on deep trees (GH-100282)

Use a stack to implement `pathlib.Path.walk()` iteratively instead of recursively to avoid hitting recursion limits on deeply nested trees.

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
2 years agogh-96931: Fix incorrect results in ssl.SSLSocket.shared_ciphers (#96932)
Benjamin Fogle [Wed, 22 Mar 2023 14:08:41 +0000 (10:08 -0400)] 
gh-96931: Fix incorrect results in ssl.SSLSocket.shared_ciphers (#96932)

2 years agogh-102027: Fix macro name (#102124)
Max Bachmann [Wed, 22 Mar 2023 13:44:28 +0000 (14:44 +0100)] 
gh-102027: Fix macro name (#102124)

This fixes the ssse3 / sse2 detection when sse4 is available.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agogh-101947: Remove size check from sqlite3 serialize test (#102914)
Erlend E. Aasland [Wed, 22 Mar 2023 13:05:08 +0000 (14:05 +0100)] 
gh-101947: Remove size check from sqlite3 serialize test (#102914)

The size of the returned data is too implementation specific.