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
3cae35ea
Commit
3cae35ea
authored
Feb 15, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'upstream/master'
parents
86d1bd4a
14f62011
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+20
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+0
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
3cae35ea
...
...
@@ -368,6 +368,11 @@ class ExprNode(Node):
else
:
self
.
not_implemented
(
"infer_type"
)
def
nonlocally_immutable
(
self
):
# Returns whether this variable is a safe reference, i.e.
# can't be modified as part of globals or closures.
return
self
.
is_temp
# --------------- Type Analysis ------------------
def
analyse_as_module
(
self
,
env
):
...
...
@@ -757,6 +762,9 @@ class ConstNode(AtomicExprNode):
def
is_simple
(
self
):
return
1
def
nonlocally_immutable
(
self
):
return
1
def
may_be_none
(
self
):
return
False
...
...
@@ -1474,6 +1482,10 @@ class NameNode(AtomicExprNode):
# If it's not a C variable, it'll be in a temp.
return
1
def
nonlocally_immutable
(
self
):
entry
=
self
.
entry
return
entry
and
(
entry
.
is_local
or
entry
.
is_arg
)
and
not
entry
.
in_closure
def
calculate_target_results
(
self
,
env
):
pass
...
...
@@ -2997,7 +3009,7 @@ class SimpleCallNode(CallNode):
if
i
==
0
and
self
.
self
is
not
None
:
# a method's cloned "self" argument is ok
pass
elif
arg
.
is_name
and
arg
.
entry
and
arg
.
entry
.
is_local
and
not
arg
.
entry
.
in_closure
:
elif
arg
.
nonlocally_immutable
()
:
# plain local variables are ok
pass
else
:
...
...
@@ -4049,6 +4061,10 @@ class TupleNode(SequenceNode):
# either temp or constant => always simple
return
True
def
nonlocally_immutable
(
self
):
# either temp or constant => always safe
return
True
def
calculate_result_code
(
self
):
if
len
(
self
.
args
)
>
0
:
return
self
.
result_code
...
...
@@ -5487,6 +5503,9 @@ class TypecastNode(ExprNode):
# either temp or a C cast => no side effects
return
True
def
nonlocally_immutable
(
self
):
return
self
.
operand
.
nonlocally_immutable
()
def
nogil_check
(
self
,
env
):
if
self
.
type
and
self
.
type
.
is_pyobject
and
self
.
is_temp
:
self
.
gil_error
()
...
...
Cython/Compiler/Nodes.py
View file @
3cae35ea
...
...
@@ -1540,7 +1540,6 @@ class FuncDefNode(StatNode, BlockNode):
def
generate_arg_none_check
(
self
,
arg
,
code
):
# Generate None check for one argument.
code
.
globalstate
.
use_utility_code
(
arg_type_test_utility_code
)
code
.
putln
(
'if (unlikely(((PyObject *)%s) == Py_None)) {'
%
arg
.
entry
.
cname
)
code
.
putln
(
'''PyErr_Format(PyExc_TypeError, "Argument '%s' must not be None"); %s'''
%
(
arg
.
name
,
...
...
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