]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoGH-100892: consolidate `HEAD_LOCK/HEAD_UNLOCK` macros (#100953)
Kumar Aditya [Sun, 15 Jan 2023 15:09:26 +0000 (20:39 +0530)] 
GH-100892: consolidate `HEAD_LOCK/HEAD_UNLOCK` macros (#100953)

2 years agogh-100668: Clarify how sqlite3 maps parameters onto placeholders (#100960)
Erlend E. Aasland [Sat, 14 Jan 2023 22:58:06 +0000 (23:58 +0100)] 
gh-100668: Clarify how sqlite3 maps parameters onto placeholders (#100960)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agogh-94518: [_posixsubprocess] Replace variable validity flags with reserved values...
Oleg Iarygin [Sat, 14 Jan 2023 20:11:04 +0000 (00:11 +0400)] 
gh-94518: [_posixsubprocess] Replace variable validity flags with reserved values (#94687)

Have _posixsubprocess.c stop using boolean flags to say if gid and uid values were supplied and action is required.  Such an implicit "either initialized or look somewhere else" confused both the reader (another mental connection to constantly track between functions) and a compiler (warnings on potentially uninitialized variables being passed). Instead, we can utilize a special group/user id as a flag value -1 defined by POSIX but used nowhere else. Namely:

gid: call_setgid = False → gid = -1

uid: call_setuid = False → uid = -1

groups: call_setgroups = False → groups = NULL (obtained with (groups_list != Py_None) ? groups : NULL)

This PR is required for #94519.

2 years agogh-101021: Document binary parameters as bytes (#101024)
Bob Kline [Sat, 14 Jan 2023 19:01:27 +0000 (14:01 -0500)] 
gh-101021: Document binary parameters as bytes (#101024)

2 years agoSync-up parameter name in equivalent code snippet of `enumerate` (GH-101029)
JustAnotherArchivist [Sat, 14 Jan 2023 05:55:35 +0000 (05:55 +0000)] 
Sync-up parameter name in equivalent code snippet of `enumerate` (GH-101029)

2 years agoGH-98831: Identify instructions that don't use oparg (#100957)
Guido van Rossum [Sat, 14 Jan 2023 01:06:45 +0000 (17:06 -0800)] 
GH-98831: Identify instructions that don't use oparg (#100957)

For these the instr_format field uses IX instead of IB.
Register instructions use IX, IB, IBBX, IBBB, etc.

Also: Include the closing '}' in Block.tokens, for completeness

2 years agoAdd recipes to showcase tee(), zip*, batched, starmap, and product. (GH-101023)
Raymond Hettinger [Sat, 14 Jan 2023 01:01:22 +0000 (19:01 -0600)] 
Add recipes to showcase tee(), zip*, batched, starmap, and product. (GH-101023)

2 years agoFix typo in docs (GH-101025)
Raymond Hettinger [Sat, 14 Jan 2023 00:53:06 +0000 (18:53 -0600)] 
Fix typo in docs (GH-101025)

2 years agogh-74033: Fix bug when Path takes and ignores **kwargs (GH-19632)
Yurii Karabas [Sat, 14 Jan 2023 00:05:43 +0000 (02:05 +0200)] 
gh-74033: Fix bug when Path takes and ignores **kwargs (GH-19632)

Fix a bug where `Path` takes and ignores `**kwargs` by adding to `PurePath`  class `__init__` method which can take only positional arguments.

Automerge-Triggered-By: GH:brettcannon
2 years agoGH-100573: Fix server hang caused by os.stat() on named pipe (Windows) (#100959)
Guido van Rossum [Fri, 13 Jan 2023 21:24:57 +0000 (13:24 -0800)] 
GH-100573: Fix server hang caused by os.stat() on named pipe (Windows) (#100959)

2 years agoDon't double count misses. (GH-100984)
Mark Shannon [Fri, 13 Jan 2023 15:57:39 +0000 (15:57 +0000)] 
Don't double count misses. (GH-100984)

2 years agogh-100160: Restore and deprecate implicit creation of an event loop (GH-100410)
Serhiy Storchaka [Fri, 13 Jan 2023 12:40:29 +0000 (14:40 +0200)] 
gh-100160: Restore and deprecate implicit creation of an event loop (GH-100410)

Partially revert changes made in GH-93453.

asyncio.DefaultEventLoopPolicy.get_event_loop() now emits a
DeprecationWarning and creates and sets a new event loop instead of
raising a RuntimeError if there is no current event loop set.

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2 years agogh-100247: Fix py.exe launcher not using entire shebang command for finding custom...
Steve Dower [Fri, 13 Jan 2023 11:49:01 +0000 (11:49 +0000)] 
gh-100247: Fix py.exe launcher not using entire shebang command for finding custom commands (GH-100944)

2 years agogh-86682: Adds sys._getframemodulename as an alternative to using _getframe (GH-99520)
Steve Dower [Fri, 13 Jan 2023 11:31:06 +0000 (11:31 +0000)] 
gh-86682: Adds sys._getframemodulename as an alternative to using _getframe (GH-99520)

Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available.

2 years agoGH-100942: Fix incorrect cast in property_copy(). (#100965)
Raymond Hettinger [Thu, 12 Jan 2023 22:13:56 +0000 (16:13 -0600)] 
GH-100942: Fix incorrect cast in property_copy(). (#100965)

2 years agoGH-100997: Implement Multi-Phase Init for the _testinternalcapi Module (gh-100998)
Eric Snow [Thu, 12 Jan 2023 20:42:03 +0000 (13:42 -0700)] 
GH-100997: Implement Multi-Phase Init for the _testinternalcapi Module (gh-100998)

_testinternalcapi is an internal module used for testing.

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

2 years agogh-96290: Support partial/invalid UNC drives in ntpath.normpath() and splitdrive...
Barney Gale [Thu, 12 Jan 2023 19:24:57 +0000 (19:24 +0000)] 
gh-96290: Support partial/invalid UNC drives in ntpath.normpath() and splitdrive() (GH-100351)

This brings the Python implementation of `ntpath.normpath()` in line with the C implementation added in 99fcf15

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2 years agogh-96461: Improve docs for bytecode instructions (GH-96462)
Matthieu Dartiailh [Thu, 12 Jan 2023 18:23:50 +0000 (19:23 +0100)] 
gh-96461: Improve docs for bytecode instructions  (GH-96462)

* Clarify the meaning of the oparg for CACHE and COPY opcode in dis doc

* Use STACK to describe stack operation in analogy with a Python list

* Remove (delta) from BEFORE_WITH since BEFORE_WITH does not take an argument

* Fix the description of the stack impact of multiple opcodes

2 years agoGH-81381: Add longer comment _PyType_AllocNoTrack() (GH-100954)
Neil Schemenauer [Thu, 12 Jan 2023 18:03:50 +0000 (10:03 -0800)] 
GH-81381: Add longer comment _PyType_AllocNoTrack() (GH-100954)

The details on the "nitems+1" expression is a bit subtle so add a longer
comment about it.

2 years agoFix typo in `enum` module documentation (#100992)
Noam Cohen [Thu, 12 Jan 2023 15:40:29 +0000 (17:40 +0200)] 
Fix typo in `enum` module documentation (#100992)

2 years agoGH-100894: Updated the doc for `sys.winver` to clarify its usual contents (GH-100913)
ram vikram singh [Thu, 12 Jan 2023 00:11:12 +0000 (05:41 +0530)] 
GH-100894: Updated the doc for `sys.winver` to clarify its usual contents (GH-100913)

2 years agogh-98636: Fix detecting gdbm_compat for _dbm module (#98643)
Michał Górny [Wed, 11 Jan 2023 21:46:28 +0000 (22:46 +0100)] 
gh-98636: Fix detecting gdbm_compat for _dbm module (#98643)

Fix the gdbm_compat library detection logic to actually check for
-lgdbm_compat independently of the ndbm detection.
This fixes the build failure with `--with-dbmliborder=gdbm`,
and implicit fallback to ndbm with the default value.

2 years agogh-94912: Adjusted check for non-standard coroutine function marker. (#100935)
Carlton Gibson [Wed, 11 Jan 2023 21:17:26 +0000 (22:17 +0100)] 
gh-94912: Adjusted check for non-standard coroutine function marker. (#100935)

The initial implementation did not correctly identify explicitly
marked class instances.

Follow up to 532aa4e4e019812d0388920768ede7c04232ebe1

2 years agoGH-100923: Embed jump mask in `COMPARE_OP` oparg (GH-100924)
Mark Shannon [Wed, 11 Jan 2023 20:40:43 +0000 (20:40 +0000)] 
GH-100923: Embed jump mask in `COMPARE_OP` oparg (GH-100924)

2 years agoEnsure some build files include a newline at to avoid warnings (GH-100946)
th1722 [Wed, 11 Jan 2023 17:28:57 +0000 (02:28 +0900)] 
Ensure some build files include a newline at to avoid warnings (GH-100946)

2 years agoSkip py.exe launcher tests in full layout CI test (GH-100948)
Steve Dower [Wed, 11 Jan 2023 17:25:46 +0000 (17:25 +0000)] 
Skip py.exe launcher tests in full layout CI test (GH-100948)

These tests become flaky when py.exe exists on the test machine but isn't the one that was just built. They also don't provide any useful information for this scenario, so easiest to just skip them.

2 years agogh-100871: Improve `copy` module tests (GH-100872)
Nikita Sobolev [Wed, 11 Jan 2023 17:14:41 +0000 (20:14 +0300)] 
gh-100871: Improve `copy` module tests (GH-100872)

CC @AlexWaygood as the reviewer of https://github.com/python/cpython/pull/100818

Automerge-Triggered-By: GH:AlexWaygood
2 years agoGH-100892: Fix race in clearing `threading.local` (#100922)
Kumar Aditya [Wed, 11 Jan 2023 10:33:31 +0000 (16:03 +0530)] 
GH-100892: Fix race in clearing `threading.local` (#100922)

2 years agogh-98763: Prefer "python" over "python3" for command line examples in docs. (#98761)
Mariusz Felisiak [Wed, 11 Jan 2023 10:05:41 +0000 (11:05 +0100)] 
gh-98763: Prefer "python" over "python3" for command line examples in docs. (#98761)

2 years agogh-100931: Test all `pickle` protocols in `test_slice` (#100932)
Nikita Sobolev [Wed, 11 Jan 2023 09:43:45 +0000 (12:43 +0300)] 
gh-100931: Test all `pickle` protocols in `test_slice` (#100932)

2 years agoPost 3.12.0a4
Thomas Wouters [Tue, 10 Jan 2023 16:40:11 +0000 (17:40 +0100)] 
Post 3.12.0a4

2 years agoPython 3.12.0a4 v3.12.0a4
Thomas Wouters [Tue, 10 Jan 2023 12:07:54 +0000 (13:07 +0100)] 
Python 3.12.0a4

2 years agoGH-100117: Make `co_lines` more efficient (GH-100447)
Brandt Bucher [Tue, 10 Jan 2023 10:56:53 +0000 (02:56 -0800)] 
GH-100117: Make `co_lines` more efficient (GH-100447)

2 years agogh-100916: Convert argument to appropriate type (GH-100917)
Yao-Ching Huang [Tue, 10 Jan 2023 10:17:57 +0000 (18:17 +0800)] 
gh-100916: Convert argument to appropriate type (GH-100917)

2 years agoFix typos in Doc folder (#100880)
Semen Zhydenko [Tue, 10 Jan 2023 09:04:06 +0000 (10:04 +0100)] 
Fix typos in Doc folder (#100880)

2 years agogh-100180: Update macOS installer to OpenSSL 1.1.1s (GH-100908)
Ned Deily [Tue, 10 Jan 2023 05:10:31 +0000 (00:10 -0500)] 
gh-100180: Update macOS installer to OpenSSL 1.1.1s (GH-100908)

2 years agogh-100893: update bpo reference in Mac README (GH-100905)
Ned Deily [Tue, 10 Jan 2023 03:37:10 +0000 (22:37 -0500)] 
gh-100893: update bpo reference in Mac README (GH-100905)

2 years agoGH-98831: Refactor instr format code and change to enum (#100895)
Guido van Rossum [Mon, 9 Jan 2023 23:53:01 +0000 (15:53 -0800)] 
GH-98831: Refactor instr format code and change to enum (#100895)

2 years agogh-100180: Update Windows installer to OpenSSL 1.1.1s (GH-100901)
Steve Dower [Mon, 9 Jan 2023 23:50:59 +0000 (23:50 +0000)] 
gh-100180: Update Windows installer to OpenSSL 1.1.1s (GH-100901)

2 years agobpo-28356: Document os.rename() behavior on Windows for differing volumes (GH-27376)
Ryan Ozawa [Mon, 9 Jan 2023 21:43:09 +0000 (13:43 -0800)] 
bpo-28356: Document os.rename() behavior on Windows for differing volumes (GH-27376)

2 years agoGH-100126: Skip incomplete frames in more places (GH-100613)
Brandt Bucher [Mon, 9 Jan 2023 20:20:04 +0000 (12:20 -0800)] 
GH-100126: Skip incomplete frames in more places (GH-100613)

2 years agogh-100882: Improve `test_pickling` case in `test_ast.py` (#100883)
Nikita Sobolev [Mon, 9 Jan 2023 19:20:25 +0000 (22:20 +0300)] 
gh-100882: Improve `test_pickling` case in `test_ast.py` (#100883)

2 years agogh-99191: Use correct check for MSVC C++ version support in _wmimodule.cpp (GH-100381)
C.A.M. Gerlach [Mon, 9 Jan 2023 17:48:24 +0000 (11:48 -0600)] 
gh-99191: Use correct check for MSVC C++ version support in _wmimodule.cpp (GH-100381)

2 years agogh-100873: Fix "‘lo’ may be used uninitialized in this function" warning in `mathmodu...
Nikita Sobolev [Mon, 9 Jan 2023 15:51:24 +0000 (18:51 +0300)] 
gh-100873: Fix "‘lo’ may be used uninitialized in this function" warning in `mathmodule.c` (#100881)

2 years agoGH-81061: Fix refcount issue when returning `None` from a `ctypes.py_object` callback...
dgelessus [Mon, 9 Jan 2023 10:13:04 +0000 (11:13 +0100)] 
GH-81061: Fix refcount issue when returning `None` from a `ctypes.py_object` callback (#13364)

2 years agofix up mock tests coverage (#100874)
Chris Withers [Mon, 9 Jan 2023 10:08:56 +0000 (10:08 +0000)] 
fix up mock tests coverage (#100874)

2 years agogh-100764: add `pycore_frame.h` to PYTHON_HEADERS and Windows build files(#100765)
Carl Meyer [Mon, 9 Jan 2023 09:05:56 +0000 (02:05 -0700)] 
gh-100764: add `pycore_frame.h` to PYTHON_HEADERS and Windows build files(#100765)

2 years agoGH-100813: Add `socket.IP_PKTINFO` constant (#10294)
dsentinel [Mon, 9 Jan 2023 09:00:40 +0000 (01:00 -0800)] 
GH-100813: Add `socket.IP_PKTINFO` constant (#10294)

2 years agoUpdate copyright year in README (GH-100863)
Ned Deily [Mon, 9 Jan 2023 02:53:56 +0000 (21:53 -0500)] 
Update copyright year in README (GH-100863)

Co-authored-by: HARSHA VARDHAN <75431678+Thunder-007@users.noreply.github.com>
2 years agogh-87447: Fix walrus comprehension rebind checking (#100581)
Nikita Sobolev [Sun, 8 Jan 2023 22:51:29 +0000 (01:51 +0300)] 
gh-87447: Fix walrus comprehension rebind checking (#100581)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agoUpdate additional copyright years to 2023. (GH-100859)
Ned Deily [Sun, 8 Jan 2023 22:05:28 +0000 (17:05 -0500)] 
Update additional copyright years to 2023. (GH-100859)

2 years agoGH-100805: Support numpy.array() in random.choice(). (GH-100830)
Raymond Hettinger [Sun, 8 Jan 2023 19:40:35 +0000 (13:40 -0600)] 
GH-100805:  Support numpy.array() in random.choice(). (GH-100830)

2 years agogh-100833: Remove 'volatile' qualifiers in fsum algorithm (#100845)
Mark Dickinson [Sun, 8 Jan 2023 19:40:15 +0000 (19:40 +0000)] 
gh-100833: Remove 'volatile' qualifiers in fsum algorithm (#100845)

This PR removes the `volatile` qualifier on various intermediate quantities
in the `math.fsum` implementation, and updates the notes preceding the
algorithm accordingly (as well as fixing some of the exsting notes). See
the linked issue #100833 for discussion.

2 years agoGH-100485: Tweaks to sumprod() (GH-100857)
Raymond Hettinger [Sun, 8 Jan 2023 19:38:24 +0000 (13:38 -0600)] 
GH-100485: Tweaks to sumprod() (GH-100857)

2 years agoUpdate copyright years to 2023. (gh-100848)
Benjamin Peterson [Sun, 8 Jan 2023 15:13:25 +0000 (09:13 -0600)] 
Update copyright years to 2023. (gh-100848)

2 years agoGH-90829: Fix empty iterable error message in min/max (#31181)
Nnarol [Sun, 8 Jan 2023 13:51:20 +0000 (14:51 +0100)] 
GH-90829: Fix empty iterable error message in min/max (#31181)

2 years agogh-100689: Revert "bpo-41798: pyexpat: Allocate the expat_CAPI on the heap memory...
Nikita Sobolev [Sun, 8 Jan 2023 12:54:40 +0000 (15:54 +0300)] 
gh-100689: Revert "bpo-41798: pyexpat: Allocate the expat_CAPI on the heap memory (GH-24061)" (#100745)

* gh-100689: Revert "bpo-41798: pyexpat: Allocate the expat_CAPI on the heap memory (GH-24061)"

This reverts commit 7c83eaa536d2f436ae46211ca48692f576c732f0.

2 years agogh-100783: fix os.path.join documentation (#100811)
Shantanu [Sun, 8 Jan 2023 08:51:30 +0000 (00:51 -0800)] 
gh-100783: fix os.path.join documentation (#100811)

- Use "drive", not "drive letter", because of UNC paths
- Previous components are not thrown away from relative drive letters
- Use "segment" instead of "component" for consistency with pathlib
- Other miscellaneous improvements

2 years agogh-91851: Micro optimizations for arithmetic between Fractions (#25518)
Sergey B Kirpichev [Sun, 8 Jan 2023 08:34:20 +0000 (11:34 +0300)] 
gh-91851: Micro optimizations for arithmetic between Fractions (#25518)

Adapted from
https://github.com/python/cpython/pull/24779/commits/046c84e8f9

This makes arithmetic between Fractions with small components
just as fast as before python/cpython#24779, at some expense of
mixed arithmetic (e.g. Fraction + int).

2 years agogh-100824: Fix typo in the documentation of unittest.TestLoader.testNamePatterns...
busywhitespace [Sun, 8 Jan 2023 08:07:16 +0000 (09:07 +0100)] 
gh-100824: Fix typo in the documentation of unittest.TestLoader.testNamePatterns (#100825)

2 years agogh-100776: Fix misleading default value in help(input) (#100788)
Shantanu [Sun, 8 Jan 2023 07:57:41 +0000 (23:57 -0800)] 
gh-100776: Fix misleading default value in help(input) (#100788)

2 years agoGH-100485: Convert from Fast2Sum to 2Sum (GH-100836)
Raymond Hettinger [Sun, 8 Jan 2023 03:37:08 +0000 (21:37 -0600)] 
GH-100485: Convert from Fast2Sum to 2Sum (GH-100836)

2 years agogh-100815: Normalize `types` module usage in `copy` module (#100816)
Nikita Sobolev [Sat, 7 Jan 2023 21:29:53 +0000 (00:29 +0300)] 
gh-100815: Normalize `types` module usage in `copy` module (#100816)

2 years agogh-100792: Make `email.message.Message.__contains__` twice as fast (#100793)
Nikita Sobolev [Sat, 7 Jan 2023 21:26:05 +0000 (00:26 +0300)] 
gh-100792: Make `email.message.Message.__contains__` twice as fast (#100793)

2 years agoGH-100485: Add math.sumprod() (GH-100677)
Raymond Hettinger [Sat, 7 Jan 2023 18:46:35 +0000 (12:46 -0600)] 
GH-100485:  Add math.sumprod() (GH-100677)

2 years agogh-100673: Removed erroneous note in the get_type_hints docs (#100701)
FrozenBob [Sat, 7 Jan 2023 17:31:47 +0000 (09:31 -0800)] 
gh-100673: Removed erroneous note in the get_type_hints docs (#100701)

Removed erroneous note in the get_type_hints docs

typing.get_type_hints still includes base class type hints.

2 years agogh-88696: clean up dead argument to compiler_make_closure (GH-100806)
Carl Meyer [Sat, 7 Jan 2023 12:20:48 +0000 (05:20 -0700)] 
gh-88696: clean up dead argument to compiler_make_closure (GH-100806)

2 years agogh-96127: Fix `inspect.signature` call on mocks (#96335)
Nikita Sobolev [Sat, 7 Jan 2023 10:49:15 +0000 (13:49 +0300)] 
gh-96127: Fix `inspect.signature` call on mocks (#96335)

2 years agogh-100690: [mock] hide `ATTRIB_DENY_LIST` and make it immutable (#100819)
Nikita Sobolev [Sat, 7 Jan 2023 10:25:05 +0000 (13:25 +0300)] 
gh-100690: [mock] hide `ATTRIB_DENY_LIST` and make it immutable (#100819)

2 years agoAdd barneygale to CODEOWNERS for pathlib (#100808)
Barney Gale [Fri, 6 Jan 2023 20:38:12 +0000 (20:38 +0000)] 
Add barneygale to CODEOWNERS for pathlib (#100808)

2 years agogh-100690: Raise an AttributeError when the assert_ prefix is forgotten when using...
Christian Klein [Fri, 6 Jan 2023 18:38:50 +0000 (19:38 +0100)] 
gh-100690: Raise an AttributeError when the assert_ prefix is forgotten when using Mock (#100691)

Mock objects which are not unsafe will now raise an AttributeError when accessing an
attribute that matches the name of an assertion but without the prefix `assert_`, e.g. accessing `called_once` instead of `assert_called_once`.

This is in addition to this already happening for accessing attributes with prefixes assert, assret, asert, aseert, and assrt.

2 years agoGH-98831: Add some tests for generate_cases.py (#100763)
Guido van Rossum [Fri, 6 Jan 2023 16:04:20 +0000 (08:04 -0800)] 
GH-98831: Add some tests for generate_cases.py (#100763)

- This doesn't cover everything (far from it) but it's a start.
- This uses pytest, which isn't ideal, but was quickest to get started.

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-91851: Trivial optimizations in Fraction (#100791)
Sergey B Kirpichev [Fri, 6 Jan 2023 15:37:34 +0000 (18:37 +0300)] 
gh-91851: Trivial optimizations in Fraction (#100791)

Make some trivial performance optimizations in Fraction

Uses private class attributes `_numerator` and `_denominator` in place of the `numerator` and `denominator` property accesses.

Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
2 years agogh-100758: Refactor initialisation of frame headers into a single function (_PyFrame_...
Irit Katriel [Fri, 6 Jan 2023 14:55:56 +0000 (14:55 +0000)] 
gh-100758: Refactor initialisation of frame headers into a single function (_PyFrame_Initialize) (GH-100759)

2 years agoGH-99005: More intrinsics (GH-100774)
Mark Shannon [Fri, 6 Jan 2023 14:47:57 +0000 (14:47 +0000)] 
GH-99005: More intrinsics (GH-100774)

* Remove UNARY_POSITIVE, LIST_TO_TUPLE and ASYNC_GEN_WRAP, replacing them with intrinsics.

2 years agogh-99026 update dataclasses docs for when annotations are inspected (gh-100798)
Akshit Tyagi [Fri, 6 Jan 2023 14:26:44 +0000 (19:56 +0530)] 
gh-99026 update dataclasses docs for when annotations are inspected (gh-100798)

update dataclasses docs for when annotations are inspected

2 years agogh-87691: clarify use of anchor in pathlib docs (#100782)
Shantanu [Fri, 6 Jan 2023 01:49:33 +0000 (17:49 -0800)] 
gh-87691: clarify use of anchor in pathlib docs (#100782)

This is feedback from https://github.com/python/cpython/pull/100737#discussion_r1062968696

This matches the wording from the `os.path.join` docs better:
https://docs.python.org/3/library/os.path.html#os.path.join

In particular, the previous use of "anchor" was incorrect given the
pathlib definition of "anchor".

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2 years agogh-90104: avoid RecursionError on recursive dataclass field repr (gh-100756)
Carl Meyer [Fri, 6 Jan 2023 00:19:40 +0000 (17:19 -0700)] 
gh-90104: avoid RecursionError on recursive dataclass field repr (gh-100756)

Avoid RecursionError on recursive dataclass field repr

2 years agogh-86082: bpo-41916: allow cross-compiled python to have -pthread set for CXX (#22525)
Dustin Spicuzza [Thu, 5 Jan 2023 22:57:31 +0000 (17:57 -0500)] 
gh-86082: bpo-41916: allow cross-compiled python to have -pthread set for CXX (#22525)

When cross-compiling, the compile/run test for -pthread always fails so -pthread
will never be automatically set without an override from the cache. ac_cv_pthread
can already be overridden, so do the same thing for ac_cv_cxx_thread.

2 years agogh-87691: add an absolute path pathlib example in / operator docs (GH-100737)
Shantanu [Thu, 5 Jan 2023 22:55:35 +0000 (14:55 -0800)] 
gh-87691: add an absolute path pathlib example in / operator docs (GH-100737)

The behaviour is fully explained a couple paragraphs above, but it may be useful to have a brief example to cover the behaviour.

Automerge-Triggered-By: GH:hauntsaninja
2 years agoAdd hauntsaninja as tomllib CODEOWNER (#100779)
Shantanu [Thu, 5 Jan 2023 22:28:02 +0000 (14:28 -0800)] 
Add hauntsaninja as tomllib CODEOWNER (#100779)

2 years agogh-100562: improve performance of `pathlib.Path.absolute()` (GH-100563)
Barney Gale [Thu, 5 Jan 2023 22:11:50 +0000 (22:11 +0000)] 
gh-100562: improve performance of `pathlib.Path.absolute()` (GH-100563)

Increase performance of the `absolute()` method by calling `os.getcwd()` directly, rather than using the `Path.cwd()` class method. This avoids constructing an extra `Path` object (and the parsing/normalization that comes with it).

Decrease performance of the `cwd()` class method by calling the `Path.absolute()` method, rather than using `os.getcwd()` directly. This involves constructing an extra `Path` object. We do this to maintain a longstanding pattern where `os` functions are called from only one place, which allows them to be more readily replaced by users. As `cwd()` is generally called at most once within user programs, it's a good bargain.

```shell
# before
$ ./python -m timeit -s 'from pathlib import Path; p = Path("foo", "bar")' 'p.absolute()'
50000 loops, best of 5: 9.04 usec per loop
# after
$ ./python -m timeit -s 'from pathlib import Path; p = Path("foo", "bar")' 'p.absolute()'
50000 loops, best of 5: 5.02 usec per loop
```

Automerge-Triggered-By: GH:AlexWaygood
2 years agogh-98831: Regenerate Python/opcode_metadata.h (GH-100778)
Zachary Ware [Thu, 5 Jan 2023 21:47:18 +0000 (15:47 -0600)] 
gh-98831: Regenerate Python/opcode_metadata.h (GH-100778)

2 years agoGH-98831: Update generate_cases.py: register inst, opcode_metadata.h (#100735)
Guido van Rossum [Thu, 5 Jan 2023 21:01:07 +0000 (13:01 -0800)] 
GH-98831: Update generate_cases.py: register inst, opcode_metadata.h (#100735)

(These aren't used yet, but may be coming soon,
and it's easier to keep this tool the same between branches.)

Added a sanity check for all this to compile.c.

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2 years agoGH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)
Mark Shannon [Thu, 5 Jan 2023 16:05:51 +0000 (16:05 +0000)] 
GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)

* Remove PRINT_EXPR instruction

* Remove STOPITERATION_ERROR instruction

* Remove IMPORT_STAR instruction

2 years agoGH-100288: Remove LOAD_ATTR_METHOD_WITH_DICT instruction. (GH-100753)
Mark Shannon [Thu, 5 Jan 2023 12:20:09 +0000 (12:20 +0000)] 
GH-100288: Remove LOAD_ATTR_METHOD_WITH_DICT instruction. (GH-100753)

2 years agoGH-100766: Note that locale.LC_MESSAGES is not universal (GH-100702)
Tzu-ping Chung [Thu, 5 Jan 2023 03:34:30 +0000 (11:34 +0800)] 
GH-100766: Note that locale.LC_MESSAGES is not universal (GH-100702)

2 years agoDrop myself from pathlib maintenance (#100757)
Brett Cannon [Wed, 4 Jan 2023 22:59:48 +0000 (14:59 -0800)] 
Drop myself from pathlib maintenance (#100757)

2 years agogh-100739: Respect mock spec when checking for unsafe prefixes (#100740)
Christian Klein [Wed, 4 Jan 2023 22:31:29 +0000 (23:31 +0100)] 
gh-100739: Respect mock spec when checking for unsafe prefixes (#100740)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years agogh-100747: some compiler macros use c instead of C to access the compiler (#100748)
Irit Katriel [Wed, 4 Jan 2023 20:19:20 +0000 (20:19 +0000)] 
gh-100747: some compiler macros use c instead of C to access the compiler (#100748)

2 years agoGH-100719: Remove the `co_nplaincellvars` field from code objects. (GH-100721)
Mark Shannon [Wed, 4 Jan 2023 15:41:39 +0000 (15:41 +0000)] 
GH-100719: Remove the `co_nplaincellvars` field from code objects. (GH-100721)

2 years agogh-100720: refactor calculation of number of frame slots for a code object into the...
Irit Katriel [Wed, 4 Jan 2023 13:37:06 +0000 (13:37 +0000)] 
gh-100720: refactor calculation of number of frame slots for a code object into the new function _PyFrame_NumSlotsForCodeObject (#100722)

2 years agodocs: fix `ssizeobjargproc` parameters (#100736)
David Lechner [Wed, 4 Jan 2023 08:17:42 +0000 (02:17 -0600)] 
docs: fix `ssizeobjargproc` parameters (#100736)

2 years agoGH-86508: skip binding to local addresses of different family in `asyncio.open_connec...
Kumar Aditya [Wed, 4 Jan 2023 08:00:26 +0000 (13:30 +0530)] 
GH-86508: skip binding to local addresses of different family in `asyncio.open_connection` (#100615)

2 years agogh-91219: http - use subclassing to override index_pages attribute (GH-100731)
Ethan Furman [Tue, 3 Jan 2023 23:20:08 +0000 (15:20 -0800)] 
gh-91219: http - use subclassing to override index_pages attribute (GH-100731)

Remove previously added parameter to `__init__`, and recommend subclassing to modify the `index_pages` attribute instead.

2 years ago[Enum] docs: replace 'last value' by 'highest value' for Flag auto (GH-100709)
Christophe Nanteuil [Tue, 3 Jan 2023 22:08:50 +0000 (23:08 +0100)] 
[Enum] docs: replace 'last value' by 'highest value' for Flag auto  (GH-100709)

2 years agogh-100700: Remove Date and Release fields in past whatsnews (GH-100728)
Zachary Ware [Tue, 3 Jan 2023 22:00:26 +0000 (16:00 -0600)] 
gh-100700: Remove Date and Release fields in past whatsnews (GH-100728)

2 years agogh-100146: Steal references from stack when building a list (#100147)
L. A. F. Pereira [Tue, 3 Jan 2023 18:49:49 +0000 (10:49 -0800)] 
gh-100146: Steal references from stack when building a list (#100147)

When executing the BUILD_LIST opcode, steal the references from the stack,
in a manner similar to the BUILD_TUPLE opcode.  Implement this by offloading
the logic to a new private API, _PyList_FromArraySteal(), that works similarly
to _PyTuple_FromArraySteal().

This way, instead of performing multiple stack pointer adjustments while the
list is being initialized, the stack is adjusted only once and a fast memory
copy operation is performed in one fell swoop.

2 years agogh-95882: fix regression in the traceback of exceptions propagated from inside a...
Thomas Grainger [Tue, 3 Jan 2023 15:47:13 +0000 (15:47 +0000)] 
gh-95882: fix regression in the traceback of exceptions propagated from inside a contextlib context manager (#95883)

2 years agogh-89419: gdb: fix bug causing `AttributeError` in py-locals when no frame is availab...
Eli Schwartz [Tue, 3 Jan 2023 14:56:57 +0000 (09:56 -0500)] 
gh-89419: gdb: fix bug causing `AttributeError` in py-locals when no frame is available (#100611)