[New-bugs-announce] [issue30570] issubclass segfaults on objects with weird __getattr__

Daniel Lepage report at bugs.python.org
Sun Jun 4 20:25:34 EDT 2017


New submission from Daniel Lepage:

The following code causes a segmentation fault:
class Failure(object):
    def __getattr__(self, attr):
        return (self, None)
issubclass(Failure(), int)

I am running a macbook pro, OS X 10.12.4, and have observed the problem in python 3.5.2, 3.6.0, and 3.6.1.

It appears that returning (self,) causes it to go into an infinite loop attempting to get `x.__bases__`, and returning `(self, y)` for any value `y` causes it to attempt to get `x.__bases__` 262,030 times and then segfault.

A crash log is attached.

----------
components: Interpreter Core
files: segfault.crash
messages: 295150
nosy: Daniel Lepage
priority: normal
severity: normal
status: open
title: issubclass segfaults on objects with weird __getattr__
type: crash
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file46924/segfault.crash

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30570>
_______________________________________


More information about the New-bugs-announce mailing list