New issue 2501: [Pypy] Multiple Inheritance Bug: typeError: __init__() takes 
exactly 1 argument (2 given)
https://bitbucket.org/pypy/pypy/issues/2501/pypy-multiple-inheritance-bug-typeerror

KSHMK:

I found an error while installing and running to use pwntools.

Pwntools inherits threading.local and stack implemented classes to implement a 
stack for each thread.

However, when inheriting and executing __init__ "__init__() takes exactly 1 
argument (2 given)". This error did not occur in Cpython.

```
#!python

import threading
class B(object):
    def __init__(self, K):
        self._current = K
        self.__stack = []

    def push(self):
        print "push"

class A(threading.local, B):
    pass

K = A({"asdf":"asdf"})
K.push()
print K._current
```
I have simplified the source of the error.

If you change the order of inheritance


```
#!python

import threading
class B(object):
    def __init__(self, K):
        self._current = K
        self.__stack = []

    def push(self):
        print "push"

class A(B,threading.local):
    pass

K = A({"asdf":"asdf"})
K.push()
print K._current
```

No Error. Why?


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to