[New-bugs-announce] [issue23114] "dist must be a Distribution instance" check fails with setuptools
Stefan Behnel
report at bugs.python.org
Fri Dec 26 11:30:55 CET 2014
New submission from Stefan Behnel:
distutils uses this code to validate the input in "Command.__init__()":
# late import because of mutual dependence between these classes
from distutils.dist import Distribution
if not isinstance(dist, Distribution):
raise TypeError, "dist must be a Distribution instance"
(Lib/distutils/cmd.py, after line 50)
This fails if the calling code uses the stdlib Distribution type (e.g. with a module global import) but setuptools was only imported afterwards and replaced "distutils.dist.Distribution" with its own implementation. In this case, the above code will get hold of the setuptools implementation and the isinstance() check will fail as both classes are not compatible.
I guess this is a problem more in setuptools than in distutils, but a) this isinstance() check has a general code smell and b) pip and setuptools are automatically installed in a specific (impacted) version in Py2.7.9 and Py3.4, which makes this problem quite pressing for the stdlib side.
----------
components: Distutils
messages: 233104
nosy: dstufft, eric.araujo, scoder
priority: normal
severity: normal
status: open
title: "dist must be a Distribution instance" check fails with setuptools
type: behavior
versions: Python 2.7, Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23114>
_______________________________________
More information about the New-bugs-announce
mailing list