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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
173b578c
Commit
173b578c
authored
May 27, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix control-flow and closure entries
parent
3a89c5a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-4
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+9
-9
No files found.
Cython/Compiler/ExprNodes.py
View file @
173b578c
...
...
@@ -1556,7 +1556,7 @@ class NameNode(AtomicExprNode):
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
)))
code
.
put_gotref
(
self
.
py_result
())
elif
entry
.
is_local
:
elif
entry
.
is_local
or
entry
.
in_closure
or
entry
.
from_closure
:
if
entry
.
type
.
is_pyobject
:
if
(
self
.
cf_maybe_null
or
self
.
cf_is_null
)
and
not
self
.
allow_null
:
code
.
putln
(
'if (unlikely(!%s)) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }'
%
...
...
@@ -1635,14 +1635,14 @@ class NameNode(AtomicExprNode):
code
.
put_xgotref
(
self
.
py_result
())
else
:
code
.
put_gotref
(
self
.
py_result
())
if
entry
.
is_local
:
if
entry
.
is_cglobal
:
code
.
put_decref
(
self
.
result
(),
self
.
ctype
())
else
:
if
not
self
.
cf_is_null
:
if
self
.
cf_maybe_null
:
code
.
put_xdecref
(
self
.
result
(),
self
.
ctype
())
else
:
code
.
put_decref
(
self
.
result
(),
self
.
ctype
())
else
:
code
.
put_decref
(
self
.
result
(),
self
.
ctype
())
if
is_external_ref
:
code
.
put_giveref
(
rhs
.
py_result
())
...
...
Cython/Compiler/FlowControl.py
View file @
173b578c
...
...
@@ -473,9 +473,11 @@ def check_definitions(flow, compiler_directives):
for
node
,
entry
in
references
.
iteritems
():
if
Uninitialized
in
node
.
cf_state
:
node
.
cf_maybe_null
=
True
if
entry
.
from_closure
or
node
.
allow_null
:
if
not
entry
.
from_closure
and
len
(
node
.
cf_state
)
==
1
:
node
.
cf_is_null
=
True
if
node
.
allow_null
or
entry
.
from_closure
:
pass
# Can be uninitialized here
elif
len
(
node
.
cf_state
)
==
1
:
elif
node
.
cf_is_null
:
if
entry
.
type
.
is_pyobject
or
entry
.
type
.
is_unspecified
:
messages
.
error
(
node
.
pos
,
...
...
@@ -486,9 +488,7 @@ def check_definitions(flow, compiler_directives):
node
.
pos
,
"local variable '%s' referenced before assignment"
%
entry
.
name
)
node
.
cf_is_null
=
True
else
:
if
warn_maybe_uninitialized
:
elif
warn_maybe_uninitialized
:
messages
.
warning
(
node
.
pos
,
"local variable '%s' might be referenced before assignment"
...
...
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