Skip to content

Reassignment of 'getattr' leads to gpython crashing #202

Open
@xiaxinmeng

Description

@xiaxinmeng

Reassigning getattr with getattr in a class and then using the attribute 'spam' triggers gpython crashing. See the following example. We test the example on the online gpython i.e., GO/wasm and Gopherjs. GO/wasm can well handle the test while it crashes on the Gopherjs.

test.py


class c(object):
    __getattr__ = getattr
c().spam

Output on Gopherjs (https://gpython.org/)

Gpython 3.4.0 running in your browser with gopherjs
>>> class c(object):
...     __getattr__ = getattr
... 
>>> c().spam
[USER]: https://gpython.org/gpython.js: too much recursion
$assertType@https://gpython.org/gpython.js:4:20889
GL.ptr.prototype.Call@https://gpython.org/gpython.js:41:291927
GL.ptr.prototype.M__call__@https://gpython.org/gpython.js:41:301617
FK@https://gpython.org/gpython.js:41:255589
MH.ptr.prototype.CallMethod@https://gpython.org/gpython.js:41:369579
MP@https://gpython.org/gpython.js:41:370268
MR@https://gpython.org/gpython.js:41:371135
FO@https://gpython.org/gpython.js:41:262478
FP@https://gpython.org/gpython.js:41:264051
P@https://gpython.org/gpython.js:54:33516
GL.ptr.prototype.Call@https://gpython.org/gpython.js:41:292125
GL.ptr.prototype.M__call__@https://gpython.org/gpython.js:41:301617
FK@https://gpython.org/gpython.js:41:255589
MH.ptr.prototype.CallMethod@https://gpython.org/gpython.js:41:369579
MP@https://gpython.org/gpython.js:41:370268
MR@https://gpython.org/gpython.js:41:371135
FO@https://gpython.org/gpython.js:41:262478
FP@https://gpython.org/gpython.js:41:264051
P@https://gpython.org/gpython.js:54:33516
GL.ptr.prototype.Call@https://gpython.org/gpython.js:41:292125
GL.ptr.prototype.M__call__@https://gpython.org/gpython.js:41:301617
FK@https://gpython.org/gpython.js:41:255589
MH.ptr.prototype.CallMethod@https://gpython.org/gpython.js:41:369579
MP@https://gpython.org/gpython.js:41:370268
MR@https://gpython.org/gpython.js:41:371135
FO@https://gpython.org/gpython.js:41:262478
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions