-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update typing to 3.12 #5252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've been chewing on this for a bit, but it's pretty slow going since I'm also learning about a lot of compilation internals. As soon as I have something that is mostly compatible with the 3.12 |
That's awesome. Please feel free to ask anything if you stuck on something. About typing module, if it helps, mixing Rust and Python implementation is limited but still possible. #5254 is doing it for ExceptionGroup. |
I don't know if this is already known, but I just wanted to add to the 3.12 typing discussion that if not running in release mode, syntax like |
That problem should be resolved as of #5319 / RustPython/Parser#120. Thanks for reporting! |
Hi, what is the progress on this? Is there a way I can help? Trying to get started with RustPython myself :) |
@hbina Hi, open Please share any blocker you meet. Thanks! |
#5590 should fix this. |
Feature
The
typing
module needs to be updated to 3.12. It seems that it was last updated to 3.9, so it's missing several major versions worth of features, like Unpack, generics, and type aliases using thetype
keyword.Not having these typing features impedes the process of updating modules that use, which presumably will be most new stuff going forward.
I estimate that updating will require:
typing.py
into a new native moduletyping.rs
, specificallyTypeVar
,ParamSpec
,TypeVarTuple
,ParamSpecArgs
,ParamSpecKwards
,TypeAliasType
, andGeneric
.Adding new syntax likeIt seems like this is already included in https://github.com/RustPython/Parser/blob/main/parser/src/python.lalrpoptype
type aliases and generics to the parser.compiler.rs
andframe.rs
. For example,def foo[T](x: T): ...
must create a newTypeVar(T)
and inject it into the correct scope so that it is available as an argument annotation. This requires a new instruction defined inbytecode.rs
which is emitted bycompiler.rs
and consumed byframe.rs
.typing.py
andtest_typing.py
from the CPython code base.Python Documentation or reference to CPython source code
https://docs.python.org/3/library/typing.html
The text was updated successfully, but these errors were encountered: