Skip to content

Reimplement Literal on Python <=3.10.0#148

Merged
JelleZijlstra merged 2 commits into
python:mainfrom
AlexWaygood:more-literal-fixes
Apr 20, 2023
Merged

Reimplement Literal on Python <=3.10.0#148
JelleZijlstra merged 2 commits into
python:mainfrom
AlexWaygood:more-literal-fixes

Conversation

@AlexWaygood
Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood commented Apr 20, 2023

Fixes #147.

No code changes are required -- the typing_extensions reimplementation of Literal has never suffered from the same bug that was fixed in python/cpython#29334, because we don't cache Literal subscripts in the same way that CPython does. (I think if we wanted to do so, it might require us to reimplement @typing._tp_cache as it exists on CPython main, since the signature of _tp_cache changed between bugfix versions at some point.) As such, all we need to do is reimplement Literal on <=3.10.0 instead of <=3.9.0.

Cc. @dfremont :)

Comment thread README.md Outdated
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
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.

Backport fixes to Literal from 3.11?

2 participants