Issue2560

classification
Title: StackOverflowError with multiple inheritance, metaclasses, and __isinstancecheck__
Type: behaviour Severity: normal
Components: Versions: Jython 2.7
Milestone: Jython 2.7.1
process
Status: pending Resolution: invalid
Dependencies: Superseder:
Assigned To: stefan.richthofer Nosy List: jamesmudd, refi64, stefan.richthofer
Priority: normal Keywords:

Created on 2017-02-28.23:57:35 by refi64, last changed 2017-03-01.23:34:56 by stefan.richthofer.

Files
File name Uploaded Description Edit Remove
test.py jamesmudd, 2017-03-01.19:05:20 Example script
Messages
msg11148 (view) Author: Ryan (refi64) Date: 2017-02-28.23:57:35
class A(type): pass

class B(type):
    def __instancecheck__(): pass

class C(A, B): pass

print(isinstance(object(), C))


gives:


Traceback (most recent call last):
  File "tst.py", line 8, in <module>
    print(isinstance(object(), C))
RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)


Originally reported as https://github.com/python/typing/issues/395.
msg11154 (view) Author: James Mudd (jamesmudd) Date: 2017-03-01.19:05:20
I have just looked at this and couldn't reproduce it using jython master Ubuntu 16.04 with java1.8.0_111 using the example below. I have uploaded the test.py script I was running successfully and it prints False which seems to be correct.

Could you give more details on the setup you were testing OS, jython version java version. Looking at the linked github issue it appears this might be happening on Windows?

Also could you try increasing -Xss the default is 1m maybe try with 5m and see if it still occurs. e.g. run
java -Xss5m -jar /path/to/jython.jar test.py
msg11156 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2017-03-01.23:34:56
This one has already been fixed as part of http://bugs.jython.org/issue2515

Specifically it is described in http://bugs.jython.org/msg11007

The cause is deciphered in http://bugs.jython.org/msg11008

And finally it was fixed in https://hg.python.org/jython/rev/57d5d84099db

Ryan, can you assert that it works using our soft 2.7.1rc linked in https://sourceforge.net/p/jython/mailman/message/35692550 ?
History
Date User Action Args
2017-03-01 23:34:56stefan.richthofersetstatus: open -> pending
nosy: + stefan.richthofer
messages: + msg11156
priority: normal
assignee: stefan.richthofer
milestone: Jython 2.7.1
resolution: invalid
2017-03-01 19:05:21jamesmuddsetfiles: + test.py
nosy: + jamesmudd
messages: + msg11154
2017-02-28 23:57:35refi64create