]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoGH-103092: isolate `_ssl` (#104725)
Kumar Aditya [Mon, 22 May 2023 00:44:48 +0000 (06:14 +0530)] 
GH-103092: isolate `_ssl` (#104725)

2 years agogh-102856: Tokenize performance improvement (#104731)
Marta Gómez Macías [Mon, 22 May 2023 00:29:04 +0000 (02:29 +0200)] 
gh-102856: Tokenize performance improvement (#104731)

2 years agogh-104683: clinic.py: Modernise `parse_converter()` using pattern-matching (#104696)
Alex Waygood [Sun, 21 May 2023 23:29:43 +0000 (00:29 +0100)] 
gh-104683: clinic.py: Modernise `parse_converter()` using pattern-matching (#104696)

2 years agogh-104686: Fix tracing for decorated classes (#104708)
Jelle Zijlstra [Sun, 21 May 2023 23:20:19 +0000 (16:20 -0700)] 
gh-104686: Fix tracing for decorated classes (#104708)

2 years agogh-104683: `clinic.py`: Improve coverage for the `parse_converter` method (#104729)
Alex Waygood [Sun, 21 May 2023 23:00:47 +0000 (00:00 +0100)] 
gh-104683: `clinic.py`: Improve coverage for the `parse_converter` method (#104729)

2 years agogh-98836: Extend PyUnicode_FromFormat() (GH-98838)
Serhiy Storchaka [Sun, 21 May 2023 21:32:39 +0000 (00:32 +0300)] 
gh-98836: Extend PyUnicode_FromFormat() (GH-98838)

* Support for conversion specifiers o (octal) and X (uppercase hexadecimal).
* Support for length modifiers j (intmax_t) and t (ptrdiff_t).
* Length modifiers are now applied to all integer conversions.
* Support for wchar_t C strings (%ls and %lV).
* Support for variable width and precision (*).
* Support for flag - (left alignment).

2 years agogh-104050: Add more type annotations to Argument Clinic (#104631)
Erlend E. Aasland [Sun, 21 May 2023 21:24:26 +0000 (23:24 +0200)] 
gh-104050: Add more type annotations to Argument Clinic (#104631)

Annotate methods of the following classes:

- class Function
- class Parameter
- class LandMine

2 years agogh-104050: Add basic type hints to Argument Clinic clinic class (#104705)
Erlend E. Aasland [Sun, 21 May 2023 20:49:34 +0000 (22:49 +0200)] 
gh-104050: Add basic type hints to Argument Clinic clinic class (#104705)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104050: Annotate Argument Clinic return converters (#104706)
Erlend E. Aasland [Sun, 21 May 2023 20:23:14 +0000 (22:23 +0200)] 
gh-104050: Annotate Argument Clinic return converters (#104706)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-103857: Document utcnow and utcfromtimestamp deprecations in What's New (#104542)
Hugo van Kemenade [Sun, 21 May 2023 19:45:44 +0000 (22:45 +0300)] 
gh-103857: Document utcnow and utcfromtimestamp deprecations in What's New (#104542)

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2 years agogh-104719: IDLE - delete useless monkeypatch of tokenize (#104726)
Terry Jan Reedy [Sun, 21 May 2023 18:42:26 +0000 (14:42 -0400)] 
gh-104719: IDLE - delete useless monkeypatch of tokenize (#104726)

2 years agogh-104719: Restore Tokenize module constants (#104722)
Marta Gómez Macías [Sun, 21 May 2023 16:07:28 +0000 (18:07 +0200)] 
gh-104719: Restore Tokenize module constants (#104722)

2 years agoGH-101291: Add low level, unstable API for pylong (GH-101685)
Mark Shannon [Sun, 21 May 2023 13:45:48 +0000 (14:45 +0100)] 
GH-101291: Add low level, unstable API for pylong (GH-101685)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 years agotyping docs: Move some classes out of the "Generics" section (#104707)
Jelle Zijlstra [Sun, 21 May 2023 13:00:50 +0000 (06:00 -0700)] 
typing docs: Move some classes out of the "Generics" section (#104707)

- AnyStr can be used in type annotations, contrary to the section header
- Unpack can also be used in annotations, and its use is not restricted
  to generics. It makes more sense with other building blocks like Required.
- Protocol is not necessarily generic.

Also fix the indentation for two notes associated with Concatenate.

Split off from #104642, but I think this change is independently an
improvement.

2 years agogh-104717: Add comment about manual loop unrolling (gh-104718)
Dong-hee Na [Sun, 21 May 2023 12:08:28 +0000 (21:08 +0900)] 
gh-104717: Add comment about manual loop unrolling (gh-104718)

2 years agogh-86275: improve Hypothesis configuration for CI and local runs (#104468)
Zac Hatfield-Dodds [Sun, 21 May 2023 11:52:29 +0000 (12:52 +0100)] 
gh-86275: improve Hypothesis configuration for CI and local runs (#104468)

2 years agogh-103295: expose API for writing perf map files (#103546)
gsallam [Sun, 21 May 2023 10:12:24 +0000 (03:12 -0700)] 
gh-103295: expose API for writing perf map files (#103546)

Co-authored-by: Aniket Panse <aniketpanse@fb.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2 years agogh-104469: Convert _testcapi/exceptions to use AC (gh-104502)
Dong-hee Na [Sun, 21 May 2023 09:39:45 +0000 (18:39 +0900)] 
gh-104469: Convert _testcapi/exceptions to use AC (gh-104502)

2 years agoCorrected identifier (#104713)
William Sawyer [Sun, 21 May 2023 05:57:50 +0000 (15:57 +1000)] 
Corrected identifier (#104713)

2 years agogh-104698: Fix reference leak in mmapmodule.c (#104700)
Kirill Podoprigora [Sun, 21 May 2023 00:19:56 +0000 (03:19 +0300)] 
gh-104698: Fix reference leak in mmapmodule.c (#104700)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-74690: Make a typing test more resilient (#104691)
Alex Waygood [Sun, 21 May 2023 00:13:37 +0000 (01:13 +0100)] 
gh-74690: Make a typing test more resilient (#104691)

2 years agogh-102856: Python tokenizer implementation for PEP 701 (#104323)
Marta Gómez Macías [Sun, 21 May 2023 00:03:02 +0000 (02:03 +0200)] 
gh-102856: Python tokenizer implementation for PEP 701 (#104323)

This commit replaces the Python implementation of the tokenize module with an implementation
that reuses the real C tokenizer via a private extension module. The tokenize module now implements
a compatibility layer that transforms tokens from the C tokenizer into Python tokenize tokens for backward
compatibility.

As the C tokenizer does not emit some tokens that the Python tokenizer provides (such as comments and non-semantic newlines), a new special mode has been added to the C tokenizer mode that currently is only used via
the extension module that exposes it to the Python layer. This new mode forces the C tokenizer to emit these new extra tokens and add the appropriate metadata that is needed to match the old Python implementation.

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2 years agogh-61460: Stronger HMAC in multiprocessing (#20380)
Christian Heimes [Sat, 20 May 2023 23:33:09 +0000 (01:33 +0200)] 
gh-61460: Stronger HMAC in multiprocessing (#20380)

bpo-17258:  `multiprocessing` now supports stronger HMAC algorithms for inter-process connection authentication rather than only HMAC-MD5.

Signed-off-by: Christian Heimes <christian@python.org>
gpshead: I Reworked to be more robust while keeping the idea.

The protocol modification idea remains, but we now take advantage of the
message length as an indicator of legacy vs modern protocol version.  No
more regular expression usage.  We now default to HMAC-SHA256, but do so
in a way that will be compatible when communicating with older clients
or older servers. No protocol transition period is needed.

More integration tests to verify these claims remain true are required. I'm
unaware of anyone depending on multiprocessing connections between
different Python versions.

---------

Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
2 years agogh-103606: raise RuntimeError if config file is invalid or empty (#104701)
Prince Roshan [Sat, 20 May 2023 22:26:49 +0000 (03:56 +0530)] 
gh-103606: raise RuntimeError if config file is invalid or empty (#104701)

(this adjusts new code) raise RuntimeError if provided config file is invalid or empty, not ValueError.

2 years agogh-104050: Add basic type hints to Argument Clinic DSL parser (#104704)
Erlend E. Aasland [Sat, 20 May 2023 21:55:02 +0000 (23:55 +0200)] 
gh-104050: Add basic type hints to Argument Clinic DSL parser (#104704)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104683: Modernise Tools/clinic/ (#104684)
Alex Waygood [Sat, 20 May 2023 20:16:49 +0000 (21:16 +0100)] 
gh-104683: Modernise Tools/clinic/ (#104684)

- Make some string interpolations more readable using f-strings or
  explicit parametrisation
- Remove unneeded open() mode specifiers

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-49174: document that the effect of calling gc.collect() during a collection is...
Irit Katriel [Sat, 20 May 2023 20:12:10 +0000 (21:12 +0100)] 
gh-49174: document that the effect of calling gc.collect() during a collection is undefined (#104699)

2 years agogh-104372: Use non-Raw malloc for c_fds_to_keep in _posixsubprocess (#104697)
Gregory P. Smith [Sat, 20 May 2023 17:09:23 +0000 (10:09 -0700)] 
gh-104372: Use non-Raw malloc for c_fds_to_keep in _posixsubprocess (#104697)

Use non-Raw malloc for c_fds_to_keep as the code could ask for 0 length.

2 years agogh-56276: Add tests to test_compare (#3199)
Cheryl Sabella [Sat, 20 May 2023 16:07:40 +0000 (12:07 -0400)] 
gh-56276: Add tests to test_compare (#3199)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agogh-104679 Fixed syntax highlighting in turtle docs (#104682)
han-solo [Sat, 20 May 2023 15:42:29 +0000 (21:12 +0530)] 
gh-104679 Fixed syntax highlighting in turtle docs (#104682)

2 years agogh-104658: Fix location of unclosed quote error for multiline f-strings (#104660)
Pablo Galindo Salgado [Sat, 20 May 2023 13:07:05 +0000 (14:07 +0100)] 
gh-104658: Fix location of unclosed quote error for multiline f-strings (#104660)

2 years agogh-104683: Modernise `clinic.py` using `str.removeprefix` and `str.removesuffix`...
Alex Waygood [Sat, 20 May 2023 11:08:28 +0000 (12:08 +0100)] 
gh-104683: Modernise `clinic.py` using `str.removeprefix` and `str.removesuffix` (#104685)

Both methods were new in Python 3.9.

2 years agogh-104146: Purge dead code from Argument Clinic (#104680)
Erlend E. Aasland [Sat, 20 May 2023 10:52:32 +0000 (12:52 +0200)] 
gh-104146: Purge dead code from Argument Clinic (#104680)

The following local variables were assigned but never used:

- line 551:  result
- line 1341: groups
- line 1431: default_return_converter
- line 1529: ignore_self
- line 1809: input_checksum
- line 4224: new'

---

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104683: Argument clinic: use `dict` over `OrderedDict` (#104647)
Alex Waygood [Sat, 20 May 2023 10:24:00 +0000 (11:24 +0100)] 
gh-104683: Argument clinic: use `dict` over `OrderedDict` (#104647)

For code readability. Instances of `builtins.dict` have been ordered since 3.6, and have been guaranteed by the language to be ordered since Python 3.7. Argument Clinic now requires Python 3.10+.

2 years agoReplace "OS X" with "macOS" (#104653)
partev [Sat, 20 May 2023 08:25:52 +0000 (04:25 -0400)] 
Replace "OS X" with "macOS" (#104653)

2 years agogh-103987: fix several crashes in mmap module (#103990)
Prince Roshan [Sat, 20 May 2023 03:34:12 +0000 (09:04 +0530)] 
gh-103987: fix several crashes in mmap module (#103990)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agodocs: fix wrong indentation causing rendering error in dis page (#104661)
Nyakku Shigure [Fri, 19 May 2023 20:11:21 +0000 (04:11 +0800)] 
docs: fix wrong indentation causing rendering error in dis page (#104661)

2 years agogh-94906: Support multiple steps in math.nextafter (#103881)
Matthias Görgens [Fri, 19 May 2023 20:03:49 +0000 (04:03 +0800)] 
gh-94906: Support multiple steps in math.nextafter (#103881)

This PR updates `math.nextafter` to add a new `steps` argument. The behaviour is as though `math.nextafter` had been called `steps` times in succession.

---------

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2 years agogh-104472: Skip `test_subprocess.ProcessTestCase.test_empty_env` if ASAN is enabled...
chgnrdv [Fri, 19 May 2023 19:25:51 +0000 (22:25 +0300)] 
gh-104472: Skip `test_subprocess.ProcessTestCase.test_empty_env` if ASAN is enabled (#104667)

Skip test_subprocess.ProcessTestCase.test_empty_env if ASAN is enabled.

2 years agogh-103839: Allow building Tkinter against Tcl 8.7 without external libtommath (GH...
Christopher Chavez [Fri, 19 May 2023 19:09:59 +0000 (14:09 -0500)] 
gh-103839: Allow building Tkinter against Tcl 8.7 without external libtommath (GH-103842)

2 years agogh-85984: New additions and improvements to the tty library. (#101832)
Soumendra Ganguly [Fri, 19 May 2023 18:13:30 +0000 (13:13 -0500)] 
gh-85984: New additions and improvements to the tty library. (#101832)

New additions to the tty library. Functions added: cfmakeraw(), and cfmakecbreak(). The
functions setcbreak() and setraw() now return original termios to save an extra tcgetattr() call.

---------

Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2 years agogh-104659: Consolidate python examples in enum documentation (#104665)
Thomas Hisch [Fri, 19 May 2023 17:46:20 +0000 (19:46 +0200)] 
gh-104659: Consolidate python examples in enum documentation (#104665)

2 years agogh-92248: Deprecate `type`, `choices`, `metavar` parameters of `argparse.BooleanOptio...
Nikita Sobolev [Fri, 19 May 2023 16:44:43 +0000 (19:44 +0300)] 
gh-92248: Deprecate `type`, `choices`, `metavar` parameters of `argparse.BooleanOptionalAction` (#103678)

Co-authored-by: Kirill <80244920+Eclips4@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agogh-104645: fix error handling in marshal tests (#104646)
Irit Katriel [Fri, 19 May 2023 16:23:57 +0000 (17:23 +0100)] 
gh-104645: fix error handling in marshal tests (#104646)

2 years agogh-104600: Make type.__type_params__ writable (#104634)
Jelle Zijlstra [Fri, 19 May 2023 16:04:47 +0000 (09:04 -0700)] 
gh-104600: Make type.__type_params__ writable (#104634)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104602: Add additional test for listcomp with lambda (#104639)
Jelle Zijlstra [Fri, 19 May 2023 15:16:39 +0000 (08:16 -0700)] 
gh-104602: Add additional test for listcomp with lambda (#104639)

This threw a SystemError before #104603. Adding a separate test
because this was a different failure mode than the other two new
tests from #104603, both of which used to segfault.

2 years agogh-104640: Disallow walrus in comprehension within type scopes (#104641)
Jelle Zijlstra [Fri, 19 May 2023 14:31:09 +0000 (07:31 -0700)] 
gh-104640: Disallow walrus in comprehension within type scopes (#104641)

2 years agogh-103921: Rename "type" header in argparse docs (#104654)
Jelle Zijlstra [Fri, 19 May 2023 13:50:34 +0000 (06:50 -0700)] 
gh-103921: Rename "type" header in argparse docs (#104654)

This allows :keyword:`type` to link to docs for the new `type`
statement (being written in gh-104642) instead of to this header
in the argparse docs.

2 years agoImprove readability of `typing._ProtocolMeta.__instancecheck__` (#104649)
Alex Waygood [Fri, 19 May 2023 13:30:02 +0000 (14:30 +0100)] 
Improve readability of `typing._ProtocolMeta.__instancecheck__` (#104649)

2 years agogh-96522: Fix deadlock in pty.spawn (#96639)
Youfu Zhang [Fri, 19 May 2023 13:22:43 +0000 (21:22 +0800)] 
gh-96522: Fix deadlock in pty.spawn (#96639)

2 years agoGH-102818: Do not call `PyTraceBack_Here` in sys.settrace trampoline. (GH-104579)
Mark Shannon [Fri, 19 May 2023 11:40:48 +0000 (12:40 +0100)] 
GH-102818: Do not call `PyTraceBack_Here` in sys.settrace trampoline.  (GH-104579)

2 years agoGH-103545: Add macOS specific constants for ``os.setpriority`` to ``os`` (#104606)
Ronald Oussoren [Fri, 19 May 2023 07:15:11 +0000 (09:15 +0200)] 
GH-103545: Add macOS specific constants for ``os.setpriority`` to ``os`` (#104606)

This adds a number of PRIO_DARWIN_* constants to the os module for use with os.setpriority.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-104623: Update macOS installer to SQLite 3.42.0 (GH-104624)
Erlend E. Aasland [Fri, 19 May 2023 06:52:24 +0000 (08:52 +0200)] 
gh-104623: Update macOS installer to SQLite 3.42.0 (GH-104624)

2 years agogh-104619: never leak comprehension locals to outer locals() (#104637)
Carl Meyer [Fri, 19 May 2023 01:50:24 +0000 (19:50 -0600)] 
gh-104619: never leak comprehension locals to outer locals() (#104637)

2 years agogh-104602: ensure all cellvars are known up front (#104603)
Carl Meyer [Fri, 19 May 2023 00:07:35 +0000 (18:07 -0600)] 
gh-104602: ensure all cellvars are known up front (#104603)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-104600: Make function.__type_params__ writable (#104601)
Jelle Zijlstra [Thu, 18 May 2023 23:45:37 +0000 (16:45 -0700)] 
gh-104600: Make function.__type_params__ writable (#104601)

2 years agogh-74690: Don't set special protocol attributes on non-protocol subclasses of protoco...
Alex Waygood [Thu, 18 May 2023 23:34:40 +0000 (00:34 +0100)] 
gh-74690: Don't set special protocol attributes on non-protocol subclasses of protocols (#104622)

Don't set special protocol attributes on non-protocol subclasses of protocols

2 years agogh-104623: Update Windows installer to use SQLite 3.42.0 (#104625)
Erlend E. Aasland [Thu, 18 May 2023 22:59:40 +0000 (00:59 +0200)] 
gh-104623: Update Windows installer to use SQLite 3.42.0 (#104625)

2 years agogh-104050: Add more type annotations to Argument Clinic (#104628)
Erlend E. Aasland [Thu, 18 May 2023 22:57:26 +0000 (00:57 +0200)] 
gh-104050: Add more type annotations to Argument Clinic (#104628)

Annotate the following:

- methods of class Class
- methods of class Module
- methods of class PythonParser
- function compute_checksum()
- function parse_file()
- global variable unsupported_special_methods

2 years agogh-104629: Don't skip test_clinic if _testclinic is missing (#104630)
Erlend E. Aasland [Thu, 18 May 2023 22:56:34 +0000 (00:56 +0200)] 
gh-104629: Don't skip test_clinic if _testclinic is missing (#104630)

Just skip the tests that depend on the _testclinic extension module;
we can still run the Python tests.

2 years agogh-104549: Set __module__ on TypeAliasType (#104550)
Jelle Zijlstra [Thu, 18 May 2023 22:56:15 +0000 (15:56 -0700)] 
gh-104549: Set __module__ on TypeAliasType (#104550)

2 years agogh-104050: Improve some typing around `default`s and sentinel values (#104626)
Alex Waygood [Thu, 18 May 2023 21:58:42 +0000 (22:58 +0100)] 
gh-104050: Improve some typing around `default`s and sentinel values (#104626)

- Convert `unspecified` and `unknown` to be members of a `Sentinels` enum, rather than instances of bespoke classes.
  - An enum feels more idiomatic here, and works better with type checkers.
  - Convert some `==` and `!=` checks for these values to identity checks, which are more idiomatic with sentinels.
  - _Don't_ do the same for `Null`, as this needs to be a distinct type due to its usage in `clinic.py`.
- Use `object` as the annotation for `default` across `clinic.py`. `default` can be literally any object, so `object` is the correct annotation here.

---

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-104146: Remove unused vars from Argument Clinic (#104627)
Erlend E. Aasland [Thu, 18 May 2023 21:52:59 +0000 (23:52 +0200)] 
gh-104146: Remove unused vars from Argument Clinic (#104627)

Remove 'in_classes' and 'so_far' from DSLParser.directive_module()

2 years agogh-104615: don't make unsafe swaps in apply_static_swaps (#104620)
Carl Meyer [Thu, 18 May 2023 21:22:03 +0000 (15:22 -0600)] 
gh-104615: don't make unsafe swaps in apply_static_swaps (#104620)

2 years agoGH-104484: Add case_sensitive argument to `pathlib.PurePath.match()` (GH-104565)
thirumurugan [Thu, 18 May 2023 17:59:31 +0000 (23:29 +0530)] 
GH-104484: Add case_sensitive argument to `pathlib.PurePath.match()` (GH-104565)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2 years agoGH-96803: Document and test new unstable internal frame API functions (GH-104211)
Mark Shannon [Thu, 18 May 2023 09:10:15 +0000 (10:10 +0100)] 
GH-96803: Document and test new unstable internal frame API functions (GH-104211)

Weaken contract of PyUnstable_InterpreterFrame_GetCode to return PyObject*.

2 years agoGH-104580: Don't cache eval breaker in interpreter (GH-104581)
Mark Shannon [Thu, 18 May 2023 09:08:33 +0000 (10:08 +0100)] 
GH-104580: Don't cache eval breaker in interpreter (GH-104581)

Move eval-breaker to the front of the interpreter state.

2 years agogh-104374: Remove access to class scopes for inlined comprehensions (#104528)
Jelle Zijlstra [Thu, 18 May 2023 05:22:17 +0000 (22:22 -0700)] 
gh-104374: Remove access to class scopes for inlined comprehensions (#104528)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2 years agogh-103606: Improve error message from logging.config.FileConfig (GH-103628)
Prince Roshan [Thu, 18 May 2023 04:20:47 +0000 (09:50 +0530)] 
gh-103606: Improve error message from logging.config.FileConfig (GH-103628)

2 years agogh-104499: Fix typo. (#104598)
Terry Jan Reedy [Thu, 18 May 2023 02:35:46 +0000 (22:35 -0400)] 
gh-104499: Fix typo. (#104598)

2 years agogh-104499: IDLE - fix completions for tk aqua 8.7 (#104591)
Terry Jan Reedy [Thu, 18 May 2023 01:36:58 +0000 (21:36 -0400)] 
gh-104499: IDLE - fix completions for tk aqua 8.7 (#104591)

2 years agogh-104340: Suppress warning about unawaited exception for closed pipe stdin (#104586)
Guido van Rossum [Wed, 17 May 2023 23:45:11 +0000 (16:45 -0700)] 
gh-104340: Suppress warning about unawaited exception for closed pipe stdin (#104586)

2 years agogh-104555: Runtime-checkable protocols: Don't let previous calls to `isinstance(...
Alex Waygood [Wed, 17 May 2023 23:43:12 +0000 (00:43 +0100)] 
gh-104555: Runtime-checkable protocols: Don't let previous calls to `isinstance()` influence whether `issubclass()` raises an exception (#104559)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2 years agogh-104050: Add type hints to Argument Clinic converter keywords (#104588)
Erlend E. Aasland [Wed, 17 May 2023 21:05:22 +0000 (23:05 +0200)] 
gh-104050: Add type hints to Argument Clinic converter keywords (#104588)

Introduce TypeSet, and use it to annotate the 'accept' keyword of
various C converters. Also add some missing return annotations for
converter init functions.

2 years agogh-104496: IDLE - fix About for mixed tcl/tk versions (#104585)
Terry Jan Reedy [Wed, 17 May 2023 19:59:13 +0000 (15:59 -0400)] 
gh-104496: IDLE - fix About for mixed tcl/tk versions (#104585)

Print both if they are different, as may happen in the future.

2 years agogh-104372: Cleanup _posixsubprocess `make_inheritable` for async signal safety and...
Gregory P. Smith [Wed, 17 May 2023 15:59:45 +0000 (08:59 -0700)] 
gh-104372: Cleanup _posixsubprocess `make_inheritable` for async signal safety and no GIL requirement (#104518)

Move all of the Python C API calls into the parent process up front
instead of doing PyLong_AsLong and PyErr_Occurred and PyTuple_GET from
the post-fork/vfork child process.

Much of this was long overdue. We shouldn't have been using PyTuple and
PyLong APIs within all of these low level functions anyways.

2 years agoGH-101520: Move tracemalloc functionality into core, leaving interface in Modules...
Mark Shannon [Wed, 17 May 2023 13:17:16 +0000 (14:17 +0100)] 
GH-101520: Move tracemalloc functionality into core, leaving interface in Modules. (#104508)

2 years agotyping: Add more tests for TypeVar (#104571)
Jelle Zijlstra [Wed, 17 May 2023 13:08:21 +0000 (06:08 -0700)] 
typing: Add more tests for TypeVar (#104571)

During the PEP 695 implementation at one point I made
TypeVar.__name__ return garbage, and all of test_typing passed.
So I decided to add a few more tests. In the process I discovered
a minor incompatibility from the C implementation of TypeVar:
empty constraints were returned as None instead of an empty tuple.

2 years agogh-104572: Improve error messages for invalid constructs in PEP 695 contexts (#104573)
Jelle Zijlstra [Wed, 17 May 2023 13:05:42 +0000 (06:05 -0700)] 
gh-104572: Improve error messages for invalid constructs in PEP 695 contexts (#104573)

2 years agotyping: Use PEP 695 syntax in typing.py (#104553)
Jelle Zijlstra [Wed, 17 May 2023 13:03:58 +0000 (06:03 -0700)] 
typing: Use PEP 695 syntax in typing.py (#104553)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-102153: Start stripping C0 control and space chars in `urlsplit` (#102508)
Illia Volochii [Wed, 17 May 2023 08:49:20 +0000 (11:49 +0300)] 
gh-102153: Start stripping C0 control and space chars in `urlsplit` (#102508)

`urllib.parse.urlsplit` has already been respecting the WHATWG spec a bit #25595.

This adds more sanitizing to respect the "Remove any leading C0 control or space from input" [rule](https://url.spec.whatwg.org/#url-parsing:~:text=Remove%20any%20leading%20and%20trailing%20C0%20control%20or%20space%20from%20input.) in response to [CVE-2023-24329](https://nvd.nist.gov/vuln/detail/CVE-2023-24329).

---------

Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
2 years agogh-104469: Update README.txt for _testcapi (gh-104529)
Dong-hee Na [Wed, 17 May 2023 03:56:20 +0000 (12:56 +0900)] 
gh-104469: Update README.txt for _testcapi (gh-104529)

* gh-104469: Update README.txt for _testcapi

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2 years agoGH-103092: isolate `_elementtree` (#104561)
Kumar Aditya [Tue, 16 May 2023 23:35:07 +0000 (05:05 +0530)] 
GH-103092: isolate `_elementtree` (#104561)

2 years agogh-104050: Add typing to Argument Clinic converters (#104547)
Erlend E. Aasland [Tue, 16 May 2023 22:32:11 +0000 (00:32 +0200)] 
gh-104050: Add typing to Argument Clinic converters (#104547)

2 years agoGH-103906: Remove immortal refcounting in the interpreter (GH-103909)
Brandt Bucher [Tue, 16 May 2023 21:36:02 +0000 (14:36 -0700)] 
GH-103906: Remove immortal refcounting in the interpreter (GH-103909)

2 years agogh-87474: Fix file descriptor leaks in subprocess.Popen (#96351)
cptpcrd [Tue, 16 May 2023 20:23:53 +0000 (16:23 -0400)] 
gh-87474: Fix file descriptor leaks in subprocess.Popen (#96351)

This fixes several ways file descriptors could be leaked from `subprocess.Popen` constructor during error conditions by opening them later and using a context manager "fds to close" registration scheme to ensure they get closed before returning.

---------

Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
2 years agoGH-103092: isolate `pyexpat` (#104506)
Kumar Aditya [Tue, 16 May 2023 20:03:01 +0000 (01:33 +0530)] 
GH-103092: isolate `pyexpat`  (#104506)

2 years agogh-75367: Fix data descriptor detection in inspect.getattr_static (#104517)
Furkan Onder [Tue, 16 May 2023 17:34:44 +0000 (17:34 +0000)] 
gh-75367: Fix data descriptor detection in inspect.getattr_static (#104517)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2 years agogh-104050: Add more annotations to `Tools/clinic.py` (#104544)
Nikita Sobolev [Tue, 16 May 2023 17:18:28 +0000 (20:18 +0300)] 
gh-104050: Add more annotations to `Tools/clinic.py` (#104544)

2 years agogh-104555: Fix isinstance() and issubclass() for runtime-checkable protocols that...
Alex Waygood [Tue, 16 May 2023 16:38:10 +0000 (17:38 +0100)] 
gh-104555: Fix isinstance() and issubclass() for runtime-checkable protocols that use PEP 695 (#104556)

Fixes #104555

2 years agogh-103865: add monitoring support to LOAD_SUPER_ATTR (#103866)
Carl Meyer [Tue, 16 May 2023 16:29:00 +0000 (10:29 -0600)] 
gh-103865: add monitoring support to LOAD_SUPER_ATTR (#103866)

2 years agoCODEOWNERS: Assign new PEP 695 files to myself (#104551)
Jelle Zijlstra [Tue, 16 May 2023 15:48:52 +0000 (08:48 -0700)] 
CODEOWNERS: Assign new PEP 695 files to myself (#104551)

2 years agoGH-104510: Fix refleaks in `_io` base types (#104516)
Kumar Aditya [Tue, 16 May 2023 14:38:17 +0000 (20:08 +0530)] 
GH-104510: Fix refleaks in `_io` base types (#104516)

2 years agogh-104539: Fix indentation error in logging.config.rst (#104545)
Jesper Noordsij [Tue, 16 May 2023 12:13:53 +0000 (14:13 +0200)] 
gh-104539: Fix indentation error in logging.config.rst (#104545)

Fix indentation error in logging.config.rst

2 years agogh-104050: Don't star-import 'types' in Argument Clinic (#104543)
Erlend E. Aasland [Tue, 16 May 2023 12:02:18 +0000 (14:02 +0200)] 
gh-104050: Don't star-import 'types' in Argument Clinic (#104543)

2 years agogh-104050: Add basic typing to CConverter in clinic.py (#104538)
Erlend E. Aasland [Tue, 16 May 2023 11:47:35 +0000 (13:47 +0200)] 
gh-104050: Add basic typing to CConverter in clinic.py (#104538)

2 years agogh-64595: Fix write file logic in Argument Clinic (#104507)
Erlend E. Aasland [Tue, 16 May 2023 10:25:43 +0000 (12:25 +0200)] 
gh-64595: Fix write file logic in Argument Clinic (#104507)

Check if any clinic output actually changes any of the output files
before deciding if we should touch the source file.

2 years agogh-104523: Inline minimal PGO rules (#104524)
Gregory Szorc [Tue, 16 May 2023 08:04:58 +0000 (01:04 -0700)] 
gh-104523: Inline minimal PGO rules (#104524)

Inline profiling rules where the existing indirection was unneeded.

2 years agogh-103861: Fix Zip64 extensions not being properly applied in some cases (#103863)
Carey Metcalfe [Tue, 16 May 2023 07:43:44 +0000 (01:43 -0600)] 
gh-103861: Fix Zip64 extensions not being properly applied in some cases (#103863)

Fix Zip64 extensions not being properly applied in some cases:

Fixes an issue where adding a small file to a `ZipFile`
object while forcing zip64 extensions causes an extra Zip64 record to be
added to the zip, but doesn't update the `min_version` or file sizes in
the primary central directory header.

Also fixed an edge case in checking if zip64 extensions are required:

This fixes an issue where if data requiring zip64 extensions was added
to an unseekable stream without specifying `force_zip64=True`, zip64
extensions would not be used and a RuntimeError would not be raised when
closing the file (even though the size would be known at that point).
This would result in successfully writing corrupt zip files.

Deciding if zip64 extensions are required outside of the `FileHeader`
function means that both `FileHeader` and `_ZipWriteFile` will always be
in sync. Previously, the `FileHeader` function could enable zip64
extensions without propagating that decision to the `_ZipWriteFile`
class, which would then not correctly write the data descriptor record
or check for errors on close.

If anyone is actually using `ZipInfo.FileHeader` as a public API without
explicitly passing True or False in for zip64, their own code may still be
susceptible to that kind of bug unless they make a similar change to
where the zip64 decision happens.

Fixes #103861

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-69152: add method get_proxy_response_headers to HTTPConnection class (#104248)
Alexey Namyotkin [Tue, 16 May 2023 06:20:30 +0000 (09:20 +0300)] 
gh-69152: add method get_proxy_response_headers to HTTPConnection class (#104248)

Add http.client.HTTPConnection method get_proxy_response_headers() - this is a followup to https://github.com/python/cpython/pull/26152 which added it as a non-public attribute. This way we don't pre-compute a headers dictionary that most users will never access. The new method is properly public and documented and triggers full proxy header parsing into a dict only when actually called.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>