New submission from Xinmeng Xia <xi...@smail.nju.edu.cn>:

This piece of code is originally from 
https://github.com/python/cpython/tree/main/Lib/test/test_weakref.py. In 
function test_proxy_iter(), we change the original data dependency and then 
this generated test case (see the following "test.py") crashes Python. 

Crashing Python version: 3.6-master(3.11.0a0)

test.py
=========================
import weakref


def test_proxy_iter():
    obj = None

    class MyObj:

        def __iter__(a):
            nonlocal obj
            del obj
-           return NotImplemented
+           return p
    obj = MyObj()
-   p = weakref.proxy(obj)
+   p = weakref.proxy(TypeError)

-   'blech' in p
+   'blech' in obj

test_proxy_iter()
===========================


system: ubuntu 16.04
crash: segmentation fault

----------
components: Interpreter Core
files: test.py
messages: 398029
nosy: xxm
priority: normal
severity: normal
status: open
title: Finding string in iteratively deleted object cause segfault
type: crash
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9
Added file: https://bugs.python.org/file50171/test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44720>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to