[pypy-issue] Issue #3091: segmentation faults when dict, set, list, or most builtin errors's __init__ is called with another object (pypy/pypy)

Peter McLinn issues-reply at bitbucket.org
Sat Oct 12 13:57:27 EDT 2019


New issue 3091: segmentation faults when dict, set, list, or most builtin errors's __init__ is called with another object
https://bitbucket.org/pypy/pypy/issues/3091/segmentation-faults-when-dict-set-list-or

Peter McLinn:

I wrote a bash script that launches pypy3 multiple times to demonstate the issue.  
a minimal case could be:  

```python
set.__init__(0)
```

I ran my script with:

‌

```shell
bash pypy3initsegfault.sh 2>pypy3initsegfaultresults.txt
```

The script and results files are attached to this issue.

I put this as a minor priority because I don’t see this coming up very often.  
Otherwise, it’s a serious issue because it’s a segmentation fault.

I was originally testing if Python let me call builtin functions with the ‘wrong’ type arguments.  
I thought that, to allow duck-typing of all functions, Python would behave normally when functions were called with strange-typed arguments. For example, raising an AttributeError when the function tries to access a nonexistant attribute. Instead, I sometimes got a segfault, TypeError, or it completed normally.  
I know that some of these are part of the base set of functions written as part of the implementation. I felt a little let down when I found that they raised a TypeError instead of an AttributeError, but it makes sense.




More information about the pypy-issue mailing list