Skip to content

Using the latest discord.py and mypy with namespace_packages enabled together causes a crush #12725

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

Closed
tasuren opened this issue May 4, 2022 · 1 comment
Labels

Comments

@tasuren
Copy link

tasuren commented May 4, 2022

Crash Report
When I run mypy with namespace_packages set to True in a project that uses a library called discord.py (latest on github), it crashes.

Traceback

/Users/tasuren/.pyenv/versions/3.10.3/lib/python3.10/site-packages/./discord/ext/commands/help.py:631: 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.950
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 3981, in accept
  File "mypy/nodes.py", line 1753, in accept
  File "mypy/checkexpr.py", line 288, in visit_call_expr
  File "mypy/checkexpr.py", line 371, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 880, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 944, in check_call
  File "mypy/checkexpr.py", line 1621, in check_overload_call
  File "mypy/checkexpr.py", line 1763, in infer_overload_return_type
  File "mypy/checkexpr.py", line 940, in check_call
  File "mypy/checkexpr.py", line 1027, in check_callable_call
  File "mypy/checkexpr.py", line 1269, in infer_function_type_arguments
  File "mypy/checkexpr.py", line 1324, in infer_function_type_arguments_pass2
  File "mypy/infer.py", line 47, in infer_function_type_arguments
  File "mypy/constraints.py", line 72, in infer_constraints_for_callable
  File "mypy/constraints.py", line 108, in infer_constraints
  File "mypy/constraints.py", line 181, in _infer_constraints
  File "mypy/types.py", line 1576, in accept
  File "mypy/constraints.py", line 610, in visit_callable_type
  File "mypy/constraints.py", line 108, in infer_constraints
  File "mypy/constraints.py", line 181, in _infer_constraints
  File "mypy/types.py", line 1127, in accept
  File "mypy/constraints.py", line 551, in visit_instance
  File "mypy/constraints.py", line 731, in infer_against_any
  File "mypy/constraints.py", line 108, in infer_constraints
  File "mypy/constraints.py", line 181, in _infer_constraints
  File "mypy/types.py", line 1365, in accept
  File "mypy/constraints.py", line 410, in visit_parameters
RuntimeError: Parameters cannot be constrained to
/Users/tasuren/.pyenv/versions/3.10.3/lib/python3.10/site-packages/./discord/ext/commands/help.py:631: : note: use --pdb to drop into pdb

The location where the INTERNAL ERROR occurred is here.

To Reproduce
Run pip3 install -U git+https://github.com/Rapptz/discord.py to install latest discord.py from github.
Write the following in test.py.

import discord

Run mypy test.py --namespace-packages --show-traceback.

Your Environment

  • Mypy version used: 0.950
  • Mypy command-line flags: --namespace-packages
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.10.3
  • Operating system and version: macOS Monterey 12.3.1
@tasuren tasuren added the crash label May 4, 2022
@hauntsaninja
Copy link
Collaborator

Thanks for the report, I believe this is fixed by #12548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants