[pypy-issue] Issue #2225: PyPy3k settrace/_trace messes up scoping (pypy/pypy)

Geoffrey Sneddon issues-reply at bitbucket.org
Wed Jan 13 17:36:00 EST 2016


New issue 2225: PyPy3k settrace/_trace messes up scoping
https://bitbucket.org/pypy/pypy/issues/2225/pypy3k-settrace-_trace-messes-up-scoping

Geoffrey Sneddon:

With the below:

```
#!python

import sys

class Tracer(object):
    def start(self):
        sys.settrace(self._trace)

    def _trace(self, frame, event, arg_unused):
        return self._trace

tracer = Tracer()
tracer.start()

def getExtraClass():
    def hidden():
        pass
    
    class ExtraClass():
        def hidden(self):
            return hidden()

    return ExtraClass

extraClass = getExtraClass()
obj = extraClass()
output = obj.hidden()

```

PyPy3k gives:


```
Traceback (most recent call last):
  File "html5lib/tests/tree_construction.py", line 25, in <module>
    output = obj.hidden()
  File "html5lib/tests/tree_construction.py", line 19, in hidden
    return hidden()
TypeError: hidden() takes exactly 1 argument (0 given)
```

CPython 2.7.11, CPython 3.5.1, and PyPy 4.0.1 all manage to run the above code without problem. Only PyPy3k (2.4.0) fails.




More information about the pypy-issue mailing list