]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agono-issue: Add Dong-hee Na as autoconf codeowner (gh-101281)
Dong-hee Na [Tue, 24 Jan 2023 10:22:22 +0000 (19:22 +0900)] 
no-issue: Add Dong-hee Na as autoconf codeowner (gh-101281)

2 years agogh-101278: Drop -gdwarf-4 flag from the BOLT build (gh-101280)
Dong-hee Na [Tue, 24 Jan 2023 10:22:00 +0000 (19:22 +0900)] 
gh-101278: Drop -gdwarf-4 flag from the BOLT build (gh-101280)

2 years agogh-98831: rewrite CHECK_EG_MATCH opcode in the instruction definition DSL (#101269)
Irit Katriel [Tue, 24 Jan 2023 09:43:16 +0000 (09:43 +0000)] 
gh-98831: rewrite CHECK_EG_MATCH opcode in the instruction definition DSL (#101269)

2 years agogh-101060: conditionally add `-fno-reorder-blocks-and-partition` (gh-101061)
Gregory Szorc [Tue, 24 Jan 2023 09:34:44 +0000 (01:34 -0800)] 
gh-101060: conditionally add `-fno-reorder-blocks-and-partition` (gh-101061)

2 years agogh-101152: Implement PEP 699 (GH-101193)
ram vikram singh [Tue, 24 Jan 2023 09:29:22 +0000 (14:59 +0530)] 
gh-101152:  Implement PEP 699 (GH-101193)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ken Jin <kenjin@python.org>
2 years ago[docs] Mention how to get/set a bigint PyLong via the C API (#101270)
Gregory P. Smith [Tue, 24 Jan 2023 05:20:53 +0000 (21:20 -0800)] 
[docs] Mention how to get/set a bigint PyLong via the C API (#101270)

We don't need direct C APIs to get at a bigint representation of PyLong but we
do want the few people who need to understand how.

Additional Author:  CAM-Gerlach

2 years agogh-100795: Don't call freeaddrinfo on failure. (#101252)
Gregory P. Smith [Mon, 23 Jan 2023 23:03:26 +0000 (15:03 -0800)] 
gh-100795: Don't call freeaddrinfo on failure. (#101252)

When getaddrinfo returns an error, the output pointer is in an unknown state
Don't call freeaddrinfo on it.  See the issue for discussion and details with
links to reasoning.  _Most_ libc getaddrinfo implementations never modify the
output pointer unless they are returning success.

Co-authored-by: Sergey G. Brester <github@sebres.de>
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2 years agogh-101261: add test for function with > 255 args (#101262)
Irit Katriel [Mon, 23 Jan 2023 20:10:10 +0000 (20:10 +0000)] 
gh-101261: add test for function with > 255 args (#101262)

2 years agogh-59956: Allow the "Trashcan" Mechanism to Work Without a Thread State (gh-101209)
Eric Snow [Mon, 23 Jan 2023 15:30:20 +0000 (08:30 -0700)] 
gh-59956: Allow the "Trashcan" Mechanism to Work Without a Thread State (gh-101209)

We've factored out a struct from the two PyThreadState fields. This accomplishes two things:

* make it clear that the trashcan-related code doesn't need any other parts of PyThreadState
* allows us to use the trashcan mechanism even when there isn't a "current" thread state

We still expect the caller to hold the GIL.

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

2 years agoGH-92123: Store _elementtree state in type contexts (#101190)
Erlend E. Aasland [Mon, 23 Jan 2023 12:20:36 +0000 (13:20 +0100)] 
GH-92123: Store _elementtree state in type contexts (#101190)

- add state pointer to TreeBuilderObject
- add state pointer to XMLParserObject

2 years agoAdded asyncio REPL example to docs. (#101243)
Carlton Gibson [Mon, 23 Jan 2023 11:31:13 +0000 (12:31 +0100)] 
Added asyncio REPL example to docs. (#101243)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-101015: Fix `typing.get_type_hints` with unpacked `*tuple` (PEP 646) (#101031)
Nikita Sobolev [Mon, 23 Jan 2023 07:52:58 +0000 (10:52 +0300)] 
gh-101015: Fix `typing.get_type_hints` with unpacked `*tuple` (PEP 646) (#101031)

2 years agogh-83122: Deprecate testing element truth values in `ElementTree` (#31149)
Jacob Walls [Mon, 23 Jan 2023 01:16:48 +0000 (20:16 -0500)] 
gh-83122: Deprecate testing element truth values in `ElementTree` (#31149)

When testing element truth values, emit a DeprecationWarning in all implementations.

This had emitted a FutureWarning in the rarely used python-only implementation since ~2.7 and has always been documented as a behavior not to rely on.

Matching an element in a tree search but having it test False can be unexpected. Raising the warning enables making the choice to finally raise an exception for this ambiguous behavior in the future.

2 years agoSumprod(): Update citation. Reorder functions. Add final twosum() call. Improve comme...
Raymond Hettinger [Sun, 22 Jan 2023 23:07:52 +0000 (17:07 -0600)] 
Sumprod(): Update citation. Reorder functions. Add final twosum() call. Improve comments. (#101249)

2 years agogh-101047: Remove vestigial references to macOS libtool options (gh-101048)
Gregory Szorc [Sun, 22 Jan 2023 22:26:42 +0000 (14:26 -0800)] 
gh-101047: Remove vestigial references to macOS libtool options (gh-101048)

LIBTOOL_CRUFT and OTHER_LIBTOOL_OPT variables have been unused since commit
19199830f7f880b1e9cff5d92d30706fd8bb4700 in 2011.

2 years agoAdd Erlend Aasland as autoconf codeowner (#101247)
Erlend E. Aasland [Sun, 22 Jan 2023 22:02:15 +0000 (23:02 +0100)] 
Add Erlend Aasland as autoconf codeowner (#101247)

2 years agoGH-101097: Switch from standard interval notation to greater or less than signs for...
Andrew Hong [Sun, 22 Jan 2023 20:58:36 +0000 (15:58 -0500)] 
GH-101097: Switch from standard interval notation to greater or less than signs for random.random()'s documentation (#101119)

2 years agogh-67790: Support float-style formatting for Fraction instances (#100161)
Mark Dickinson [Sun, 22 Jan 2023 18:44:49 +0000 (18:44 +0000)] 
gh-67790: Support float-style formatting for Fraction instances (#100161)

This PR adds support for float-style formatting for `Fraction` objects: it supports the `"e"`, `"E"`, `"f"`, `"F"`, `"g"`, `"G"` and `"%"` presentation types, and all the various bells and whistles of the formatting mini-language for those presentation types. The behaviour almost exactly matches that of `float`, but the implementation works with the exact `Fraction` value and does not do an intermediate conversion to `float`, and so avoids loss of precision or issues with numbers that are outside the dynamic range of the `float` type.

Note that the `"n"` presentation type is _not_ supported. That support could be added later if people have a need for it.

There's one corner-case where the behaviour differs from that of float: for the `float` type, if explicit alignment is specified with a fill character of `'0'` and alignment type `'='`, then thousands separators (if specified) are inserted into the padding string:

```python
>>> format(3.14, '0=11,.2f')
'0,000,003.14'
```

The exact same effect can be achieved by using the `'0'` flag:

```python
>>> format(3.14, '011,.2f')
'0,000,003.14'
```

For `Fraction`, only the `'0'` flag has the above behaviour with respect to thousands separators: there's no special-casing of the particular `'0='` fill-character/alignment combination. Instead, we treat the fill character `'0'` just like any other:

```python
>>> format(Fraction('3.14'), '0=11,.2f')
'00000003.14'
>>> format(Fraction('3.14'), '011,.2f')
'0,000,003.14'
```

The `Fraction` formatter is also stricter about combining these two things: it's not permitted to use both the `'0'` flag _and_ explicit alignment, on the basis that we should refuse the temptation to guess in the face of ambiguity. `float` is less picky:

```python
>>> format(3.14, '0<011,.2f')
'3.140000000'
>>> format(Fraction('3.14'), '0<011,.2f')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mdickinson/Repositories/python/cpython/Lib/fractions.py", line 414, in __format__
    raise ValueError(
ValueError: Invalid format specifier '0<011,.2f' for object of type 'Fraction'; can't use explicit alignment when zero-padding
```

2 years agoRevert "gh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (#10122...
Kumar Aditya [Sun, 22 Jan 2023 08:47:01 +0000 (14:17 +0530)] 
Revert "gh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (#101220)" (#101238)

Revert "gh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (#101220)"

This reverts commit 5f08fe4a2c055880c23c6f9b57ff03005d193bfc.

2 years agogh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (#101220)
Sergey G. Brester [Sun, 22 Jan 2023 08:10:00 +0000 (09:10 +0100)] 
gh-100795: avoid unexpected `freeaddrinfo` after failed `getaddrinfo` (#101220)

Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2 years agoGH-88597: Added command line interface to UUID module. (#99463)
achhina [Sun, 22 Jan 2023 06:59:31 +0000 (01:59 -0500)] 
GH-88597: Added command line interface to UUID module. (#99463)

The `uuid` module now supports command line usage.

```python
❯ ./python.exe -m uuid
5f2d57b1-90e8-417c-ba5d-69b9b6f74289

❯ ./python.exe -m uuid -h
usage: uuid.py [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-ns NAMESPACE] [-n NAME]
...
```

2 years agogh-100518: Add tests for `ast.NodeTransformer` (#100521)
Nikita Sobolev [Sat, 21 Jan 2023 21:44:41 +0000 (00:44 +0300)] 
gh-100518: Add tests for `ast.NodeTransformer` (#100521)

2 years agogh-100726: Optimize construction of range object for medium sized integers (#100810)
Pieter Eendebak [Sat, 21 Jan 2023 19:33:08 +0000 (20:33 +0100)] 
gh-100726: Optimize construction of range object for medium sized integers (#100810)

Use C long arithmetic instead of PyLong arithmetic to compute the range length, where possible.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2 years agogh-99266: ctypes: Preserve more detailed exception in `ArgumentError`
Kamil Turek [Sat, 21 Jan 2023 13:44:43 +0000 (14:44 +0100)] 
gh-99266: ctypes: Preserve more detailed exception in `ArgumentError`

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agoGH-92123: Move _elementtree heap types to module state (#101187)
Erlend E. Aasland [Sat, 21 Jan 2023 11:01:15 +0000 (12:01 +0100)] 
GH-92123: Move _elementtree heap types to module state (#101187)

2 years agogh-101037: Fix potential memory underallocation for zeros of int subtypes (#101038)
Mark Dickinson [Sat, 21 Jan 2023 10:23:59 +0000 (10:23 +0000)] 
gh-101037: Fix potential memory underallocation for zeros of int subtypes (#101038)

This PR fixes object allocation in long_subtype_new to ensure that there's at least one digit in all cases, and makes sure that the value of that digit is copied over from the source long.

Needs backport to 3.11, but not any further: the change to require at least one digit was only introduced for Python 3.11.

Fixes #101037.

2 years agogh-101143: Remove references to `TimerHandle` from `asyncio.base_events.BaseEventLoop...
J. Nick Koston [Sat, 21 Jan 2023 09:16:07 +0000 (23:16 -1000)] 
gh-101143: Remove references to `TimerHandle` from `asyncio.base_events.BaseEventLoop._add_callback` (#101197)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agoBump Azure Pipelines to ubuntu-22.04 (#101089)
Hugo van Kemenade [Sat, 21 Jan 2023 09:01:31 +0000 (11:01 +0200)] 
Bump Azure Pipelines to ubuntu-22.04 (#101089)

2 years agoFix rst formatting in 3.12 What's New (#101110)
scrazzz [Sat, 21 Jan 2023 08:53:54 +0000 (11:53 +0300)] 
Fix rst formatting in 3.12 What's New (#101110)

2 years agogh-91351: Fix some bugs in importlib handling of re-entrant imports (GH-94504)
Jean-Paul Calderone [Sat, 21 Jan 2023 00:00:39 +0000 (19:00 -0500)] 
gh-91351: Fix some bugs in importlib handling of re-entrant imports (GH-94504)

Co-authored-by: Brett Cannon <brett@python.org>
2 years agogh-100750: pass encoding kwarg in lib/platform.py (#100751)
Thomas Grainger [Fri, 20 Jan 2023 22:25:38 +0000 (22:25 +0000)] 
gh-100750: pass encoding kwarg in lib/platform.py (#100751)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-86610: Use attribute directive in docs for pathlib.PurePath (#101114)
Barney Gale [Fri, 20 Jan 2023 22:13:58 +0000 (22:13 +0000)] 
gh-86610: Use attribute directive in docs for pathlib.PurePath (#101114)

2 years agoGH-101111: Disambigaute origin of const for store_const and append_const (#101121)
Jürgen Gmach [Fri, 20 Jan 2023 22:13:07 +0000 (23:13 +0100)] 
GH-101111: Disambigaute origin of const for store_const and append_const (#101121)

While the documentation for `optparse` mentioned that both `store_const` and
`append_const` store a constant value, it was not clear where this value was
coming from.

A link to `Option.const` makes this explicit.

2 years agoGH-101112: Specify type of pattern for Path.rglob (#101132)
Jürgen Gmach [Fri, 20 Jan 2023 22:11:31 +0000 (23:11 +0100)] 
GH-101112: Specify type of pattern for Path.rglob (#101132)

The documentation for `rglob` did not mention what `pattern` actually
is.

Mentioning and linking to `fnmatch` makes this explicit, as the
documentation for `fnmatch` both shows the syntax and some explanation.

2 years agoFix a typo in whatsnew/3.12.rst (#101150)
caozhanhao [Fri, 20 Jan 2023 22:10:08 +0000 (06:10 +0800)] 
Fix a typo in whatsnew/3.12.rst (#101150)

2 years agoFix minor typos in SSL documentation (#101158)
Simon Robinson [Fri, 20 Jan 2023 22:08:45 +0000 (22:08 +0000)] 
Fix minor typos in SSL documentation (#101158)

2 years agogh-91485: Avoid unnecessary use of non-Python syntax in io docs (#101177)
Shantanu [Fri, 20 Jan 2023 22:06:10 +0000 (14:06 -0800)] 
gh-91485: Avoid unnecessary use of non-Python syntax in io docs (#101177)

2 years agoFix typo in comment in compile.c (#101194)
Ikko Eltociear Ashimine [Fri, 20 Jan 2023 18:34:36 +0000 (03:34 +0900)] 
Fix typo in comment in compile.c (#101194)

2 years agogh-101181: Fix `unused-variable` warning in `pystate.c` (#101188)
Nikita Sobolev [Fri, 20 Jan 2023 18:01:30 +0000 (21:01 +0300)] 
gh-101181: Fix `unused-variable` warning in `pystate.c` (#101188)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-92123: Convert `_elementtree` types to heap types (#99221)
Erlend E. Aasland [Fri, 20 Jan 2023 11:40:06 +0000 (12:40 +0100)] 
gh-92123: Convert `_elementtree` types to heap types (#99221)

2 years agoGH-90699: Clear interned strings in `_elementtree` (#101185)
Erlend E. Aasland [Fri, 20 Jan 2023 11:04:14 +0000 (12:04 +0100)] 
GH-90699: Clear interned strings in `_elementtree` (#101185)

2 years agoProvided better example for logging cookbook (GH-101164)
Vladimir Malinovskii [Fri, 20 Jan 2023 08:54:48 +0000 (11:54 +0300)] 
Provided better example for logging cookbook (GH-101164)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2 years agogh-88324: Clarify documentation for redirected stdout/stderr when using subprocess...
richardhob [Fri, 20 Jan 2023 07:56:13 +0000 (23:56 -0800)] 
gh-88324: Clarify documentation for redirected stdout/stderr when using subprocess in Linux (#94035)

* Update description of stdout, stderr, and stdin.

Changes:
- Move the ``None`` option (which is default) to the front of the list
  of input options
- Move the ``None`` option description up to make the default behavior
  more clear (No redirection)
- Remove mention of Child File Descriptors from ``None`` option description

2 years agogh-101144: Allow open and read_text encoding to be positional. (#101145)
Gregory P. Smith [Fri, 20 Jan 2023 07:04:30 +0000 (23:04 -0800)] 
gh-101144: Allow open and read_text encoding to be positional. (#101145)

The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.

Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time.

2 years agogh-101100: [Enum] Fix sphinx warnings in docs (GH-101122)
Nikita Sobolev [Fri, 20 Jan 2023 02:16:21 +0000 (05:16 +0300)] 
gh-101100: [Enum] Fix sphinx warnings in docs (GH-101122)

* gh-101100: [Enum] Fix sphinx warnings in

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agogh-59956: Fix Function Groupings in pystate.c (gh-101172)
Eric Snow [Fri, 20 Jan 2023 00:23:53 +0000 (17:23 -0700)] 
gh-59956: Fix Function Groupings in pystate.c (gh-101172)

This is a follow-up to gh-101161.  The objective is to make it easier to read Python/pystate.c by grouping the functions there in a consistent way.  This exclusively involves moving code around and adding various kinds of comments.

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

2 years agogh-101167: fix bug in the new test.support.requires_specialization decorator (GH...
Irit Katriel [Thu, 19 Jan 2023 23:45:53 +0000 (23:45 +0000)] 
gh-101167: fix bug in the new test.support.requires_specialization decorator (GH-101171)

Fixes #101167.

Automerge-Triggered-By: GH:iritkatriel
2 years agogh-101169: reduce the implementation of except* by one bytecode instruction (#101170)
Irit Katriel [Thu, 19 Jan 2023 23:30:49 +0000 (23:30 +0000)] 
gh-101169: reduce the implementation of except* by one bytecode instruction (#101170)

2 years agogh-59956: Clarify GILState-related Code (gh-101161)
Eric Snow [Thu, 19 Jan 2023 23:04:14 +0000 (16:04 -0700)] 
gh-59956: Clarify GILState-related Code (gh-101161)

The objective of this change is to help make the GILState-related code easier to understand.  This mostly involves moving code around and some semantically equivalent refactors.  However, there are a also a small number of slight changes in structure and behavior:

* tstate_current is moved out of _PyRuntimeState.gilstate
* autoTSSkey is moved out of _PyRuntimeState.gilstate
* autoTSSkey is initialized earlier
* autoTSSkey is re-initialized (after fork) earlier

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

2 years agogh-98831: register instructions have 0 pushes and pops (#101163)
Irit Katriel [Thu, 19 Jan 2023 21:02:56 +0000 (21:02 +0000)] 
gh-98831: register instructions have 0 pushes and pops (#101163)

2 years agogh-100712: make it possible to disable specialization (for debugging) (#100713)
Irit Katriel [Thu, 19 Jan 2023 18:14:55 +0000 (18:14 +0000)] 
gh-100712: make it possible to disable specialization (for debugging) (#100713)

2 years agogh-100940: Change "char *str" to "const char *str" in KeywordToken: It is an immutab...
Stepfen Shawn [Wed, 18 Jan 2023 21:02:48 +0000 (05:02 +0800)] 
gh-100940: Change "char *str" to "const char *str" in KeywordToken:  It is an immutable string. (#100936)

2 years agogh-100340: Allows -Wno-int-conversion for wasm (#100341)
Kushal Das [Wed, 18 Jan 2023 18:43:49 +0000 (19:43 +0100)] 
gh-100340: Allows -Wno-int-conversion for wasm (#100341)

Fixes #100340 allows -Wno-int-conversion for wasm

2 years agoGH-98831: Move assorted macros from ceval.h to a new header (#101116)
Guido van Rossum [Wed, 18 Jan 2023 18:41:07 +0000 (10:41 -0800)] 
GH-98831: Move assorted macros from ceval.h to a new header (#101116)

2 years agofix typo in 3.12 What's New (#101105)
Tushar Sadhwani [Wed, 18 Jan 2023 16:24:56 +0000 (21:54 +0530)] 
fix typo in 3.12 What's New (#101105)

2 years agoDocs: improve sqlite3 placeholders example (#101092)
Erlend E. Aasland [Wed, 18 Jan 2023 09:36:17 +0000 (10:36 +0100)] 
Docs: improve sqlite3 placeholders example (#101092)

2 years agoFix typo and old link in wasm readme (#101096)
Zac Hatfield-Dodds [Wed, 18 Jan 2023 00:06:38 +0000 (11:06 +1100)] 
Fix typo and old link in wasm readme (#101096)

2 years agoGH-98831: Implement array support in cases generator (#100912)
Guido van Rossum [Tue, 17 Jan 2023 23:59:19 +0000 (15:59 -0800)] 
GH-98831: Implement array support in cases generator (#100912)

You can now write things like this:
```
inst(BUILD_STRING, (pieces[oparg] -- str)) { ... }
inst(LIST_APPEND, (list, unused[oparg-1], v -- list, unused[oparg-1])) { ... }
```
Note that array output effects are only partially supported (they must be named `unused` or correspond to an input effect).

2 years agogh-82052: Don't send partial UTF-8 sequences to the Windows API (GH-101103)
Paul Moore [Tue, 17 Jan 2023 19:23:06 +0000 (19:23 +0000)] 
gh-82052: Don't send partial UTF-8 sequences to the Windows API (GH-101103)

Don't send partial UTF-8 sequences to the Windows API

2 years agoFix typo in `ReprEnum` documentation (#101079)
Viicos [Tue, 17 Jan 2023 10:51:56 +0000 (11:51 +0100)] 
Fix typo in `ReprEnum` documentation (#101079)

2 years agogh-101046: Fix a potential memory leak in the parser when raising MemoryError (#101051)
Pablo Galindo Salgado [Mon, 16 Jan 2023 18:45:37 +0000 (18:45 +0000)] 
gh-101046: Fix a potential memory leak in the parser when raising MemoryError (#101051)

2 years agogh-100247: Improve documentation for custom shebang commands in py.exe launcher ...
Steve Dower [Mon, 16 Jan 2023 17:01:04 +0000 (17:01 +0000)] 
gh-100247: Improve documentation for custom shebang commands in py.exe launcher (GH-101083)

2 years agogh-100320: Fix path calculations on Windows when python.exe is moved outside of the...
Steve Dower [Mon, 16 Jan 2023 16:05:39 +0000 (16:05 +0000)] 
gh-100320: Fix path calculations on Windows when python.exe is moved outside of the normal location (GH-100947)

2 years agoGH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983)
Mark Shannon [Mon, 16 Jan 2023 12:35:21 +0000 (12:35 +0000)] 
GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983)

2 years agogh-101056: Fix memory leak in `formatfloat()` in `bytesobject.c` (#101057)
Nikita Sobolev [Mon, 16 Jan 2023 10:46:07 +0000 (13:46 +0300)] 
gh-101056: Fix memory leak in `formatfloat()` in `bytesobject.c` (#101057)

2 years agoDocs: Remove duplicate `TraversableResources` reference (#101068)
scrazzz [Mon, 16 Jan 2023 10:44:50 +0000 (13:44 +0300)] 
Docs: Remove duplicate `TraversableResources` reference (#101068)

2 years agoGH-100997: fix refleak in `_testinternalcapi.c` (#101058)
Kumar Aditya [Mon, 16 Jan 2023 10:41:57 +0000 (16:11 +0530)] 
GH-100997: fix refleak in `_testinternalcapi.c` (#101058)

2 years agogh-101041: Fix a misspelled name of `utctimetuple` in a doc warning (GH-101042)
Oleg Iarygin [Sun, 15 Jan 2023 20:36:31 +0000 (00:36 +0400)] 
gh-101041: Fix a misspelled name of `utctimetuple` in a doc warning (GH-101042)

2 years agoFix `ctypes` typo in `set_exception` (#101040)
Cristián Maureira-Fredes [Sun, 15 Jan 2023 15:12:37 +0000 (16:12 +0100)] 
Fix `ctypes` typo in `set_exception` (#101040)

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