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
Gwenaël Samain
cython
Commits
ba105125
Commit
ba105125
authored
Oct 15, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove TempNode from OverrideCheckNode (fixes #411)
parent
4d4d29d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+19
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+10
-9
No files found.
Cython/Compiler/ExprNodes.py
View file @
ba105125
...
...
@@ -1665,6 +1665,25 @@ class PyTempNode(TempNode):
def
__init__
(
self
,
pos
,
env
):
TempNode
.
__init__
(
self
,
pos
,
PyrexTypes
.
py_object_type
,
env
)
class
RawCNameExprNode
(
ExprNode
):
subexprs
=
[]
def
__init__
(
self
,
pos
,
type
=
None
):
self
.
pos
=
pos
self
.
type
=
type
def
analyse_types
(
self
,
env
):
return
self
.
type
def
set_cname
(
self
,
cname
):
self
.
cname
=
cname
def
result
(
self
):
return
self
.
cname
def
generate_result_code
(
self
,
code
):
pass
#-------------------------------------------------------------------
#
...
...
Cython/Compiler/Nodes.py
View file @
ba105125
...
...
@@ -2458,7 +2458,7 @@ class OverrideCheckNode(StatNode):
else
:
first_arg
=
1
import
ExprNodes
self
.
func_node
=
ExprNodes
.
PyTempNode
(
self
.
pos
,
env
)
self
.
func_node
=
ExprNodes
.
RawCNameExprNode
(
self
.
pos
,
py_object_type
)
call_tuple
=
ExprNodes
.
TupleNode
(
self
.
pos
,
args
=
[
ExprNodes
.
NameNode
(
self
.
pos
,
name
=
arg
.
name
)
for
arg
in
self
.
args
[
first_arg
:]])
call_node
=
ExprNodes
.
SimpleCallNode
(
self
.
pos
,
function
=
self
.
func_node
,
...
...
@@ -2480,20 +2480,21 @@ class OverrideCheckNode(StatNode):
code
.
putln
(
"else {"
)
else
:
code
.
putln
(
"else if (unlikely(Py_TYPE(%s)->tp_dictoffset != 0)) {"
%
self_arg
)
self
.
func_node
.
allocate
(
cod
e
)
err
=
code
.
error_goto_if_null
(
self
.
func_node
.
result
(),
self
.
pos
)
func_node_temp
=
code
.
funcstate
.
allocate_temp
(
py_object_type
,
manage_ref
=
Tru
e
)
self
.
func_node
.
set_cname
(
func_node_temp
)
# need to get attribute manually--scope would return cdef method
err
=
code
.
error_goto_if_null
(
func_node_temp
,
self
.
pos
)
code
.
putln
(
"%s = PyObject_GetAttr(%s, %s); %s"
%
(
self
.
func_node
.
result
()
,
self_arg
,
interned_attr_cname
,
err
))
code
.
put_gotref
(
self
.
func_node
.
py_result
()
)
is_builtin_function_or_method
=
"PyCFunction_Check(%s)"
%
self
.
func_node
.
result
()
func_node_temp
,
self_arg
,
interned_attr_cname
,
err
))
code
.
put_gotref
(
func_node_temp
)
is_builtin_function_or_method
=
"PyCFunction_Check(%s)"
%
func_node_temp
is_overridden
=
"(PyCFunction_GET_FUNCTION(%s) != (void *)&%s)"
%
(
self
.
func_node
.
result
()
,
self
.
py_func
.
entry
.
func_cname
)
func_node_temp
,
self
.
py_func
.
entry
.
func_cname
)
code
.
putln
(
"if (!%s || %s) {"
%
(
is_builtin_function_or_method
,
is_overridden
))
self
.
body
.
generate_execution_code
(
code
)
code
.
putln
(
"}"
)
code
.
put_decref_clear
(
self
.
func_node
.
result
()
,
PyrexTypes
.
py_object_type
)
self
.
func_node
.
release
(
code
)
code
.
put_decref_clear
(
func_node_temp
,
PyrexTypes
.
py_object_type
)
code
.
funcstate
.
release_temp
(
func_node_temp
)
code
.
putln
(
"}"
)
class
ClassDefNode
(
StatNode
,
BlockNode
):
...
...
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