def testDecRefLaterSurvivesEmptyStack(self): frees = [] mapper = PythonMapper(GetAllocatingTestAllocator([], frees)) mapper.tempObjects = Stack[List[IntPtr]]() try: mapper.DecRefLater(IntPtr.Zero) except InvalidOperationException: self.fail('DecRefLater should not throw StackEmpty if tempObjects is empty') finally: mapper.Dispose()
def testDecRefLaterSurvivesNoneOnStack(self): frees = [] mapper = PythonMapper(GetAllocatingTestAllocator([], frees)) mapper.tempObjects = Stack[List[IntPtr]]() mapper.tempObjects.Push(None) try: mapper.DecRefLater(IntPtr.Zero) except SystemError: self.fail('DecRefLater should not throw NullReference if tempObjects contains None') finally: mapper.Dispose()