vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.21k stars 764 forks source link

[stubs] SecurityError not recognized as Exception #1030

Closed streambinder closed 1 year ago

streambinder commented 1 year ago

Describe the bug

Cannot raise NoPermission instance as:

Expression e has type vim.fault.NoPermission but must extend BaseException.

Reference code:

def f() -> None:
    ...
    try:
        return partial(vim.ServiceInstance, ...)()
    except vim.fault.NoPermission as e:
        ...
        raise e

Reproduction steps

  1. write a function which: raise vim.fault.NoPermission()
  2. run mypy/pyre against it

Expected behavior

I'd expect raise vim.fault.NoPermission() to not be linted as an error.

Additional context

No response

DanielDraganov commented 1 year ago

Fixed in https://github.com/vmware/pyvmomi/commit/4e387cc3d2754eaa48716d59aa2f34a0027deec3