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

mypyc generates AttributeError: exception on basic use of InitVar #934

Open
bertbarabas opened this issue May 29, 2022 · 0 comments · May be fixed by python/mypy#18319
Open

mypyc generates AttributeError: exception on basic use of InitVar #934

bertbarabas opened this issue May 29, 2022 · 0 comments · May be fixed by python/mypy#18319
Labels
bug crash Failing compile-time asserts, unhandled exceptions, or generated C code that's blowing up.

Comments

@bertbarabas
Copy link

bertbarabas commented May 29, 2022

mypy version: 0.960
python version: 3.10.4
Running on Windows 11

just import the following code into a CPython REPL:

from dataclasses import InitVar, dataclass


@dataclass
class TestInitVar:
    some_initvar: InitVar = None

    def __post_init__(
        self,
        some_initvar,
    ):
        pass

causes:

(.venv) PS C:\Projects\CaptureFile-MyPyC> python
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Test_01
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Test_01.py", line 5, in <module>
    class TestInitVar:
AttributeError: some_initvar
>>>
@ichard26 ichard26 added bug crash Failing compile-time asserts, unhandled exceptions, or generated C code that's blowing up. labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug crash Failing compile-time asserts, unhandled exceptions, or generated C code that's blowing up.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants