]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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>
2 years agogh-103763: Implement PEP 695 (#103764)
Jelle Zijlstra [Tue, 16 May 2023 03:36:23 +0000 (20:36 -0700)] 
gh-103763: Implement PEP 695 (#103764)

This implements PEP 695, Type Parameter Syntax. It adds support for:

- Generic functions (def func[T](): ...)
- Generic classes (class X[T](): ...)
- Type aliases (type X = ...)
- New scoping when the new syntax is used within a class body
- Compiler and interpreter changes to support the new syntax and scoping rules

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Eric Traut <eric@traut.com>
Co-authored-by: Larry Hastings <larry@hastings.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104461: Run tkinter test_configure_screen on X11 only (GH-104462)
Christopher Chavez [Tue, 16 May 2023 02:22:53 +0000 (21:22 -0500)] 
gh-104461: Run tkinter test_configure_screen on X11 only (GH-104462)

2 years agogh-104469: Convert _testcapi/watchers.c to use Argument Clinic (#104503)
Nikita Sobolev [Mon, 15 May 2023 20:59:41 +0000 (23:59 +0300)] 
gh-104469: Convert _testcapi/watchers.c to use Argument Clinic (#104503)

Remove boilerplate code by converting the following functions:

- _testcapi.watch_dict
- _testcapi.unwatch_dict
- _testcapi.watch_type
- _testcapi.unwatch_type
- _testcapi.set_func_defaults_via_capi
- _testcapi.set_func_kwdefaults_via_capi

2 years agogh-104482: Fix error handling bugs in ast.c (#104483)
Irit Katriel [Mon, 15 May 2023 20:53:55 +0000 (21:53 +0100)] 
gh-104482: Fix error handling bugs in ast.c (#104483)

2 years agogh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (gh-104437)
Eric Snow [Mon, 15 May 2023 19:59:26 +0000 (13:59 -0600)] 
gh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (gh-104437)

With the move to a per-interpreter GIL, this check slipped through the cracks.

2 years agoGH-102613: Fix recursion error from `pathlib.Path.glob()` (GH-104373)
Barney Gale [Mon, 15 May 2023 17:33:32 +0000 (18:33 +0100)] 
GH-102613: Fix recursion error from `pathlib.Path.glob()` (GH-104373)

Use `Path.walk()` to implement the recursive wildcard `**`. This method
uses an iterative (rather than recursive) walk - see GH-100282.

2 years agogh-101819: Fix _io clinic input for unused base class method stubs (#104418)
Erlend E. Aasland [Mon, 15 May 2023 11:21:38 +0000 (13:21 +0200)] 
gh-101819: Fix _io clinic input for unused base class method stubs (#104418)

When preparing the _io extension module for isolation, many methods were
adapted to Argument Clinic. Some of these used the '*args: object'
signature, which is incorrect. These are now corrected to an exact
signature, and marked unused, since they are stub methods.

2 years agogh-101819: Isolate `_io` (#101948)
Erlend E. Aasland [Mon, 15 May 2023 09:26:27 +0000 (11:26 +0200)] 
gh-101819: Isolate `_io` (#101948)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2 years agoBump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (#104501)
dependabot[bot] [Mon, 15 May 2023 09:17:48 +0000 (09:17 +0000)] 
Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (#104501)

build(deps-dev): bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic

Bumps [mypy](https://github.com/python/mypy) from 1.2.0 to 1.3.0.
- [Commits](https://github.com/python/mypy/compare/v1.2.0...v1.3.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agogh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (#104495)
Christopher Chavez [Mon, 15 May 2023 08:54:41 +0000 (03:54 -0500)] 
gh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (#104495)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-104050: Run mypy on `clinic.py` in CI (#104421)
Alex Waygood [Mon, 15 May 2023 08:49:28 +0000 (09:49 +0100)] 
gh-104050: Run mypy on `clinic.py` in CI (#104421)

* Add basic mypy workflow to CI
* Make the type check pass

---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-104490: Consistently define phony make targets (#104491)
Gregory Szorc [Mon, 15 May 2023 08:48:34 +0000 (01:48 -0700)] 
gh-104490: Consistently define phony make targets (#104491)

By convention make targets that don't refer to a file have a dependency
on the fake .PHONY target/file. This ensures that these targets are
always evaluated because there is no rule to create a .PHONY file
and that will force make to think the rule is out of date and needs
to be rebuilt.

This commit consistently associates virtual targets with .PHONY by
declaring the .PHONY dependency immediately above the make rule. This
should avoid race conditions and avoidable rebuilds across multiple make
invocations.

2 years agogh-67056: document that registering/unregistering an atexit func from within an atexi...
Irit Katriel [Mon, 15 May 2023 08:12:52 +0000 (09:12 +0100)] 
gh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (#104473)

2 years agogh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (#104488)
Erlend E. Aasland [Mon, 15 May 2023 08:02:44 +0000 (10:02 +0200)] 
gh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (#104488)

Also include Python 3.12 in the list of accepted versions.

2 years agogh-101282: move BOLT config after PGO (gh-104493)
Gregory Szorc [Mon, 15 May 2023 04:29:44 +0000 (21:29 -0700)] 
gh-101282: move BOLT config after PGO (gh-104493)

2 years agogh-104469 Convert _testcapi/float.c to use AC (gh-104470)
Dong-hee Na [Mon, 15 May 2023 03:44:00 +0000 (12:44 +0900)] 
gh-104469 Convert _testcapi/float.c to use AC (gh-104470)

2 years agogh-104456: Fix ref leak in _ctypes.COMError (#104457)
Kirill Podoprigora [Sun, 14 May 2023 21:05:35 +0000 (00:05 +0300)] 
gh-104456: Fix ref leak in _ctypes.COMError (#104457)

2 years agogh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (#104474)
Sam Bull [Sun, 14 May 2023 18:58:13 +0000 (19:58 +0100)] 
gh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (#104474)

2 years ago gh-104337: Clarify random.gammavariate doc entry (#104410)
Terry Jan Reedy [Sun, 14 May 2023 18:45:54 +0000 (14:45 -0400)] 
 gh-104337: Clarify random.gammavariate doc entry  (#104410)

* gh-104337: Clarify random.gammavariate doc entry

* Fix parameter markup.

2 years agoMinor improvements to typing docs (#104465)
Jelle Zijlstra [Sun, 14 May 2023 11:53:15 +0000 (04:53 -0700)] 
Minor improvements to typing docs (#104465)

2 years agogh-87092: avoid gcc warning on uninitialized struct field in assemble.c (#104460)
Dong-hee Na [Sun, 14 May 2023 11:03:30 +0000 (20:03 +0900)] 
gh-87092: avoid gcc warning on uninitialized struct field in assemble.c (#104460)

2 years agoGH-71383: IDLE - Document testing subsets of modules (#104463)
Terry Jan Reedy [Sun, 14 May 2023 03:55:20 +0000 (23:55 -0400)] 
GH-71383: IDLE - Document testing subsets of modules (#104463)

2 years agogh-104454: Fix refleak in AttributeError_reduce (#104455)
Charles Machalow [Sat, 13 May 2023 20:45:36 +0000 (13:45 -0700)] 
gh-104454: Fix refleak in AttributeError_reduce (#104455)

* Fix the reference leak introduced by https://github.com/python/cpython/issues/103333

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2 years agogh-75710: IDLE - add docstrings and comments to editor module (#104446)
Terry Jan Reedy [Sat, 13 May 2023 15:41:39 +0000 (11:41 -0400)] 
gh-75710: IDLE - add docstrings and comments to editor module (#104446)

Commit extracted from PR #3669.  Will edit more later.

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2 years agogh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (#104424)
Alex Waygood [Sat, 13 May 2023 08:55:35 +0000 (09:55 +0100)] 
gh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (#104424)

2 years agoAdd a mention of PYTHONBREAKPOINT to breakpoint() docs (#104430)
Ned Batchelder [Sat, 13 May 2023 07:12:03 +0000 (00:12 -0700)] 
Add a mention of PYTHONBREAKPOINT to breakpoint() docs (#104430)

2 years ago gh-99836: IDLE - update news.txt for 3.12 (#104444)
Terry Jan Reedy [Sat, 13 May 2023 04:35:45 +0000 (00:35 -0400)] 
 gh-99836: IDLE - update news.txt for 3.12  (#104444)

* gh-99836: IDLE 3.12 news.txt

* gh-99836: IDLE - update news.txt for 3.12

2 years agogh-104404: fix crasher with nested comprehensions plus lambdas (#104442)
Carl Meyer [Sat, 13 May 2023 00:42:04 +0000 (18:42 -0600)] 
gh-104404: fix crasher with nested comprehensions plus lambdas (#104442)

2 years agoGH-104405: Add missing PEP 523 checks (GH-104406)
Brandt Bucher [Fri, 12 May 2023 22:23:13 +0000 (15:23 -0700)] 
GH-104405: Add missing PEP 523 checks (GH-104406)

2 years agoGH-94841: Fix usage of Py_ALWAYS_INLINE (GH-104409)
Brandt Bucher [Fri, 12 May 2023 21:26:54 +0000 (14:26 -0700)] 
GH-94841: Fix usage of Py_ALWAYS_INLINE (GH-104409)

2 years agogh-103333: Pickle the keyword attributes of AttributeError (#103352)
Charles Machalow [Fri, 12 May 2023 20:33:23 +0000 (13:33 -0700)] 
gh-103333: Pickle the keyword attributes of AttributeError (#103352)

* Pickle the `name` and `args` attributes of AttributeError when present.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-103204: `http.server` - Enforce that HTTP version numbers must consist only of...
Ben Kallus [Fri, 12 May 2023 20:25:58 +0000 (16:25 -0400)] 
gh-103204: `http.server` - Enforce that HTTP version numbers must consist only of digits (#103205)

Reject HTTP requests with invalid http/x.y version numbers: x or y being non-digits or too-long.

---------

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-103857: Update deprecation stacktrace to point to calling line (#104431)
Hugo van Kemenade [Fri, 12 May 2023 18:25:45 +0000 (21:25 +0300)] 
gh-103857: Update deprecation stacktrace to point to calling line (#104431)

2 years agoGH-86275: Run hypothesis tests in parallel (#104427)
Paul Ganssle [Fri, 12 May 2023 16:23:08 +0000 (12:23 -0400)] 
GH-86275: Run hypothesis tests in parallel (#104427)

Run hypothesis tests in parallel

2 years agogh-86275: Fix install of new _hypothesis_stubs directory (#104425)
Jelle Zijlstra [Fri, 12 May 2023 15:51:46 +0000 (08:51 -0700)] 
gh-86275: Fix install of new _hypothesis_stubs directory (#104425)

2 years agogh-91896: Fixup some docs issues following ByteString deprecation (#104422)
Alex Waygood [Fri, 12 May 2023 14:38:35 +0000 (15:38 +0100)] 
gh-91896: Fixup some docs issues following ByteString deprecation (#104422)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agoGH-104371: check return value of calling `mv.release` (#104417)
Kumar Aditya [Fri, 12 May 2023 12:57:06 +0000 (18:27 +0530)] 
GH-104371: check return value of calling `mv.release` (#104417)

2 years agogh-104415: Fix refleak tests for `typing.ByteString` deprecation (#104416)
Nikita Sobolev [Fri, 12 May 2023 12:36:12 +0000 (15:36 +0300)] 
gh-104415: Fix refleak tests for `typing.ByteString` deprecation (#104416)

2 years agoGH-86275: Implementation of hypothesis stubs for property-based tests, with zoneinfo...
Paul Ganssle [Fri, 12 May 2023 12:35:53 +0000 (08:35 -0400)] 
GH-86275: Implementation of hypothesis stubs for property-based tests, with zoneinfo tests (#22863)

These are stubs to be used for adding hypothesis (https://hypothesis.readthedocs.io/en/latest/) tests to the standard library.

When the tests are run in an environment where `hypothesis` and its various dependencies are not installed, the stubs will turn any tests with examples into simple parameterized tests and any tests without examples are skipped.

It also adds hypothesis tests for the `zoneinfo` module, and a Github Actions workflow to run the hypothesis tests as a non-required CI job.

The full hypothesis interface is not stubbed out — missing stubs can be added as necessary.

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
2 years agoGH-103082: Filter LINE events in VM, to simplify tool implementation. (GH-104387)
Mark Shannon [Fri, 12 May 2023 11:21:20 +0000 (12:21 +0100)] 
GH-103082: Filter LINE events in VM, to simplify tool implementation. (GH-104387)

When monitoring LINE events, instrument all instructions that can have a predecessor on a different line.
Then check that the a new line has been hit in the instrumentation code.
This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.

2 years agogh-93649: Split gc- and allocation tests from _testcapimodule.c (GH-104403)
Jurica Bradarić [Fri, 12 May 2023 09:26:07 +0000 (11:26 +0200)] 
gh-93649: Split gc- and allocation tests from _testcapimodule.c (GH-104403)

2 years agogh-104389: Add 'unused' keyword to Argument Clinic C converters (#104390)
Erlend E. Aasland [Fri, 12 May 2023 08:34:00 +0000 (10:34 +0200)] 
gh-104389: Add 'unused' keyword to Argument Clinic C converters (#104390)

Use the unused keyword param in the converter to explicitly
mark an argument as unused:

    /*[clinic input]
    SomeBaseClass.stubmethod
        flag: bool(unused=True)
    [clinic start generated code]*/

2 years agogh-101819: Prepare _io._IOBase for module state (#104386)
Erlend E. Aasland [Fri, 12 May 2023 07:30:26 +0000 (09:30 +0200)] 
gh-101819: Prepare _io._IOBase for module state (#104386)

- Add PyIOBase_Type to _io module state
- Pass defining class to _io._IOBase.fileno

2 years agogh-104413: Fix refleak when super attribute throws AttributeError (#104414)
Jelle Zijlstra [Fri, 12 May 2023 07:30:14 +0000 (00:30 -0700)] 
gh-104413: Fix refleak when super attribute throws AttributeError (#104414)

2 years agoFix refleak in `super_descr_get` (#104408)
Brandt Bucher [Fri, 12 May 2023 07:11:27 +0000 (00:11 -0700)] 
Fix refleak in `super_descr_get` (#104408)

2 years agogh-87526: Remove dead initialization from _zoneinfo parse_abbr() (#24700)
Alex Henrie [Fri, 12 May 2023 06:48:42 +0000 (00:48 -0600)] 
gh-87526: Remove dead initialization from _zoneinfo parse_abbr() (#24700)

2 years agogh-91896: Improve visibility of `ByteString` deprecation warnings (#104294)
Alex Waygood [Fri, 12 May 2023 06:01:31 +0000 (07:01 +0100)] 
gh-91896: Improve visibility of `ByteString` deprecation warnings (#104294)

2 years agogh-104371: Fix calls to `__release_buffer__` while an exception is active (#104378)
Jelle Zijlstra [Fri, 12 May 2023 05:22:40 +0000 (22:22 -0700)] 
gh-104371: Fix calls to `__release_buffer__` while an exception is active (#104378)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-104377: fix cell in comprehension that is free in outer scope (#104394)
Carl Meyer [Thu, 11 May 2023 23:48:21 +0000 (17:48 -0600)] 
gh-104377: fix cell in comprehension that is free in outer scope (#104394)

2 years agogh-104392: Remove _paramspec_tvars from typing (#104393)
Jelle Zijlstra [Thu, 11 May 2023 23:41:26 +0000 (16:41 -0700)] 
gh-104392: Remove _paramspec_tvars from typing (#104393)

This does nothing.

2 years agogh-104396: uuid.py to skip platform check for emscripten and wasi (gh-104397)
Jeong, YunWon [Thu, 11 May 2023 22:45:55 +0000 (07:45 +0900)] 
gh-104396: uuid.py to skip platform check for emscripten and wasi (gh-104397)

2 years agogh-99108: Refresh HACL* from upstream (#104401)
Jonathan Protzenko [Thu, 11 May 2023 21:23:52 +0000 (14:23 -0700)] 
gh-99108: Refresh HACL* from upstream (#104401)

Refresh HACL* from upstream and add a SHA3 test hashing over 4GiB of data.

2 years agogh-104301: Allow leading whitespace in disambiguated pdb statements (#104342)
James Gerity [Thu, 11 May 2023 17:12:02 +0000 (13:12 -0400)] 
gh-104301: Allow leading whitespace in disambiguated pdb statements (#104342)

2 years agogh-104057: Fix direct invocation of test_support (GH-104069)
Kirill Podoprigora [Thu, 11 May 2023 14:44:39 +0000 (17:44 +0300)] 
gh-104057: Fix direct invocation of test_support (GH-104069)

2 years agogh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)
Carl Meyer [Thu, 11 May 2023 14:08:13 +0000 (08:08 -0600)] 
gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)

2 years agogh-101819: Fix inverted debug preprocessor check in winconsoleio.c (#104388)
Erlend E. Aasland [Thu, 11 May 2023 13:01:05 +0000 (15:01 +0200)] 
gh-101819: Fix inverted debug preprocessor check in winconsoleio.c (#104388)

2 years agogh-87849: fix SEND specialization family definition (GH-104268)
Carl Meyer [Thu, 11 May 2023 11:52:06 +0000 (05:52 -0600)] 
gh-87849: fix SEND specialization family definition (GH-104268)

2 years agogh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic (#104384)
Erlend E. Aasland [Thu, 11 May 2023 10:34:26 +0000 (12:34 +0200)] 
gh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic (#104384)

2 years agogh-101819: Adapt _io._Buffered* methods to Argument Clinic (#104367)
Erlend E. Aasland [Thu, 11 May 2023 10:29:23 +0000 (12:29 +0200)] 
gh-101819: Adapt _io._Buffered* methods to Argument Clinic (#104367)

2 years agogh-101819: Refactor `_io` futher in preparation for module isolation (#104369)
Erlend E. Aasland [Thu, 11 May 2023 10:26:30 +0000 (12:26 +0200)] 
gh-101819: Refactor `_io` futher in preparation for module isolation (#104369)

2 years agogh-101819: Adapt _io.TextIOBase methods to Argument Clinic (#104383)
Erlend E. Aasland [Thu, 11 May 2023 10:19:22 +0000 (12:19 +0200)] 
gh-101819: Adapt _io.TextIOBase methods to Argument Clinic (#104383)

2 years agogh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287)
Erlend E. Aasland [Thu, 11 May 2023 08:44:31 +0000 (10:44 +0200)] 
gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287)

The SQLite C API sqlite3_changes() can only be relied upon when the
current active statement has been run to completion.

2 years agoGH-92184: Convert os.altsep to '/' in filenames when creating ZipInfo objects (#92185)
Carey Metcalfe [Thu, 11 May 2023 07:25:16 +0000 (01:25 -0600)] 
GH-92184: Convert os.altsep to '/' in filenames when creating ZipInfo objects (#92185)

This causes the zipfile module to also consider the character defined by
`os.altsep` (if there is one) to be a path separator and convert it to a
forward slash, as defined by the zip specification.

A logical no-op on all known platforms today as os.altsep is currently only set to a meaningful value on Windows (where it is "/").

2 years agogh-104357: fix inlined comprehensions that close over iteration var (#104368)
Carl Meyer [Thu, 11 May 2023 01:08:40 +0000 (19:08 -0600)] 
gh-104357: fix inlined comprehensions that close over iteration var (#104368)

2 years agoGH-90208: Suppress OSError exceptions from `pathlib.Path.glob()` (GH-104141)
Barney Gale [Thu, 11 May 2023 00:01:39 +0000 (01:01 +0100)] 
GH-90208: Suppress OSError exceptions from `pathlib.Path.glob()` (GH-104141)

`pathlib.Path.glob()` now suppresses all OSError exceptions, except
those raised from calling `is_dir()` on the top-level path.

Previously, `glob()` suppressed ENOENT, ENOTDIR, EBADF and ELOOP
errors and their Windows equivalents. PermissionError was also
suppressed unless it occurred when calling `is_dir()` on the
top-level path. However, the selector would abort prematurely
if a PermissionError was raised, and so `glob()` could return
incomplete results.

2 years agoGH-102181: Improve specialization stats for SEND (GH-102182)
penguin_wwy [Wed, 10 May 2023 22:40:59 +0000 (06:40 +0800)] 
GH-102181: Improve specialization stats for SEND (GH-102182)

2 years agogh-103000: Optimise `dataclasses.asdict` for the common case (#104364)
Alex Waygood [Wed, 10 May 2023 21:43:51 +0000 (22:43 +0100)] 
gh-103000: Optimise `dataclasses.asdict` for the common case (#104364)

Co-authored-by: David Ellis <ducksual@gmail.com>
2 years agogh-103538: Remove unused TK_AQUA code (GH-103539)
Christopher Chavez [Wed, 10 May 2023 18:53:13 +0000 (13:53 -0500)] 
gh-103538: Remove unused TK_AQUA code (GH-103539)

2 years agoGH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292)
Barney Gale [Wed, 10 May 2023 17:17:08 +0000 (18:17 +0100)] 
GH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292)

Fix issue where `pathlib.Path.glob()` raised `OSError` when it encountered
a symlink to an overly long path.

2 years agogh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)
Sebastian Berg [Wed, 10 May 2023 16:44:52 +0000 (18:44 +0200)] 
gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)

This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of
using the standard `NAN` and `INFINITY` macros provided by C99.
This change has the side-effect of fixing a bug on MIPS where the
hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN
rather than a quiet NaN.
---------

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2 years agogh-104010: Separate and improve docs for `typing.get_origin` and `typing.get_args...
chgnrdv [Wed, 10 May 2023 14:48:55 +0000 (17:48 +0300)] 
gh-104010: Separate and improve docs for `typing.get_origin` and `typing.get_args` (#104013)

* separate documentation and examples for both functions
* add examples demonstrating behaviour with unsupported types
* document return value of `get_origin` for `ParamSpecArgs` and `ParamSpecKwargs` instances

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (#104355)
Erlend E. Aasland [Wed, 10 May 2023 14:22:55 +0000 (16:22 +0200)] 
gh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (#104355)

Make sure the defining class is passed to all methods,
so we can easily fetch module state from them in the future.

2 years agogh-103960: Dark mode: invert image brightness (#103983)
Hugo van Kemenade [Wed, 10 May 2023 13:46:37 +0000 (16:46 +0300)] 
gh-103960: Dark mode: invert image brightness (#103983)

2 years agogh-104252: Immortalize Py_EMPTY_KEYS (gh-104253)
Eric Snow [Wed, 10 May 2023 13:28:40 +0000 (07:28 -0600)] 
gh-104252: Immortalize Py_EMPTY_KEYS (gh-104253)

This was missed in gh-19474.  It matters for with a per-interpreter GIL since PyDictKeysObject.dk_refcnt breaks isolation and leads to races.

2 years agogh-101819: Clean up _io windows console io after gh-104197 (#104354)
Erlend E. Aasland [Wed, 10 May 2023 10:59:31 +0000 (12:59 +0200)] 
gh-101819: Clean up _io windows console io after gh-104197 (#104354)

2 years agogh-101819: Harden _io init (#104352)
Erlend E. Aasland [Wed, 10 May 2023 10:59:03 +0000 (12:59 +0200)] 
gh-101819: Harden _io init (#104352)

Fix potential refleak if PyModule_AddObject() fails.

2 years agogh-103247: clear the module cache in a test in test_importlib/extensions/test_loader...
sunmy2019 [Wed, 10 May 2023 00:59:04 +0000 (08:59 +0800)] 
gh-103247: clear the module cache in a test in test_importlib/extensions/test_loader.py (GH-104226)

2 years agogh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6...
JohnJamesUtley [Wed, 10 May 2023 00:18:35 +0000 (20:18 -0400)] 
gh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format (#103849)

* Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-74895: adjust tests to work on Solaris (#104326)
Jakub Kulík [Tue, 9 May 2023 23:49:55 +0000 (01:49 +0200)] 
gh-74895: adjust tests to work on Solaris (#104326)

Solaris is unusual here, but apparently everyone is happy when SOCK_STREAM is explicitly specified.

2 years agogh-101819: Refactor _io in preparation for module isolation (#104334)
Erlend E. Aasland [Tue, 9 May 2023 23:09:03 +0000 (01:09 +0200)] 
gh-101819: Refactor _io in preparation for module isolation (#104334)

- Replace query with parameter in bufferediobase_unsupported()
- Replace query with parameter in iobase_unsupported()
- Hide delegate: Add method wrapper for _PyIOBase_check_seekable
- Hide delegate: Add method wraper for _PyIOBase_check_readable
- Hide delegate: Add method wraper for _PyIOBase_check_writable
- Replace query with parameter in _PyIOBase_check_seekable()
- Replace query with parameter in _PyIOBase_check_readable()
- Replace query with parameter in _PyIOBase_check_writable()

2 years agogh-90953: Don't use deprecated AST nodes in clinic.py (#104322)
Alex Waygood [Tue, 9 May 2023 21:16:22 +0000 (22:16 +0100)] 
gh-90953: Don't use deprecated AST nodes in clinic.py (#104322)

2 years agogh-102327: Extend docs for "url" and "headers" parameters to HTTPConnection.request()
David Foster [Tue, 9 May 2023 19:57:17 +0000 (15:57 -0400)] 
gh-102327: Extend docs for "url" and "headers" parameters to HTTPConnection.request()

Added example on how to use the HTTPConnection object for making GET request.

Original issue: https://github.com/python/cpython/issues/102327

---------

Co-authored-by: Éric <earaujo@caravan.coop>
2 years agogh-104328: Fix typo in ``typing.Generic`` multiple inheritance error message (#104335)
Kirill Podoprigora [Tue, 9 May 2023 19:18:15 +0000 (22:18 +0300)] 
gh-104328: Fix typo in ``typing.Generic`` multiple inheritance error message (#104335)

2 years agogh-97696 Add documentation for get_coro() behavior with eager tasks (#104304)
Jacob Bower [Tue, 9 May 2023 17:09:16 +0000 (10:09 -0700)] 
gh-97696 Add documentation for get_coro() behavior with eager tasks (#104304)

2 years agogh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)
Carl Meyer [Tue, 9 May 2023 17:02:14 +0000 (11:02 -0600)] 
gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-99889: Fix directory traversal security flaw in uu.decode() (#104096)
Sam Carroll [Tue, 9 May 2023 16:01:58 +0000 (12:01 -0400)] 
gh-99889: Fix directory traversal security flaw in uu.decode() (#104096)

* Fix directory traversal security flaw in uu.decode()
* also check absolute paths and os.altsep
* Add a regression test.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2 years agogh-104184: fix building --with-pydebug --enable-pystats (#104217)
Carl Meyer [Tue, 9 May 2023 14:53:19 +0000 (08:53 -0600)] 
gh-104184: fix building --with-pydebug --enable-pystats (#104217)

2 years agogh-104139: Add itms-services to uses_netloc urllib.parse. (#104312)
Gregory P. Smith [Tue, 9 May 2023 14:04:50 +0000 (07:04 -0700)] 
gh-104139: Add itms-services to uses_netloc urllib.parse. (#104312)

Teach unsplit to retain the `"//"` when assembling `itms-services://?action=generate-bugs` style
[Apple Platform Deployment](https://support.apple.com/en-gb/guide/deployment/depce7cefc4d/web) URLs.

2 years agogh-104240: return code unit metadata from codegen (#104300)
Irit Katriel [Tue, 9 May 2023 13:33:40 +0000 (14:33 +0100)] 
gh-104240: return code unit metadata from codegen (#104300)

2 years agogh-104276: Make `_struct.unpack_iterator` type use type flag instead of custom constr...
chgnrdv [Tue, 9 May 2023 12:41:09 +0000 (15:41 +0300)] 
gh-104276: Make `_struct.unpack_iterator` type use type flag instead of custom constructor (#104277)

2 years agogh-97696: Move around and update the whatsnew entry for asyncio eager task factory...
Itamar Ostricher [Tue, 9 May 2023 12:39:59 +0000 (05:39 -0700)] 
gh-97696: Move around and update the whatsnew entry for asyncio eager task factory (#104298)

2 years agogh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320)
Alex Waygood [Tue, 9 May 2023 12:33:36 +0000 (13:33 +0100)] 
gh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320)

2 years agorequire-pr-label.yml: Add missing "permissions:" (#104309)
Sebastian Pipping [Tue, 9 May 2023 10:29:00 +0000 (12:29 +0200)] 
require-pr-label.yml: Add missing "permissions:" (#104309)