Author dw
Recipients dw
Date 2018-12-13.23:14:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544742855.44.0.788709270274.issue35486@psf.upfronthosting.co.za>
In-reply-to
Content
The subprocess package since 880d42a3b24 / September 2018 has begun using this idiom:

try:
    import _foo
except ModuleNotFoundError:
    bar

However, ModuleNotFoundError may not be thrown by older import hook implementations, since that subclass was only introduced in Python 3.6 -- and so the test above will fail. PEP-302 continues to document ImportError as the appropriate exception that should be raised.

https://mitogen.readthedocs.io/en/stable/ is one such import hook that lazily loads packages over the network when they aren't available locally. Current Python subprocess master breaks with Mitogen because when it discovers the master cannot satisfy the import, it throws ImportError.

The new exception subtype was introduced in https://bugs.python.org/issue15767 , however very little in the way of rationale was included, and so it's unclear to me what need the new subtype is addressing, whether this is a problem with the subprocess module or the subtype as a whole, or indeed whether any of this should be considered a bug.

It seems clear that some kind of regression is in the process of occurring during a minor release, and it also seems clear the new subtype will potentially spawn a whole variety of similar new regressions.

I will be updating Mitogen to throw the new subtype if it is available, but I felt it was important to report the regression to see what others think.
History
Date User Action Args
2018-12-13 23:14:15dwsetrecipients: + dw
2018-12-13 23:14:15dwsetmessageid: <1544742855.44.0.788709270274.issue35486@psf.upfronthosting.co.za>
2018-12-13 23:14:15dwlinkissue35486 messages
2018-12-13 23:14:14dwcreate