Skip to content
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

Python 3.11 tracking issue #12840

Closed
15 of 17 tasks
hauntsaninja opened this issue May 22, 2022 · 15 comments
Closed
15 of 17 tasks

Python 3.11 tracking issue #12840

hauntsaninja opened this issue May 22, 2022 · 15 comments
Labels
feature meta Issues tracking a broad area of work

Comments

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented May 22, 2022

General, language:

New typing features:

@97littleleaf11 97littleleaf11 added the meta Issues tracking a broad area of work label May 22, 2022
@97littleleaf11 97littleleaf11 pinned this issue May 22, 2022
@AlexWaygood
Copy link
Member

AlexWaygood commented May 22, 2022

I started off writing a comment, but it got too long so I created a separate issue instead: there's a ton of new enum features in 3.11 that mypy doesn't yet support.

@hauntsaninja
Copy link
Collaborator Author

Okay, we're down to four failing tests with Python 3.11:

FAILED mypyc/test/test_run.py::TestRun::run-misc.test::testCheckVersion
FAILED mypyc/test/test_run.py::TestRun::run-classes.test::testProtocol
FAILED mypyc/test/test_run.py::TestRun::run-classes.test::testPickling
FAILED mypyc/test/test_run.py::TestRun::run-classes.test::testProperty

#13125 takes care of testCheckVersion
testProperty seems trivial, just a difference in traceback formatting
testPickling is probably python/cpython#70766 and not too bad
testProtocol looks a little scary — seems like one we'd want to fix

@hauntsaninja
Copy link
Collaborator Author

@97littleleaf11 any interest in taking a look at the testProtocol failure? :-)

@hauntsaninja
Copy link
Collaborator Author

hauntsaninja commented Jul 27, 2022

#13206 should fix testProtocol and testPickling
beta5 has some new test failures (that are my fault from python/cpython#94948 ), these ones are very easy to fix

@hauntsaninja
Copy link
Collaborator Author

Okay, CPython has rolled back changes, see python/cpython#92678 and python/cpython#95589. We should still confirm that with RC or B6 or whatever, we'll just have testProperty failing.

@NeilGirdhar
Copy link
Contributor

If you want to link the PEP 673 issue, it's here: #11871

@hauntsaninja
Copy link
Collaborator Author

Okay, with RC1 we have the following tests failing:

testPickling: probably related to https://github.com/python/cpython/issues/70766 (although not sure why #13206 "fixed" this)
testProperty: as mentioned above, just a difference in traceback formatting
testConfigFollowImportsSysPath: looks like something might have changed in mypy type logic and we now detect an overload situation in typeshed 3.11-only code

ilevkivskyi added a commit that referenced this issue Nov 7, 2022
Ref #12840 

It looks like from the point of view of type checking support is quite
easy. Mypyc support however requires some actual work, so I don't
include it in this PR.
svalentin pushed a commit that referenced this issue Nov 7, 2022
Ref #12840

It looks like from the point of view of type checking support is quite
easy. Mypyc support however requires some actual work, so I don't
include it in this PR.
ilevkivskyi added a commit that referenced this issue Nov 15, 2022
Ref #12840 
Fixes #11871
Fixes #14089

This is an alternative implementation to two existing PRs:
#11666,
#13133. This PR treats `typing.Self`
as pure syntactic sugar, and transforms it into a type variable early
during semantic analyzis.

This way we can re-use all the existing machinery and handled edge cases
for self-types. The only new thing is self-type for _attributes_ (as
proposed in the PEP). This required handling in several places, since
attribute access is duplicated in several places (see #7724), plus
special forms (like NamedTuples and TypedDicts) and dataclasses plugin
require additional care, since they use attribute annotations in special
ways.

I don't copy all the existing tests for "old style" self-types, but only
some common use cases, possible error conditions, and relevant new edge
cases, such as e.g. special forms mentioned above, and implicit type
variable binding for callable types.
@yoni-lavi
Copy link

Hypothetically speaking, if I wanted to add support for dataclass_transform, would that be a possibility?
does it need some kind of approval to even begin? Is it being worked on already?

@ethanhs
Copy link
Collaborator

ethanhs commented Nov 18, 2022

It is not being worked on as far as I am aware, and you don't need approval, feel free to get started on working on it if you are interested! We use a mypy plugin to analyze dataclasses so you'll probably want to start there https://github.com/python/mypy/blob/master/mypy/plugins/dataclasses.py

@Viicos
Copy link
Contributor

Viicos commented Nov 30, 2022

Since Python 3.11, Any is considered to be a base class. As stated here, mypy doesn't seem to support this feature yet when using NewType:

T = NewType("T", Any)
> error: Argument 2 to NewType(...) must be subclassable (got "Any")  [valid-newtype]

The issue was closed as wontfix but maybe this can now be supported?

@NeilGirdhar
Copy link
Contributor

Added #14293 for PEP 681 so that we can track it 😄

@randolf-scholz
Copy link
Contributor

randolf-scholz commented Feb 8, 2023

What about the changes to Concatenate introduced by python/cpython#30969? (#14656)

@wesleywright
Copy link
Collaborator

I believe we can consider dataclass_transform supported now

@jorenham
Copy link

jorenham commented Mar 6, 2023

For completeness' sake, here's the PEP 646 issue:
#12280

@ilevkivskyi
Copy link
Member

I don't think we need to keep this open. Almost everything is now implemented, and for couple remaining things we have dedicated issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature meta Issues tracking a broad area of work
Projects
None yet
Development

No branches or pull requests