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
90dce013
Commit
90dce013
authored
Aug 30, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make CyFunction work for cpdef methods
parent
66c059d8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+8
-7
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
90dce013
...
@@ -1877,11 +1877,12 @@ class NameNode(AtomicExprNode):
...
@@ -1877,11 +1877,12 @@ class NameNode(AtomicExprNode):
def
analyse_target_types
(
self
,
env
):
def
analyse_target_types
(
self
,
env
):
self
.
analyse_entry
(
env
,
is_target
=
True
)
self
.
analyse_entry
(
env
,
is_target
=
True
)
if
self
.
entry
.
is_cfunction
and
self
.
entry
.
as_variable
:
entry
=
self
.
entry
if
self
.
entry
.
is_overridable
or
not
self
.
is_lvalue
()
and
self
.
entry
.
fused_cfunction
:
if
entry
.
is_cfunction
and
entry
.
as_variable
:
if
entry
.
type
.
is_overridable
or
not
self
.
is_lvalue
()
and
entry
.
fused_cfunction
:
# We need this for assigning to cpdef names and for the fused 'def' TreeFragment
# We need this for assigning to cpdef names and for the fused 'def' TreeFragment
self
.
entry
=
self
.
entry
.
as_variable
entry
=
self
.
entry
=
entry
.
as_variable
self
.
type
=
self
.
entry
.
type
self
.
type
=
entry
.
type
if
self
.
type
.
is_const
:
if
self
.
type
.
is_const
:
error
(
self
.
pos
,
"Assignment to const '%s'"
%
self
.
name
)
error
(
self
.
pos
,
"Assignment to const '%s'"
%
self
.
name
)
...
@@ -1890,10 +1891,10 @@ class NameNode(AtomicExprNode):
...
@@ -1890,10 +1891,10 @@ class NameNode(AtomicExprNode):
if
not
self
.
is_lvalue
():
if
not
self
.
is_lvalue
():
error
(
self
.
pos
,
"Assignment to non-lvalue '%s'"
%
self
.
name
)
error
(
self
.
pos
,
"Assignment to non-lvalue '%s'"
%
self
.
name
)
self
.
type
=
PyrexTypes
.
error_type
self
.
type
=
PyrexTypes
.
error_type
self
.
entry
.
used
=
1
entry
.
used
=
1
if
self
.
entry
.
type
.
is_buffer
:
if
entry
.
type
.
is_buffer
:
from
.
import
Buffer
from
.
import
Buffer
Buffer
.
used_buffer_aux_vars
(
self
.
entry
)
Buffer
.
used_buffer_aux_vars
(
entry
)
return
self
return
self
def
analyse_rvalue_entry
(
self
,
env
):
def
analyse_rvalue_entry
(
self
,
env
):
...
...
Cython/Compiler/Nodes.py
View file @
90dce013
...
@@ -2373,6 +2373,7 @@ class CFuncDefNode(FuncDefNode):
...
@@ -2373,6 +2373,7 @@ class CFuncDefNode(FuncDefNode):
is_wrapper
=
1
)
is_wrapper
=
1
)
self
.
py_func
.
is_module_scope
=
env
.
is_module_scope
self
.
py_func
.
is_module_scope
=
env
.
is_module_scope
self
.
py_func
.
analyse_declarations
(
env
)
self
.
py_func
.
analyse_declarations
(
env
)
self
.
py_func
.
entry
.
is_overridable
=
True
self
.
py_func_stat
=
StatListNode
(
self
.
pos
,
stats
=
[
self
.
py_func
])
self
.
py_func_stat
=
StatListNode
(
self
.
pos
,
stats
=
[
self
.
py_func
])
self
.
py_func
.
type
=
PyrexTypes
.
py_object_type
self
.
py_func
.
type
=
PyrexTypes
.
py_object_type
self
.
entry
.
as_variable
=
self
.
py_func
.
entry
self
.
entry
.
as_variable
=
self
.
py_func
.
entry
...
@@ -2449,7 +2450,10 @@ class CFuncDefNode(FuncDefNode):
...
@@ -2449,7 +2450,10 @@ class CFuncDefNode(FuncDefNode):
def
analyse_expressions
(
self
,
env
):
def
analyse_expressions
(
self
,
env
):
self
.
local_scope
.
directives
=
env
.
directives
self
.
local_scope
.
directives
=
env
.
directives
if
self
.
py_func
is
not
None
:
if
self
.
py_func_stat
is
not
None
:
# this will also analyse the default values and the function name assignment
self
.
py_func_stat
=
self
.
py_func_stat
.
analyse_expressions
(
env
)
elif
self
.
py_func
is
not
None
:
# this will also analyse the default values
# this will also analyse the default values
self
.
py_func
=
self
.
py_func
.
analyse_expressions
(
env
)
self
.
py_func
=
self
.
py_func
.
analyse_expressions
(
env
)
else
:
else
:
...
@@ -3035,7 +3039,7 @@ class DefNode(FuncDefNode):
...
@@ -3035,7 +3039,7 @@ class DefNode(FuncDefNode):
def
needs_assignment_synthesis
(
self
,
env
,
code
=
None
):
def
needs_assignment_synthesis
(
self
,
env
,
code
=
None
):
if
self
.
is_staticmethod
:
if
self
.
is_staticmethod
:
return
True
return
True
if
self
.
is_wrapper
or
self
.
specialized_cpdefs
or
self
.
entry
.
is_fused_specialized
:
if
self
.
specialized_cpdefs
or
self
.
entry
.
is_fused_specialized
:
return
False
return
False
if
self
.
no_assignment_synthesis
:
if
self
.
no_assignment_synthesis
:
return
False
return
False
...
...
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