Skip to content

Crash with BeautifulSoup #14548

@cap-jmk

Description

@cap-jmk

The bug produces as internal error when accessing the dict returned from BeautifulSoup.find_all() method:
on: 0.991


I would rather expect an mypy error instead on an internal error. 
**To Reproduce**

```python
repos = []
    for url in links:
        soup = BeautifulSoup(urlopen(url), "html.parser")
        for link in soup.find_all("a", href=True):
            repos.append(repos.append(link["href"])

Expected Behavior

I would expect some sort of mypy error.

Actual Behavior

error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues

Yet, when using the following

mypy --strict package_name/ --show-traceback

The result is

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.991
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 4657, in accept
  File "mypy/checkexpr.py", line 410, in visit_call_expr
  File "mypy/checkexpr.py", line 473, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 885, in try_infer_partial_type
KeyError: <mypy.nodes.Var object at 0x7f3843b28670>

Thus, I am reporting the bug.

Your Environment

  • Mypy version used: 0.991
  • Mypy command-line flags: --strict, --show-traceback
  • Mypy configuration options from mypy.ini (and other config files): no special config
  • Python version used: 3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions