Commit Graph

12419 Commits

Author SHA1 Message Date
Jelle Zijlstra ab8f54668b
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.
2023-05-19 06:50:34 -07:00
Ronald Oussoren 616fcad6e2
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>
2023-05-19 09:15:11 +02:00
thirumurugan dcdc90d384
GH-104484: Add case_sensitive argument to `pathlib.PurePath.match()` (GH-104565)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-05-18 18:59:31 +01:00
Prince Roshan 152227b569
gh-103606: Improve error message from logging.config.FileConfig (GH-103628) 2023-05-18 05:20:47 +01:00
Illia Volochii 2f630e1ce1
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>
2023-05-17 01:49:20 -07:00
Jesper Noordsij 0bb61dd5b0
gh-104539: Fix indentation error in logging.config.rst (#104545)
Fix indentation error in logging.config.rst
2023-05-16 13:13:53 +01:00
Alexey Namyotkin 85ec192ac4
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>
2023-05-16 06:20:30 +00:00
Jelle Zijlstra 24d8b88420
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>
2023-05-15 20:36:23 -07:00
Irit Katriel b15a1a6ac6
gh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (#104473) 2023-05-15 09:12:52 +01:00
Terry Jan Reedy 88c5c58670
gh-104337: Clarify random.gammavariate doc entry (#104410)
* gh-104337: Clarify random.gammavariate doc entry

* Fix parameter markup.
2023-05-14 14:45:54 -04:00
Jelle Zijlstra 2f7b5e458e
Minor improvements to typing docs (#104465) 2023-05-14 12:53:15 +01:00
Alex Waygood c527eb1c2a
gh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (#104424) 2023-05-13 09:55:35 +01:00
Ned Batchelder 1be80ed107
Add a mention of PYTHONBREAKPOINT to breakpoint() docs (#104430) 2023-05-13 00:12:03 -07:00
Alex Waygood ce4eecf989
gh-91896: Fixup some docs issues following ByteString deprecation (#104422)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-12 15:38:35 +01:00
James Gerity 0449ffe3a4
gh-104301: Allow leading whitespace in disambiguated pdb statements (#104342) 2023-05-11 18:12:02 +01:00
Erlend E. Aasland 7470321f81
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.
2023-05-11 10:44:31 +02:00
chgnrdv a7a2dbbf72
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>
2023-05-10 07:48:55 -07:00
Hugo van Kemenade 13ac1766bc
gh-103960: Dark mode: invert image brightness (#103983) 2023-05-10 16:46:37 +03:00
David Foster 7ba6288feb
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>
2023-05-09 12:57:17 -07:00
Jacob Bower 2866e030f0
gh-97696 Add documentation for get_coro() behavior with eager tasks (#104304) 2023-05-09 10:09:16 -07:00
Carl Meyer c3b595e73e
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>
2023-05-09 11:02:14 -06:00
Adam Turner 76eef552f3
GH-104145: Use fully-qualified cross reference types for the bisect module (#104172) 2023-05-08 17:32:18 +01:00
Shantanu 1f5679540c
gh-102500: Remove mention of bytes shorthand (#104281)
The bytes shorthand was removed in PEP 688:
https://peps.python.org/pep-0688/#no-special-meaning-for-bytes

I also remove the reference to `collections.abc.ByteString`, since that
object is deprecated (#91896) and has different semantics (#102092)
2023-05-08 14:40:51 +01:00
Itamar Ostricher c2683fc46d
gh-97696: Improve and fix documentation for asyncio eager tasks (#104256) 2023-05-08 17:29:34 +05:30
Itamar Ostricher 4ee2068c34
gh-104254: Document the optional keyword-only "context" argument to Task constructor (#104251)
(This was added in 3.11. It was already documented for `create_task()`, but not for `Task()`.)
2023-05-06 18:31:53 -07:00
Adam Turner f5088006ca
GH-97950: Use new-style index directive ('builtin') (#104164)
* Uncomment builtin removal in pairindextypes

* Use new-style index directive ('builtin') - C API

* Use new-style index directive ('builtin') - Extending

* Use new-style index directive ('builtin') - Library

* Use new-style index directive ('builtin') - Reference

* Use new-style index directive ('builtin') - Tutorial
2023-05-06 06:54:08 +03:00
Sam Morris 4cd95dce0b
gh-102215: importlib documentation cleanups 2023-05-06 03:40:19 +01:00
Barney Gale d00d942149
GH-100479: Add `pathlib.PurePath.with_segments()` (GH-103975)
Add `pathlib.PurePath.with_segments()`, which creates a path object from arguments. This method is called whenever a derivative path is created, such as from `pathlib.PurePath.parent`. Subclasses may override this method to share information between path objects.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-05 19:04:53 +00:00
Carl Meyer fa86a77589
gh-104112: link from cached_property docs to method-caching FAQ (#104113)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-04 16:38:53 -06:00
Barney Gale 8100be5535
GH-81079: Add case_sensitive argument to `pathlib.Path.glob()` (GH-102710)
This argument allows case-sensitive matching to be enabled on Windows, and
case-insensitive matching to be enabled on Posix.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2023-05-04 16:44:36 +00:00
Shantanu 09b7695f12
gh-91896: Deprecate collections.abc.ByteString (#102096)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-05-04 09:39:33 -07:00
Jelle Zijlstra b7a0a52196
gh-102500: Document PEP 688 (#102571)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-04 08:23:40 -07:00
Gleb Smirnoff b17d32c114
gh-96534: socketmodule: support FreeBSD divert(4) socket (#96536) 2023-05-04 14:57:05 +00:00
Adam Turner 55d50d147c
GH-97950: Use new-style index directive ('statement') (#104162) 2023-05-04 13:48:45 +03:00
Adam Turner 6ab463684b
GH-97950: Use new-style index directive ('object') (#104158)
* Uncomment object removal in pairindextypes

* Use new-style index directive ('object') - C API

* Use new-style index directive ('object') - Library

* Use new-style index directive ('object') - Reference

* Use new-style index directive ('object') - Tutorial
2023-05-04 13:04:41 +03:00
Adam Turner b0ce2db118
GH-97950: Use new-style index directive ('operator') (#104156) 2023-05-04 12:03:11 +03:00
Adam Turner d0122372f2
GH-97950: Use new-style index directive ('module') (#103996)
* Use new-style index directive ('module') - C API

* Use new-style index directive ('module') - Library

* Use new-style index directive ('module') - Reference

* Use new-style index directive ('module') - Tutorial

* Uncomment module removal in pairindextypes

* Use new-style index directive ('module') - C API

* Use new-style index directive ('module') - Library

* Use new-style index directive ('module') - Reference
2023-05-04 10:17:12 +02:00
Nikita Sobolev d6e83fbf30
gh-97850: Deprecate `find_loader` and `get_loader` in `pkgutil` (GH-98520)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-03 16:11:54 -07:00
Tian Gao 0fc58c66ba
gh-103693: Add convenience variable feature to `pdb` (#103694) 2023-05-03 15:04:50 +01:00
Adam Turner 328435ed42
GH-98040: Suppress cross-references to the removed ``imp`` module (#104131)
Suppress cross-references to imp
2023-05-03 13:29:42 +01:00
Barry Warsaw 326997829d
gh-98040: Remove find_loader, find_module and other deprecated APIs (#98059)
* Remove deprecated classes from pkgutil
* Remove some other PEP 302 obsolescence
* Use find_spec instead of load_module
* Remove more tests of PEP 302 obsolete APIs
* Remove another bunch of tests using obsolete load_modules()
* Remove deleted names from __all__
* Remove obsolete footnote
* imp is removed
* Remove `imp` from generated stdlib names
* What's new and blurb
* Update zipimport documentation for the removed methods
* Fix some Windows tests
* Remove any test (or part of a test) that references `find_module()`.
* Use assertIsNone() / assertIsNotNone() consistently.
* Update Doc/reference/import.rst
* We don't need pkgutil._get_spec() any more either
*  test.test_importlib.fixtures.NullFinder
* ...BadLoaderFinder.find_module
* ...test_api.InvalidatingNullFinder.find_module
* ...test.test_zipimport test of z.find_module
* Suppress cross-references to find_loader and find_module
* Suppress cross-references to Finder
* Suppress cross-references to pkgutil.ImpImporter and pkgutil.ImpLoader

---------

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-05-03 04:55:22 -07:00
Tim Hoffmann fdb3ef8c0f
gh-82012: Deprecate bitwise inversion (~) of bool (#103487)
The bitwise inversion operator on bool returns the bitwise inversion of the
underlying int value; i.e. `~True == -2` such that `bool(~True) == True`.

It's a common pitfall that users mistake `~` as negation operator and actually
want `not`. Supporting `~` is an artifact of bool inheriting from int. Since there
is no real use-case for the current behavior, let's deprecate `~` on bool and
later raise an error. This removes a potential source errors for users.

Full reasoning: https://github.com/python/cpython/issues/82012#issuecomment-1258705971

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-03 00:00:42 -07:00
Hugo van Kemenade 5b05b013ff
gh-101100: Fix Sphinx warnings in `curses` and `curses.ascii` modules (#103457)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-02 23:09:04 -06:00
andrei kulakov af886ffa06
GH-89769: `pathlib.Path.glob()`: do not follow symlinks when checking for precise match (GH-29655)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-05-03 04:50:10 +01:00
Shantanu 587f2f0180
gh-65022: Fix description of tuple return value in copyreg (#103892) 2023-05-02 11:13:47 -07:00
Rafael Fontenelle 68ed2a2a3f
GH-103484: Fix redirected permanently URLs (#104001)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2023-05-02 09:34:44 +03:00
Shantanu 82ba6ce303
Improve assert_type phrasing (#104081)
I'd like to make the fact that this does nothing at runtime
really obvious, since I suspect this is unintuitive for users who are
unfamiliar with static type checking.

I thought of this because of
https://discuss.python.org/t/add-arg-check-type-to-types/26384
wherein I'm skeptical that the user really did want `assert_type`.
2023-05-01 23:05:25 -07:00
Itamar Ostricher a474e04388
gh-97696: asyncio eager tasks factory (#102853)
Co-authored-by: Jacob Bower <jbower@meta.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2023-05-01 15:10:13 -06:00
Ben Faulhaber 93107aa2a4
Adjust expression from `==` to `!=` in alignment with the meaning of the paragraph. (GH-104021) 2023-05-01 06:47:34 +01:00
Liam Gersten 74a2b79c62
gh-88773: Added teleport method to Turtle library (#103974)
Add a `teleport` method to `turtle` module turtle instances that acts a lot like `goto`, _but_ ensures the pen is up while warping to the new position to and can control shape filling behavior as part of the jump.

Based on an educator user feature request.

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-04-30 13:17:36 -07:00
Prince Roshan 84e7d0f0c7
gh-103636: issue warning for deprecated calendar constants (#103833)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-04-29 01:16:46 -06:00
Jelle Zijlstra ed29f524cf
Various small fixes to dis docs (#103923)
- Fix description of MAKE_CELL, which appeared to be inverted from the
  actual behavior
- Fix stray ".:" (sphinx-contrib/sphinx-lint#63)
- Fix inconsistent indentation
- Add some missing code blocks
- Slight style improvements
2023-04-29 00:02:21 -07:00
Barry Warsaw e1f14643dc
gh-98040: Remove just the `imp` module (#98573) 2023-04-28 16:17:58 -07:00
Olga Matoula 83aa496f81
gh-101100: Add reference doc for __post_init__ (#103818)
Signed-off-by: Olga Matoula <olgamatoula@gmail.com>
2023-04-28 13:10:26 -06:00
Raymond Hettinger c3453fbb11
Update itertool recipe: polynomial_from_roots() (GH-103973) 2023-04-28 12:25:50 -05:00
Erlend E. Aasland 30216b69a2
gh-100021: Document that sqlite3's executemany() discards resulting rows (#103939) 2023-04-28 10:02:23 +02:00
Marek Marczykowski-Górecki 67d140dba7
gh-83925: Make asyncio.subprocess communicate similar to non-asyncio (#18650)
subprocess's communicate(None) closes stdin of the child process, after
sending no (extra) data. Make asyncio variant do the same.
This fixes issues with processes that waits for EOF on stdin before
continuing.
2023-04-27 17:30:26 -07:00
Erlend E. Aasland 2cf945bec6
Docs: fix dunders with too many underscores (#103955) 2023-04-27 23:17:43 +02:00
Adam Turner 44b5c21f41
GH-103903: Test the minimum Sphinx version in CI (#103904) 2023-04-27 19:27:38 +01:00
Paul Ganssle 0b7fd8ffc5
GH-103857: Deprecate utcnow and utcfromtimestamp (#103858)
Using `datetime.datetime.utcnow()` and `datetime.datetime.utcfromtimestamp()` will now raise a `DeprecationWarning`.

We also have removed our internal uses of these functions and documented the change.
2023-04-27 11:32:30 -06:00
Stefano Rivera 76632b836c
gh-62432: unittest runner: Exit code 5 if no tests were run (#102051)
As discussed in https://discuss.python.org/t/unittest-fail-if-zero-tests-were-discovered/21498/7

It is common for test runner misconfiguration to fail to find any tests,
This should be an error.

Fixes: #62432
2023-04-27 01:28:46 +00:00
Franek Magiera dc3f97549a
gh-103629: Update typing.Unpack docs in compliance with PEP 692 (#103894) 2023-04-26 16:39:39 -06:00
Michael Blahay 44010d0f12
gh-48241: Clarify URL needs to be encoded when provided to urlopen and Request (#103855)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-26 22:52:23 +02:00
Erlend E. Aasland bb8aa7a2b4
gh-103489: Add get/set config methods to sqlite3.Connection (#103506) 2023-04-26 19:57:48 +00:00
Erlend E. Aasland 222c63fc6b
gh-103015: Add entrypoint keyword param to sqlite3.Connection.load_extension (#103073) 2023-04-26 21:22:03 +02:00
Owain Davies 28a05f4cc2
gh-101879: docs - italicize argument in smtplib.SMPT() description (#101886) 2023-04-26 21:00:19 +02:00
July Tikhonov 37e37553b0
gh-91441: Clarify the docs of asyncio.loop.subprocess_exec() (#91442)
Clarify the docs of asyncio.loop.subprocess_exec()

Clarify the documentation of stdin, stdout and stderr arguments of
asyncio.loop.subprocess_exec().

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2023-04-26 12:57:19 -06:00
Carol Willing 1c0a9c5a1c
gh-101786: Clarify docs that asyncio.Server.sockets is a socket-like TransportSocket (#103877)
Clarify that asyncio.Server.sockets is a socket-like TransportSocket
2023-04-26 06:32:24 -06:00
Alex Waygood cef542ca57
gh-103721: Improve cross-references for generic-alias docs (#103838)
Cc. @adriangb

The "stub documentation" in `types.rst` does already link to the
in-depth docs in `stdtypes.rst`, but the link isn't obvious for new
users. It deserves to be made more prominent.

- Issue: https://github.com/python/cpython/issues/103721
2023-04-25 10:24:49 -06:00
Samuel Sloniker 32bea69b89
gh-51574: Make tempfile.mkdtemp() always return absolute paths (#94612)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-04-25 16:05:59 +00:00
Olga Matoula 0f23eda4b9
gh-103810: Fix broken references in dataclasses (#103811)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-04-25 01:26:18 +02:00
jb2170 d94b3a6f45
gh-103673: Add missing ForkingUnixStreamServer and ForkingUnixDatagramServer socketservers (#103674)
sockserver gains ForkingUnixStreamServer and ForkingUnixDatagramServer classes for consistency with all of the others. Ironically these existed but were buried in our test suite.

Addresses #103673 

<!-- gh-issue-number: gh-103673 -->
* Issue: gh-103673
<!-- /gh-issue-number -->

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-24 22:35:52 +00:00
Carl Meyer 0dc8b50d33
gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)
This speeds up `super()` (by around 85%, for a simple one-level
`super().meth()` microbenchmark) by avoiding allocation of a new
single-use `super()` object on each use.
2023-04-24 22:22:14 +00:00
Łukasz Langa 22bed58e53
gh-103791: Make contextlib.suppress also act on exceptions within an ExceptionGroup (#103792)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-04-24 22:17:02 +00:00
Hugo van Kemenade 79ae019164
gh-101100: Fix Sphinx warnings in `argparse` module (#103289)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-04-24 15:36:32 -06:00
William Andrea 2aa22f72fb
gh-99032: datetime docs: Encoding is no longer relevant (#93365)
This removes a section of the `strftime` and `strptime` documentation that refers to a bygone era when `strftime` would return an encoded byte string.

---------

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2023-04-24 12:54:16 -06:00
Howie Zhao 5b404d6cad
gh-94300: Update datetime.strptime documentation (#95318)
The new wording better reflects the cases where `datetime.strptime` differs from` time.strptime`.

---------

Co-authored-by: Paul Ganssle <git@m.ganssle.io>
2023-04-24 12:35:15 -06:00
Furkan Onder 0421ed44a9
GH-65022: Fix description of copyreg.pickle function (#102656)
Fix description of copyreg.pickle function
2023-04-24 11:26:40 -06:00
Allan Lago 7ef614c1ad
gh-91687: modernize dataclass example typing (#103773)
modernize dataclass example typing `list` rather than `List` and comment as to that line being the alluded too error.
2023-04-24 10:16:23 -07:00
Jaime Alonso Lorenzo d2745fe850
gh-103765: Fix 'Warning: py:class reference target not found: ModuleSpec' (GH-103769) 2023-04-24 10:51:45 -06:00
Joshua Herman 68f5836582
gh-87452: Improve the Popen.returncode docs
Clarifies that it remains None until a method checking the child process status has been called and noticed it has terminated.
2023-04-24 09:46:12 -07:00
Richard Hajek 385d8d2b64
Removed unnecessary escaping of asterisks (#103714)
Removed unnecessary escaping of asterisks, as visible both on GitHub and in https://docs.python.org/3/library/decimal.html#decimal.localcontext

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-24 16:31:41 +00:00
Stanley 59c522f965
gh-44123: Add note on relative path for os.exec* (GH-93826)
Co-authored-by: Steve Dower <steve.dower@python.org>
2023-04-24 14:52:31 +01:00
Petr Viktorin af53046995
gh-102950: Implement PEP 706 – Filter for tarfile.extractall (#102953) 2023-04-24 10:58:06 +02:00
James Hilton-Balfe 730bbddfdf
gh-101688: Implement types.get_original_bases (#101827)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-04-23 20:24:30 +01:00
Randy 7bf94568a9
gh-68654: Clarify subdirectories used by pkgutil.extend_path (#103701)
Clarify sub directories used by pkgutil.extend_path in the docs and the docstring
2023-04-22 17:33:50 -06:00
Hugo van Kemenade 8cb2b0f953
Revert "Avoid error lexing multiprocessing docs code block on Pygments 2.15.0" (#103616)
This reverts commit ace51dcdb7.
2023-04-22 15:41:58 -06:00
Eddie Elizondo ea2c001650
gh-84436: Implement Immortal Objects (gh-19474)
This is the implementation of PEP683

Motivation:

The PR introduces the ability to immortalize instances in CPython which bypasses reference counting. Tagging objects as immortal allows up to skip certain operations when we know that the object will be around for the entire execution of the runtime.

Note that this by itself will bring a performance regression to the runtime due to the extra reference count checks. However, this brings the ability of having truly immutable objects that are useful in other contexts such as immutable data sharing between sub-interpreters.
2023-04-22 13:39:37 -06:00
Eric Wieser 3d2a46845b
gh-83791: Raise TypeError for len(memoryview_0d) (#18463)
Changes the behaviour of `len` on a zero-dimensional `memoryview` to raise `TypeError`. Previously, `len` would return `1`.
2023-04-22 17:32:47 +01:00
Rafael Fontenelle caed49448d
GH-103484: Fix broken links reported by linkcheck (#103608)
* Doc: Fix broken links reported by linkcheck

* Apply suggestions from code review

- Remove extra diff line in faq/library.rst (merwok)
- Use HTTPS to link Unicode 15.0.0 to solve a redirect (hugovk)
- Use wayback machine link for openssl 1.1.0 instead of linking 1.1.1, "as this text mentions a feature from 1.1.0" (hugovk)

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Doc: Make mark-up code as literal

* Doc: Alphabetize items in linkcheck_ignore

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Doc: Improve comment in sphinx conf

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

---------

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-04-22 08:24:47 -06:00
Raymond Hettinger e5eaac6064
GH-103475: cache() and lru_cache() do not have a "call once" guarantee (GH-103669) 2023-04-22 09:18:25 -05:00
Raymond Hettinger 7d20783d45
Minor improvements to the functools docs (#103672)
* Use an f-string for improved readability

* Put version notes in chronological order
2023-04-21 20:53:50 -05:00
Jason R. Coombs 3e0fec7e07
Sync with importlib_metadata 6.5 (GH-103584) 2023-04-20 22:12:48 -04:00
Adrien 4898415df7
gh-98641: Document difference between task group and gather (#103644)
The purpose of the comments is to rule out the implication that asyncio.TaskGroup is a drop-in replacement / better alternative to asyncio.gather().
2023-04-20 07:07:41 -07:00
Pablo Galindo Salgado 1ef61cf71a
gh-102856: Initial implementation of PEP 701 (#102855)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2023-04-19 11:18:16 -05:00
Kumar Aditya da2273fec7
GH-88342: clarify that `asyncio.as_completed` accepts generators yielding tasks (#103626) 2023-04-19 15:51:53 +05:30
Nikita Sobolev f4d087964e
gh-103582: Remove last references to `argparse.REMAINDER` from docs (#103586) 2023-04-18 23:02:48 -06:00
Ethan Furman 700ec657c8
gh-103596: [Enum] do not shadow mixed-in methods/attributes (GH-103600)
For example:

    class Book(StrEnum):
        title = auto()
        author = auto()
        desc = auto()

    Book.author.desc is Book.desc

but

    Book.author.title() == 'Author'

is commonly expected.  Using upper-case member names avoids this confusion and possible performance impacts.

Co-authored-by: samypr100 <3933065+samypr100@users.noreply.github.com>
2023-04-18 16:19:23 -07:00
zyckk4 4e04393b2f
[Doc] Fix a typo in optparse.rst (#103504) 2023-04-18 16:51:26 +05:30
yuki c3d015ce62
gh-101100: Fix broken reference `__format__` in `string.rst` (#103531) 2023-04-18 16:48:53 +05:30
Pradyun Gedam ece20dba12
gh-95299: Stop installing setuptools as a part of ensurepip and venv (#101039)
Remove the bundled setuptools wheel from ensurepip, and stop installing setuptools in environments created by venv.

Co-Authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-04-17 23:43:34 -05:00
Giampaolo Rodola ff3303e49c
gh-48330: address review comments to PR-12271 (#103209)
address review comments to PR-12271

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
2023-04-17 00:19:44 +02:00
Ethan Furman 2194071540
gh-103365: [Enum] STRICT boundary corrections (GH-103494)
STRICT boundary:

- fix bitwise operations
- make default for Flag
2023-04-13 08:24:33 -07:00
Skip Montanaro 330a942b63
gh-67230: add quoting rules to csv module (GH-29469)
Add two quoting styles for csv dialects.
They will help to work with certain databases in particular.

Automerge-Triggered-By: GH:merwok
2023-04-12 15:32:30 -07:00
Nick Burns f2b7ecb778
gh-103417: use time.monotonic in the example for sched.scheduler (#103418) 2023-04-12 01:59:21 -07:00
Bar Harel 8f54302ab4
gh-103357: Add logging.Formatter defaults support to logging.config fileConfig and dictConfig (GH-103359) 2023-04-12 08:35:56 +01:00
Tian Gao 449bf2a76b
gh-103237: Polish pdb docs (#103238) 2023-04-11 23:18:34 -07:00
Tian Gao 2f41a009b7
gh-103143: Polish pdb help messages and doc strings (GH-103144)
* Made all the command part of the docstring match the official documentation
* Always have a space between the command and the description in docstring
* Added a helper function to format the help message

Before:

```
(Pdb) h a
a(rgs)
        Print the argument list of the current function.
(Pdb) h commands
commands [bpnumber]
        (com) ...
        (com) end
        (Pdb)
        ...
(Pdb) h interact
interact

        Start an interactive interpreter whose global namespace
        contains all the (global and local) names found in the current scope.
```

After
```
(Pdb) h a
      Usage: a(rgs)
      
      Print the argument list of the current function.
(Pdb) h commands
      Usage: (Pdb) commands [bpnumber]
             (com) ...
             (com) end
             (Pdb)
             ...
(Pdb) h interact
      Usage: interact
      
      Start an interactive interpreter whose global namespace
      contains all the (global and local) names found in the current scope.
```

Automerge-Triggered-By: GH:brandtbucher
2023-04-11 15:40:30 -07:00
Nikita Sobolev 50b4b15984
gh-87864: Use correct function definition syntax in the docs (#103312) 2023-04-11 16:50:25 +03:00
Alex Waygood e071f00aae
gh-103373: `__mro_entries__` docs: improve cross references (#103398)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-04-11 11:25:45 +01:00
Irit Katriel 78b763f630
gh-103176: sys._current_exceptions() returns mapping to exception instances instead of exc_info tuples (#103177) 2023-04-11 09:38:37 +01:00
C.A.M. Gerlach 75b6ab80da
Doc: Avoid error lexing multiprocessing docs code block on Pygments 2.15.0 (#103421) 2023-04-10 20:57:36 -07:00
raylu 8b1b17134e
gh-103059: Clarify gc.freeze documentation (#103058) 2023-04-10 10:30:32 -06:00
James Hilton-Balfe ecad802e3f
Fix old behaviour in typing documentation (#103400) 2023-04-09 22:55:32 +01:00
Raymond Hettinger f65fdbb8fd
Itertool recipe improvements (GH-103399) 2023-04-09 14:17:37 -05:00
mara004 975d220bbe
ctypes docs: fix missing `not` in variadic functions section (#102611) 2023-04-09 13:56:52 +05:30
yuki 83af8f2686
Docs: Fix broken reference `__getitem__` in `string.rst` (#103371) 2023-04-09 07:32:16 +05:30
Ezio Melotti 3310b94d3d
gh-100574: add examples/links to the `strptime`/`strftime` docs (#100575) 2023-04-08 11:46:47 +03:00
Alex Waygood 644136563d
gh-74690: Document changes made to runtime-checkable protocols in 3.12 (#103348)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-04-07 22:06:37 +01:00
Oleg Iarygin f0424ba4b6
gh-103266: Fix a typo in example code for bisect() function (#103267) 2023-04-06 17:34:19 -07:00
Brandt Bucher b4978ff872
GH-88691: Shrink the CALL caches (GH-103230) 2023-04-05 14:15:49 -07:00
Olivier Gayot fdd0fff277
gh-102899: Fix doc link for getting filesystem error handler (#102901) 2023-04-05 16:54:43 +02:00
Serhiy Storchaka a28d4edb23
gh-100408: Fix a traceback in multiprocessing example (#100409) 2023-04-05 12:43:26 +01:00
C.A.M. Gerlach c396b6ddf3
gh-81762: Clarify and simplify description of print's flush param (#103264) 2023-04-05 12:16:36 +01:00
Michael Handler 1a8f862e32
gh-66897: Upgrade HTTP CONNECT to protocol HTTP/1.1 (#8305)
* bpo-22708: Upgrade HTTP CONNECT to protocol HTTP/1.1 (GH-NNNN)

Use protocol HTTP/1.1 when sending HTTP CONNECT tunnelling requests;
generate Host: headers if one is not already provided (required by
HTTP/1.1), convert IDN domains to punycode in HTTP CONNECT requests.

* Refactor tests to pass under -bb (fix ByteWarnings); missed some lines >80.

* Use consistent 'tunnelling' spelling in Lib/http/client.py

* Lib/test/test_httplib: Remove remnant of obsoleted test.

* Use dict.copy() not copy.copy()

* fix version changed

* Update Lib/http/client.py

Co-authored-by: bgehman <bgehman@users.noreply.github.com>

* Switch to for/else: syntax, as suggested

* Don't use for: else:

* Sure, fine, w/e

* Oops

* 1nm to the left

---------

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: bgehman <bgehman@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-04-04 21:55:24 -07:00
Tim Burke bceb9e00ad
Improve some grammar in the socket docs (#103254) 2023-04-04 23:46:46 +01:00
Charles Machalow 935aa45235
GH-75586: Make shutil.which() on Windows more consistent with the OS (GH-103179) 2023-04-04 23:24:13 +01:00
Ethan Furman 5ffc1e5a21
gh-98298, gh-74730: [Enum] update docs (GH-103163)
fix FlagBoundary statements
add warning about reloading modules and enum identity
2023-04-03 14:57:42 -07:00
Nouran Ali 55decb72c4
gh-102994: Profile docs has typo in example (#103074) 2023-04-02 15:44:16 -07:00
Charlie Zhao 32937d6aa4
gh-103109: Document ignore_warnings() test support helper (#103110)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-04-03 00:18:25 +02:00
Giampaolo Rodola 6883007a86
bpo-4080: unittest durations (#12271) 2023-04-03 00:12:51 +02:00
Alex Waygood 6d59c9e32e
gh-102433: Use `inspect.getattr_static` in `typing._ProtocolMeta.__instancecheck__` (#103034) 2023-04-02 14:22:19 +01:00
James De Bias b0422e140d
gh-102871: Remove obsolete browsers from webbrowser (#102872) 2023-03-31 11:02:47 -04:00
Petr Viktorin f6405a4662
Quote literal tokens in standard format specifier grammar (GH-102902)
Reported by Damian Dureck: https://mail.python.org/archives/list/docs@python.org/thread/UZTWBJIXC3MBKTHXVTIBPGDPKBNWZ5LN/
2023-03-31 14:40:38 +02:00
gaogaotiantian c1e71ce56f
Minor docs improvements fix for `codeop` (#103123) 2023-03-30 15:51:36 -07:00
Hugo van Kemenade f192a558f5
gh-101100: Fix Sphinx warning in gc.rst and refactor docs clean list (#103116)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-03-30 21:03:50 +03:00
Shantanu fda95aa194
gh-103099: Link mypy docs from typing.rst (#103100) 2023-03-30 01:32:09 -07:00
gaogaotiantian 027223db96
Update pdb docs for arguments (#102965) 2023-03-25 14:31:45 -07:00
Peter Jiping Xie 0708437ad0
gh-103025: fix two ctypes doc issues (#103026) 2023-03-25 09:12:00 +00:00
JakobDev 64cb1a4f0f
gh-100131: Add optional delete parameter to tempfile.TemporaryDirectory() (#100132)
Add optional delete parameter to tempfile.TemporaryDirectory().

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-03-24 14:52:06 -07:00
Amin Alaee f2e5a6ee62
gh-102873: logging.LogRecord docs: improve description of `msg` parameter (#102875)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-24 15:00:32 +00:00
Hugo van Kemenade 6a1c49a717
gh-101100: Test docs in nit-picky mode (#102513)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2023-03-24 13:23:35 +02:00
MonadChains 413b7db8a4
gh-94684: uuid: support bytes in the name argument to uuid3/5 (#94709)
RFC 4122 does not specify that name should be a string, so for completness the functions should also support a name given as a raw byte sequence.
2023-03-23 17:42:43 -06:00
Brandt Bucher 0444ae2487
GH-100982: Break up COMPARE_AND_BRANCH (GH-102801) 2023-03-23 15:25:09 -07:00
Raymond Hettinger 16f6165b71
Minor readability improvement to the factor() recipe (GH-102971) 2023-03-23 14:46:15 -05:00
Nikita Sobolev b6132085ca
gh-98239: Document that `inspect.getsource()` can raise `TypeError` (#101689) 2023-03-23 19:35:02 +00:00
Alex Waygood 58d2b30c01
gh-102936: typing: document performance pitfalls of protocols decorated with `@runtime_checkable` (#102937) 2023-03-23 18:18:53 +00:00
Raymond Hettinger 4695709143
Move binomialvariate() to a section for discrete distributions (GH-102955) 2023-03-23 12:10:12 -05:00
JosephSBoyle f13fdacadf
gh-102810 Improve the sphinx docs for `asyncio.Timeout` (#102934)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-23 16:43:13 +00:00
Erlend E. Aasland 08254be6c5
Docs: fixup incorrect escape char in sqlite3 docs (#102945) 2023-03-23 14:21:32 +01:00