You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is problematic because NoReturn does not mean what the author thought it means. The NoReturn type hint means that function cannot return without raising an exception. But RebootGuest() and other functions like it in pyvmomi simply return nothing, which should be represented by a return type hint of -> None instead of -> NoReturn.
This causes erroneous warnings in IDEs about code underneath calls to functions like RebootGuest() being unreachable because the IDE expects that RebootGuest will always throw an exception (since the type hint is NoReturn) or otherwise cannot return.
Can the usage of NoReturn in the auto generated type stubs please be reviewed and updated with the proper hint.
Reproduction steps
Write code to reboot VM using VirtualMachine.RebootGuest() and print "VM reboot initiated" after calling RebootGuest().
Observe errors in IDE indicating that the print statement cannot be reached.
...
Expected behavior
Misleading warnings in IDEs are not present.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Noting that the usage of the NoReturn type hint may not only be an issue in the VirtualMachine class, I imagine it's also present in a bunch of other classes, and is likely the result of a logic fault in the automatic code generator that outputs those type stubs based on the SOAP schemas.
Describe the bug
In certain type stubs, the recent changes in 8.0.3.0.0 have resulted in the return type hint of
NoReturn
being used on certain operations such as VM RebootGuest(). This can be seen here: https://github.com/vmware/pyvmomi/blob/master/pyVmomi/vim/VirtualMachine.pyi#L216This is problematic because NoReturn does not mean what the author thought it means. The NoReturn type hint means that function cannot return without raising an exception. But RebootGuest() and other functions like it in pyvmomi simply return nothing, which should be represented by a return type hint of
-> None
instead of-> NoReturn
.This causes erroneous warnings in IDEs about code underneath calls to functions like RebootGuest() being unreachable because the IDE expects that RebootGuest will always throw an exception (since the type hint is NoReturn) or otherwise cannot return.
Can the usage of NoReturn in the auto generated type stubs please be reviewed and updated with the proper hint.
Reproduction steps
...
Expected behavior
Misleading warnings in IDEs are not present.
Additional context
No response
The text was updated successfully, but these errors were encountered: