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
Boxiang Sun
cython
Commits
d8ffa16c
Commit
d8ffa16c
authored
May 28, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise correct exception if entry came from closure
parent
bf1e2133
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+10
-5
No files found.
Cython/Compiler/Code.py
View file @
d8ffa16c
...
@@ -1420,11 +1420,16 @@ class CCodeWriter(object):
...
@@ -1420,11 +1420,16 @@ class CCodeWriter(object):
return
self
.
putln
(
"if (%s < 0) %s"
%
(
value
,
self
.
error_goto
(
pos
)))
return
self
.
putln
(
"if (%s < 0) %s"
%
(
value
,
self
.
error_goto
(
pos
)))
def
put_error_if_unbound
(
self
,
pos
,
entry
):
def
put_error_if_unbound
(
self
,
pos
,
entry
):
self
.
put
(
'if (unlikely(!%s)) { '
self
.
put
(
'if (unlikely(!%s)) { PyErr_SetString('
%
entry
.
cname
)
'PyErr_SetString(PyExc_UnboundLocalError, "'
if
entry
.
from_closure
:
"local variable '%s' referenced before assignment"
self
.
put
(
'PyExc_NameError, "'
)
'"); %s }'
%
self
.
put
(
"free variable '%s' referenced before assignment in enclosing scope"
%
(
entry
.
cname
,
entry
.
name
,
self
.
error_goto
(
pos
)))
entry
.
name
)
else
:
self
.
put
(
'PyExc_UnboundLocalError, "'
)
self
.
put
(
"local variable '%s' referenced before assignment"
%
entry
.
name
)
self
.
putln
(
'"); %s }'
%
self
.
error_goto
(
pos
))
def
set_error_info
(
self
,
pos
):
def
set_error_info
(
self
,
pos
):
self
.
funcstate
.
should_declare_error_indicator
=
True
self
.
funcstate
.
should_declare_error_indicator
=
True
...
...
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