[New-bugs-announce] [issue43187] Dict creation in recursive function cause interpreter crashes.

Yang Feng report at bugs.python.org
Wed Feb 10 04:19:35 EST 2021


New submission from Yang Feng <charles.fy at foxmail.com>:

In the following programs, dict is created in recursive calls. Then a core dump is reported by Python interpreter.
+++++++++++++++++++++++++++++++++++++++++++
def test_equal_operator_modifying_operand():

    class X():

        def __del__(DictTest):
            dict_b.clear()

        def __eq__(DictTest, other):
            dict_a.clear()
            return True

        def __hash__(DictTest):
            return 13
    dict_d = {X(): 0}

    class Y():

        def __eq__(DictTest, other):
            dict_d.clear()
            return True
    dict_d = {0: Y()}
    # dict_c = {0: set()}
    test_equal_operator_modifying_operand()

test_equal_operator_modifying_operand()
+++++++++++++++++++++++++++++++++++++++++

----------
components: Interpreter Core
messages: 386765
nosy: CharlesFengY
priority: normal
severity: normal
status: open
title: Dict creation in recursive function cause interpreter crashes.
type: crash
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43187>
_______________________________________


More information about the New-bugs-announce mailing list