[issue34346] dir() hangs interpreter
Steven D'Aprano
report at bugs.python.org
Mon Aug 6 11:13:23 EDT 2018
Steven D'Aprano <steve+python at pearwood.info> added the comment:
I don't think the description you give is very accurate. The description in the file splat.py says:
"Hangs/core dumps Python2 when instantiated"
(which is it? hang or core dump?)
but I can't replicate that. Instantiating A() is fine for me. (Tested in Python 2.7 on Linux.)
The whole business about "splat" is amusing but irrelevant. I can replicate the hang (no core dump) using this simpler example:
class B:
def __getattr__(self, name):
return name in dir(self)
Instantiating the class is fine, but calling dir() on it locks up:
>>> b = B()
>>> dir(b)
[1]+ Stopped python2.7 -E
(after typing Ctrl-Z in the xterm). Notice that B is an old-style class in this example. The same behaviour also occurs when inheriting from object.
----------
nosy: +steven.daprano
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34346>
_______________________________________
More information about the Python-bugs-list
mailing list