Closed koreno closed 2 years ago
EnvironmentError isn't a real error anymore in Python 3, it's just an OSError. OSErrors return subclasses based on what the OS return code in the first argument is. I think we need to refactor this a bit. Specifically, the first value is the return code, and for us it's the second, and OSError's new is where the subclass selection is happening - this sounds very incorrect to me! For now, this is fine to fix the immediate problem.
Maybe it is implemented in __init__
, since this seems to be stable (after the patch), or maybe it checks the cls before doing the subclass (though EnvironementError(3, "msg")
returns ProcessLookupError(3, 'msg')
, etc). The exceptions are mostly implemented in C, so hard to quickly check.
Thanks!!!
Something in recent refactors broke this capability, which we are using in our infrastructure, so I've fixed and cemented it with a UT.