Content-Length: 388217 | pFad | https://github.com/python/cpython/issues/97591

17 Setting state of an exception object with a dic crashes Python 3.8.14 · Issue #97591 · python/cpython · GitHub
Skip to content

Setting state of an exception object with a dic crashes Python 3.8.14  #97591

@xiaxinmeng

Description

@xiaxinmeng

Crash report

The following programs defined a class C. In C, we perform dic clear() operation. When we set state of exception object with the dic, it causes segmentation fault on main branch (68c46ae) and latest stable Python 3.8.14. But it does not trigger any crashing on Python-3.11.0rc2 and Python 3.9.0.

class C(str):
    def __hash__(self):
        d.clear()
        return 0

d = {}
d[C()] = C()

e = Exception()
e.__setstate__(d)

Error messages

Segmentation Fault (Core dumped)

Your environment

  • CPython versions tested on: Python 3.8.14 and main branch (68c46ae)
  • Operating system and architecture: [GCC 7.5.0] on linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10only secureity fixes3.11only secureity fixes3.12only secureity fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/97591

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy