Skip to content

[3.13] gh-149995: Update typing.py docstrings and documentation#150217

Merged
JelleZijlstra merged 1 commit into
python:3.13from
JelleZijlstra:backport-f159419-3.13
May 22, 2026
Merged

[3.13] gh-149995: Update typing.py docstrings and documentation#150217
JelleZijlstra merged 1 commit into
python:3.13from
JelleZijlstra:backport-f159419-3.13

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra commented May 22, 2026

Backport of GH-149996 to 3.13.

…pythonGH-149996)

Some of these docstrings read as if they were written when typing.py was
first written, and things have evolved since then.

A few motivations:
- Call protocols protocols instead of ABCs. They are also ABCs, but the fact
  they are protocols is more relevant to typing.
- Avoid recommending direct use of .__annotations__ and steer users to
  annotationlib instead.
- For TypedDict, mention NotRequired before total=False since it is more
  general and probably more frequently useful.
- For overloads, mention runtime use first instead of stub use. I think early on
  there was talk of allowing overload only in stubs, but it is now heavily used at
  runtime too and that's more likely to be relevant to users.
(cherry picked from commit f159419)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@JelleZijlstra JelleZijlstra marked this pull request as ready for review May 22, 2026 04:46
@JelleZijlstra JelleZijlstra enabled auto-merge (squash) May 22, 2026 04:46
@JelleZijlstra JelleZijlstra marked this pull request as draft May 22, 2026 04:47
auto-merge was automatically disabled May 22, 2026 04:47

Pull request was converted to draft

@JelleZijlstra JelleZijlstra marked this pull request as ready for review May 22, 2026 04:57
@JelleZijlstra JelleZijlstra enabled auto-merge (squash) May 22, 2026 04:58
@JelleZijlstra JelleZijlstra merged commit 1df755c into python:3.13 May 22, 2026
45 checks passed
@bedevere-bot
Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Debian root 3.13 (tier-1) has failed when building commit 1df755c.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1441/builds/1969) and take a look at the build logs.
  4. Check if the failure is related to this commit (1df755c) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1441/builds/1969

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/root/buildarea/3.13.angelico-debian-amd64/build/Lib/test/support/__init__.py", line 856, in gc_collect
    gc.collect()
ResourceWarning: unclosed file <_io.FileIO name=11 mode='wb' closefd=True>


Traceback (most recent call last):
  File "/root/buildarea/3.13.angelico-debian-amd64/build/Lib/test/support/__init__.py", line 856, in gc_collect
    gc.collect()
ResourceWarning: unclosed file <_io.FileIO name=13 mode='wb' closefd=True>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants