Here is some buggy code:
classBaseClassExample(OpenTap.TestStep):
Str1=property(String, "127.0.0.1")\
.add_attribute(OpenTap.Display("Str on base class.", "The IP Address of the instrument."))
def__init__(self):
print(Str1)
super().__init__()
defRun(self):
"""Called by TAP when the test plan ends."""super().Run()When init() is called, Print(Str1) throws an exception because i forgot to call self.Str1.
This causes an exception in the finalizer in the GC thread, which causes the program to crash.
ArgumentNullException: Value cannot be null.Parameter name: derived
at Python.Runtime.Finalizer.AddDerivedFinalizedObject(IntPtr& derived, Int32 run)
at Python.Runtime.PythonDerivedType.PyFinalize(IPythonDerivedType obj)
at PythonExamples.InheritExample.BaseClassExample.Finalize()
Exception caught at:
at Void AddDerivedFinalizedObject(IntPtr ByRef, Int32)
at Void PyFinalize(Python.Runtime.IPythonDerivedType)
at Void Finalize()
Probably we need to catch the exception and prevent a degenerate object from being created in the first place. This needs to be fixed in Pythonnet.
Here is some buggy code:
When init() is called, Print(Str1) throws an exception because i forgot to call self.Str1.
This causes an exception in the finalizer in the GC thread, which causes the program to crash.
Probably we need to catch the exception and prevent a degenerate object from being created in the first place. This needs to be fixed in Pythonnet.