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

mypy 0.930 breaks the sqlmypy plugin with an INTERNAL ERROR #232

Closed
plankthom opened this issue Dec 23, 2021 · 10 comments · Fixed by #234
Closed

mypy 0.930 breaks the sqlmypy plugin with an INTERNAL ERROR #232

plankthom opened this issue Dec 23, 2021 · 10 comments · Fixed by #234

Comments

@plankthom
Copy link

Upgrading to mypy 0.930 triggered the following INTERNAL ERROR issue:

% mypy --config-file pkg/tsa-repo-db-client/setup.cfg -p tsa.repo.db --show-traceback
***/pkg/tsa-repo-db-client/tsa/repo/db/model.py:11: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.930
Traceback (most recent call last):
  File "mypy/semanal.py", line 5132, in accept
  File "mypy/nodes.py", line 1140, in accept
  File "mypy/semanal.py", line 2110, in visit_assignment_stmt
  File "mypy/semanal.py", line 2392, in apply_dynamic_class_hook
  File "***/miniconda3/envs/tsa37/lib/python3.7/site-packages/sqlmypy.py", line 203, in decl_info_hook
    obj = ctx.api.builtin_type('builtins.object')
AttributeError: 'SemanticAnalyzer' object has no attribute 'builtin_type'
***/pkg/tsa-repo-db-client/tsa/repo/db/model.py:11: : note: use --pdb to drop into pdb

Considering the announcement in python/mypy#6617 , I assume this should be solved here ...

Workaround: keep mypy pinned on version 0.921

@plankthom
Copy link
Author

plankthom commented Dec 23, 2021

@97littleleaf11
Copy link

Sorry that I forgot to update the announcement. Currently please use named_type instead.

@ilevkivskyi
Copy link
Contributor

Could someone please submit a PR for this? (using a hasattr() for compatibility) Sorry, but I don't have much time to work on this myself.

@JukkaL
Copy link
Contributor

JukkaL commented Jan 6, 2022

I should be able to take care of this, but I don't access to the PyPI project.

@ilevkivskyi Could you make me a maintainer at https://pypi.org/project/sqlalchemy-stubs/?

@JukkaL
Copy link
Contributor

JukkaL commented Jan 6, 2022

Alternatively, I wonder if we could (or should) add back builtin_type as an alias to named_type, but mark it as deprecated.

JukkaL added a commit to python/mypy that referenced this issue Jan 7, 2022
It shouldn't be used for new code, but adding it back makes it
unnecessary to update existing plugins that no longer worked with mypy
0.930.

Related issue: dropbox/sqlalchemy-stubs#232
JukkaL added a commit to python/mypy that referenced this issue Jan 7, 2022
It shouldn't be used for new code, but adding it back makes it
unnecessary to update existing plugins that no longer worked with mypy
0.930.

Related issue: dropbox/sqlalchemy-stubs#232
JukkaL added a commit to python/mypy that referenced this issue Jan 7, 2022
It shouldn't be used for new code, but adding it back makes it
unnecessary to update existing plugins that no longer worked with mypy
0.930.

Related issue: dropbox/sqlalchemy-stubs#232
@ilevkivskyi
Copy link
Contributor

IIUC this should now work with mypy 0.931, so I am closing this issue.

@ilevkivskyi
Copy link
Contributor

Actually, we can still switch to the newer "official" API method, so re-opening again. PRs are welcome :-)

@ilevkivskyi ilevkivskyi reopened this Jan 13, 2022
@shawnwall
Copy link
Contributor

@ilevkivskyi would you like to hasattr() on builtin_type in case it goes away again? using hasattr() on named_type doesn't work as named_type DID exist in mypy < .930 but apparently the functionality diffed a bit at that time.

@JukkaL
Copy link
Contributor

JukkaL commented Jan 13, 2022

I have no plans to remove builtin_type. Keeping it around is not a significant burden.

tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this issue Jan 20, 2022
It shouldn't be used for new code, but adding it back makes it
unnecessary to update existing plugins that no longer worked with mypy
0.930.

Related issue: dropbox/sqlalchemy-stubs#232
@ilevkivskyi
Copy link
Contributor

@shawnwall Essentially, yes. We can have this just in case (but since Jukka says it will be there, it is not a priority).

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 a pull request may close this issue.

5 participants