diff options
author | Alex Waygood <Alex.Waygood@Gmail.com> | 2023-06-14 14:58:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-14 14:58:41 (GMT) |
commit | 7b1f0f204a785485de1daf9d26828a81953537e4 (patch) | |
tree | 6f11456f04444190aa5b2e3bf1cc5ff41f915575 /Misc | |
parent | d32e8d6070057eb7ad0eb2f9d9f1efab38b2cff4 (diff) | |
download | cpython-7b1f0f204a785485de1daf9d26828a81953537e4.zip cpython-7b1f0f204a785485de1daf9d26828a81953537e4.tar.gz cpython-7b1f0f204a785485de1daf9d26828a81953537e4.tar.bz2 |
gh-105570: Deprecate unusual ways of creating empty TypedDicts (#105780)
Deprecate two methods of creating typing.TypedDict classes with 0 fields using the functional syntax: `TD = TypedDict("TD")` and `TD = TypedDict("TD", None)`. Both will be disallowed in Python 3.15. To create a TypedDict class with 0 fields, either use `class TD(TypedDict): pass` or `TD = TypedDict("TD", {})`.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2023-06-14-14-32-31.gh-issue-105570.sFTtQU.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-06-14-14-32-31.gh-issue-105570.sFTtQU.rst b/Misc/NEWS.d/next/Library/2023-06-14-14-32-31.gh-issue-105570.sFTtQU.rst new file mode 100644 index 0000000..e31a8ee --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-06-14-14-32-31.gh-issue-105570.sFTtQU.rst @@ -0,0 +1,5 @@ +Deprecate two methods of creating :class:`typing.TypedDict` classes with 0 +fields using the functional syntax: ``TD = TypedDict("TD")`` and +``TD = TypedDict("TD", None)``. Both will be disallowed in Python 3.15. To create a +``TypedDict`` class with 0 fields, either use ``class TD(TypedDict): pass`` +or ``TD = TypedDict("TD", {})``. |