go-python / go-python/gpython

Reassignment of 'getattr' leads to gpython crashing

Aberta
#202 2 comentários 0 reações 0 responsáveis Ver no GitHub
bug
Linguagem predominante
Go
Estrelas
1k
Forks
105
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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
...

```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.