Commit 135dc33c authored by Stefan Behnel's avatar Stefan Behnel

give more informative crash messages on temp releasing errors

parent 8f9b1471
...@@ -15,7 +15,7 @@ cython.declare(error=object, warning=object, warn_once=object, InternalError=obj ...@@ -15,7 +15,7 @@ cython.declare(error=object, warning=object, warn_once=object, InternalError=obj
debug_disposal_code=object, debug_temp_alloc=object, debug_coercion=object, debug_disposal_code=object, debug_temp_alloc=object, debug_coercion=object,
bytearray_type=object, slice_type=object) bytearray_type=object, slice_type=object)
import sys import os.path
import copy import copy
import operator import operator
...@@ -557,12 +557,13 @@ class ExprNode(Node): ...@@ -557,12 +557,13 @@ class ExprNode(Node):
if not self.result_is_used: if not self.result_is_used:
# not used anyway, so ignore if not set up # not used anyway, so ignore if not set up
return return
pos = (os.path.basename(self.pos[0].get_description()),) + self.pos[1:] if self.pos else '(?)'
if self.old_temp: if self.old_temp:
raise RuntimeError("temp %s released multiple times in %s" % ( raise RuntimeError("temp %s released multiple times in %s at %r" % (
self.old_temp, self.__class__.__name__)) self.old_temp, self.__class__.__name__, pos))
else: else:
raise RuntimeError("no temp, but release requested in %s" % ( raise RuntimeError("no temp, but release requested in %s at %r" % (
self.__class__.__name__)) self.__class__.__name__, pos))
code.funcstate.release_temp(self.temp_code) code.funcstate.release_temp(self.temp_code)
self.old_temp = self.temp_code self.old_temp = self.temp_code
self.temp_code = None self.temp_code = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment