Commit Graph

26538 Commits

Author SHA1 Message Date
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
Jurica Bradarić 87223f32ab
gh-103743: Add PyUnstable_Object_GC_NewWithExtraData (GH-103744)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-02 13:38:46 +02: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
Anže Pečar e665563f83
gh-100458: Clarify Enum.__format__() change of mixed-in types in the whatsnew/3.11.rst (GH-100387)
Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-05-01 12:49:54 -07: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
Hugo van Kemenade accb417c33
Replace Netlify with Read the Docs build previews (#103843)
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-04-29 23:02:03 -06:00
Itamar Ostricher 85c7bf5bce
gh-103793: Defer formatting task name (#103767)
The default task name is "Task-<counter>" (if no name is passed in during Task creation).
This is initialized in `Task.__init__` (C impl) using string formatting, which can be quite slow.
Actually using the task name in real world code is not very common, so this is wasted init.

Let's defer this string formatting to the first time the name is read (in `get_name` impl),
so we don't need to pay the string formatting cost if the task name is never read.

We don't change the order in which tasks are assigned numbers (if they are) --
the number is set on task creation, as a PyLong instead of a formatted string.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-29 08:20:09 -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
Irit Katriel 63842bd907
gh-103590: do not wrap a single exception raised from a try-except* (#103665) 2023-04-27 12:52:15 +01:00
Inada Naoki ce2383ec66
gh-103883: Doc: Move PyUnicode_FromObject doc (#103913)
This API is one of Unicode creator APIs.
2023-04-27 14:53:11 +09: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
Alex Waygood 81cf94c442
Docs build: Add upper bounds to transitive dependencies (#103860) 2023-04-26 11:07:31 -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
partev c9134fb228
DOC: remove reference to OpenSolaris (#102671) 2023-04-25 10:45:18 +00:00
Jaime Alonso Lorenzo d96cd44a59
gh-103765: Remove pkgutil.rst from .nitignore (GH-103797) 2023-04-24 17:42:43 -06: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