ManderaGeneral / generalimport

Handle all your optional dependencies with a single call!
https://pypi.org/project/generalimport/
Apache License 2.0
16 stars 1 forks source link

Unhandled - `raise X`, same as `isinstance(X, int)` #4

Closed Mandera closed 1 year ago

Mandera commented 2 years ago
from generalimport import generalimport
generalimport("foobar")

import foobar.error as er
raise er

TypeError: exceptions must derive from BaseException

Seems hard to fix, could make FakeModule inherit BaseException but then it wants a proper dunder str and I don't think that's worth it since dunder str probably has a decent portion of the triggers.

Mandera commented 2 years ago

This type of issue should be listed and generalized, there will be more cases we cannot cover

Mandera commented 2 years ago

Might be able to use __instancecheck__ if we make normal check fail: https://stackoverflow.com/questions/47740953/why-isnt-instancecheck-being-called