vmware / vmware/pyvmomi

mypy issue: VimFault is not derived from BaseException

Open
#1,086 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

When we run some of our code through mypy, it reports the following issue:

error: Exception type must be derived from BaseException (or be a tuple of exception classes)  [misc]

Here's a simplified example:

from pyVmomi import vim

try:
    pass
except vim.fault.VimFault:
    pass
Reproduction steps
  1. Write code that tries to catch vim.fault.VimFault exceptions
  2. Run mypy against the code
Expected behavior

No mypy errors

Additional context

pyvmomi==8.0.3.0.1
mypy==1.11.1
Python 3.10.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the definition and generated hierarchy for pyVmomi's vim.fault.VimFault, then reproduce the minimal example with Python 3.10.6, pyvmomi 8.0.3.0.1, and mypy 1.11.1. Done means mypy accepts an except clause catching VimFault without reporting the BaseException error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.