Title: distutils.errors not wildcard-import-safe
Type: Stage: resolved
Components: Distutils Versions:
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: dstufft, eric.araujo, jaraco, jwilk
Priority: normal Keywords:

Created on 2015-08-16 11:34 by jwilk, last changed 2020-10-22 20:34 by eric.araujo. This issue is now closed.

Messages (2)
msg248680 - (view) Author: Jakub Wilk (jwilk) Date: 2015-08-16 11:34
Docstring of the distutils.errors module reads:

This module is safe to use in "from ... import *" mode; it only exports
symbols whose names start with "Distutils" and end with "Error".

But in reality, the module exports also names that don't start with "Distutils":

>>> ns = {}
>>> exec('from distutils.errors import *', {}, ns)
>>> [k for k in ns.keys() if not k.startswith('Distutils')]
['LibError', 'UnknownFileError', 'LinkError', 'CompileError', 'CCompilerError', 'PreprocessError']
msg379340 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2020-10-22 20:34
The docstring is wrong, but I don’t think there is much value in changing it now.  Style guides generally recommend against star imports, and not many people need to import from distutils.errors (setuptools and maybe numpy?).
Date User Action Args
2020-10-22 20:34:43eric.araujosetstatus: open -> closed

nosy: + jaraco
messages: + msg379340

resolution: wont fix
stage: resolved
2015-08-16 11:34:52jwilkcreate