File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,13 @@ class MyObject: pass
1919
2020with assert_raises (NameError ):
2121 del y # noqa: F821
22+
23+ # see https://github.com/RustPython/RustPython/issues/4863
24+
25+ class MyTest :
26+ def __del__ (self ):
27+ type (self )()
28+
29+ def test_del_panic ():
30+ mytest = MyTest ()
31+ del mytest
Original file line number Diff line number Diff line change @@ -590,7 +590,14 @@ mod sys {
590590 fn unraisablehook ( unraisable : UnraisableHookArgs , vm : & VirtualMachine ) {
591591 if let Err ( e) = _unraisablehook ( unraisable, vm) {
592592 let stderr = super :: PyStderr ( vm) ;
593- writeln ! ( stderr, "{}" , e. as_object( ) . repr( vm) . unwrap( ) . as_str( ) ) ;
593+ writeln ! (
594+ stderr,
595+ "{}" ,
596+ e. as_object( )
597+ . repr( vm)
598+ . unwrap_or_else( |_| vm. ctx. empty_str. to_owned( ) )
599+ . as_str( )
600+ ) ;
594601 }
595602 }
596603
You can’t perform that action at this time.
0 commit comments