-
Notifications
You must be signed in to change notification settings - Fork 281
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
Support Python 3.11 #1308
Comments
For reference for Python 3.11, 0f71fc3 enabled Python 3.10 support only about half a year after release of the new Python. |
pytype doesn't support Python 3.11 yet. Some very old versions of pytype don't set |
* Adds new opcodes and magic numbers. * Removes generate_opcode_diffs' dependency on pytype.platform_utils. This is supposed to be a standalone script. * Handles a change to the MAKE_FUNCTION opcode: pre-3.11, it expects two values on the data stack, the function name and code. In 3.11, the name is removed. * Adjusts _Loadmarshal.load_code. I couldn't find documentation anywhere on how/why load_code changed, so I compared the 3.10 and 3.11 code objects. This method is still not quite right, but it seems to be mostly working. * Takes into account new JUMP_BACKWARD* opcodes in opcodes._dis. This reduces the number of 3.11 failures (found by grepping for "FAIL:" and "ERROR:" in the opensource test logs) from 3,676 to 3,066. For #1308. PiperOrigin-RevId: 501867542
For #1308. PiperOrigin-RevId: 503034216
Is pytype usuable in Python 3.11 yet? |
no, but we are actively working on it now, it should be usable in the next couple of months |
Turns out that acf4668 actually got pretty close to getting relative jumps in 3.11 working. I missed that the flags for a couple existing jump opcodes changed from JABS to JREL. The easiest way to handle this is to treat all jumps as relative in 3.11. I improved generate_opcode_diffs to warn us when an opcode's flags change. Also does a bit of flags-related cleanup: * Makes Opcode.FLAGS private. I noticed that we have what are obviously intended to be public accessor methods but also occasionally accessed FLAGS directly. * Deletes the unused Opcode.has_arg classmethod, which confusingly has a name very similar to the unrelated has_argument classmethod. I tested this manually by calling dis.dis(...) on some jump-containing code and checking that the jump targets match what pytype produces. For #1308. PiperOrigin-RevId: 549826871
Needed so that the repo Python version and the web Python version are in sync. To be reverted as soon as google/pytype#1308 is addressed and we can bump our repo Python version to `3.11`
Needed so that the repo Python version and the web Python version are in sync. To be reverted as soon as google/pytype#1308 is addressed and we can bump our repo Python version to `3.11`
Found by running typeshed's pytype_test in 3.11. * typeshed uses "None" as a default value in places. I guess it counts as a "literal constant". * NotRequired has one parameter. For #1308. PiperOrigin-RevId: 550049302
Docs: https://github.com/google/pytype Not enabling pytype in pre-commit as it does not yet support python 3.11: google/pytype#1308
The next pytype version will support 3.11. I'll update here once that's released. |
Ok, pytype-2023.10.17 has basic 3.11 support. Basic means that we don't yet fully support new 3.11 typing features. We have partial support for typing.dataclass_transform, and typing.Self is being actively worked on (#1283). You can see the status of pytype support for various typing features here: https://google.github.io/pytype/support.html#typing. If there's a feature you'd like to use that doesn't yet have a tracking issue listed on that page, feel free to open one - it helps us with prioritization. |
Just an FYI... Python 3.11 released 2022-10-24 |
Thanks to the resolution of google/pytype#1308
* Started noticing some new pytype errors on same code that used to work before even when using pinned version of pytype and python versions * PyType currently does not work with 3.11 (version that fuchsia is planning to move from 3.8). More info @ google/pytype#1308 Since we already use 'mypy' for static type checking and 'pytype' is just another tool doing the same and it is still unclear whether fuchsia will adopt pytpe or mypy, for the time-being decided to not use pytype until either above issues are resolved or if fuchsia adopts pytype Change-Id: Idb9fd4be06bb73ff677b5dedd2e50356b0c03862 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/880171 Fuchsia-Auto-Submit: Pavan Kumar Juturu <jpavankumar@google.com> Commit-Queue: Pavan Kumar Juturu <jpavankumar@google.com> Reviewed-by: Kevin Cho <chok@google.com>
Tried to build with Python 3.11 and this is the output:
The text was updated successfully, but these errors were encountered: