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
7417b747
Commit
7417b747
authored
Dec 17, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
1d37db8a
478b939a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+12
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
7417b747
...
@@ -274,6 +274,13 @@ class ExprNode(Node):
...
@@ -274,6 +274,13 @@ class ExprNode(Node):
def
result_as
(
self
,
type
=
None
):
def
result_as
(
self
,
type
=
None
):
# Return the result code cast to the specified C type.
# Return the result code cast to the specified C type.
if
(
self
.
is_temp
and
self
.
type
.
is_pyobject
and
type
!=
py_object_type
):
# Allocated temporaries are always PyObject *, which may not
# reflect the actual type (e.g. an extension type)
return
typecast
(
type
,
py_object_type
,
self
.
result
())
return
typecast
(
type
,
self
.
ctype
(),
self
.
result
())
return
typecast
(
type
,
self
.
ctype
(),
self
.
result
())
return
typecast
(
type
,
self
.
ctype
(),
self
.
result
())
def
py_result
(
self
):
def
py_result
(
self
):
...
@@ -3080,8 +3087,11 @@ class IndexNode(ExprNode):
...
@@ -3080,8 +3087,11 @@ class IndexNode(ExprNode):
buffer_entry
,
self
.
buffer_ptr_code
=
self
.
buffer_lookup_code
(
code
)
buffer_entry
,
self
.
buffer_ptr_code
=
self
.
buffer_lookup_code
(
code
)
if
self
.
type
.
is_pyobject
:
if
self
.
type
.
is_pyobject
:
# is_temp is True, so must pull out value and incref it.
# is_temp is True, so must pull out value and incref it.
code
.
putln
(
"%s = *%s;"
%
(
self
.
result
(),
self
.
buffer_ptr_code
))
# NOTE: object temporary results for nodes are declared
code
.
putln
(
"__Pyx_INCREF((PyObject*)%s);"
%
self
.
result
())
# as PyObject *, so we need a cast
code
.
putln
(
"%s = (PyObject *) *%s;"
%
(
self
.
temp_code
,
self
.
buffer_ptr_code
))
code
.
putln
(
"__Pyx_INCREF((PyObject*)%s);"
%
self
.
temp_code
)
elif
self
.
memslice_slice
:
elif
self
.
memslice_slice
:
self
.
put_memoryviewslice_slice_code
(
code
)
self
.
put_memoryviewslice_slice_code
(
code
)
...
...
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