Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Panicked if type(self)() in __del__ methods  #4863

Open
@xiaxinmeng

Description

@xiaxinmeng

This code creates an instance of the Dummy class and then immediately deletes it, which triggers the del method to create a new instance of the Dummy class.

class Dummy:
   def __del__(self):
      type(self)()

d = Dummy()
del d

Crash message:

Exception ignored in: <object function repr() failed>
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PyBaseException', vm/src/stdlib/sys.rs:593:59
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Environment:
Ubuntu 18.04
rustpython v0.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-vmArea: virtual machineC-bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions