Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
30f616cd
Commit
30f616cd
authored
Jun 25, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate that all temps were correctly released at the end of a function.
parent
df0047fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+15
-0
No files found.
Cython/Compiler/Code.py
View file @
30f616cd
...
...
@@ -735,6 +735,20 @@ class FunctionState(object):
self.should_declare_error_indicator = False
self.uses_error_indicator = False
# safety checks
def validate_exit(self):
# validate that all allocated temps have been freed
if self.temps_allocated:
leftovers = set(self.all_managed_temps()).difference(self.all_free_managed_temps())
if leftovers:
msg = "Temps left over at end of '
%
s
': %s" % (
self.scope.name,
'
,
'.join(map(str, sorted(leftovers, key=operator.itemgetter(0)))),
)
print(msg)
#raise RuntimeError(msg)
# labels
def new_label(self, name=None):
...
...
@@ -1860,6 +1874,7 @@ class CCodeWriter(object):
self
.
funcstate
=
FunctionState
(
self
,
scope
=
scope
)
def
exit_cfunc_scope
(
self
):
self
.
funcstate
.
validate_exit
()
self
.
funcstate
=
None
# constant handling
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment