Open
Description
This code defines a class called C and creates an instance of this class named c. Inside the del method, a new instance of the C class is created and assigned to a variable c. Then, the code creates a variable d which contains a range object from 0 to 9. Finally, the variable c is assigned to the value of d, which means that the original instance of the C class created earlier is no longer referenced and will be garbage collected, while rustpython fails doing that and get panicked.
class C:
def __del__(self):
c = C()
c = C()
d = range(10)
c = d #crash here
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