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
Boxiang Sun
cython
Commits
5a3da515
Commit
5a3da515
authored
Jul 10, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapt temp handling and type checking in BoolBinopNode to new delayed temp cleanup
parent
a1fbea79
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+12
-0
tests/run/charptr_from_temp.pyx
tests/run/charptr_from_temp.pyx
+20
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
5a3da515
...
...
@@ -9671,6 +9671,12 @@ class BoolBinopNode(ExprNode):
self
.
operand1
=
self
.
operand1
.
analyse_types
(
env
)
self
.
operand2
=
self
.
operand2
.
analyse_types
(
env
)
self
.
type
=
PyrexTypes
.
independent_spanning_type
(
self
.
operand1
.
type
,
self
.
operand2
.
type
)
if
self
.
type
.
is_error
:
# incompatible C types, try if we can calculate everything in Python space
self
.
type
=
py_object_type
if
not
self
.
type
.
is_pyobject
:
if
self
.
operand1
.
is_ephemeral
()
or
self
.
operand2
.
is_ephemeral
():
error
(
self
.
pos
,
"Unsafe C derivative of temporary Python reference used in and/or expression"
)
self
.
operand1
=
self
.
operand1
.
coerce_to
(
self
.
type
,
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
self
.
type
,
env
)
...
...
@@ -9714,6 +9720,12 @@ class BoolBinopNode(ExprNode):
self
.
operand1
.
free_temps
(
code
)
code
.
putln
(
"}"
)
def
generate_subexpr_disposal_code
(
self
,
code
):
pass
# nothing to do here, all done in generate_evaluation_code()
def
free_subexpr_temps
(
self
,
code
):
pass
# nothing to do here, all done in generate_evaluation_code()
def
generate_operand1_test
(
self
,
code
):
# Generate code to test the truth of the first operand.
if
self
.
type
.
is_pyobject
:
...
...
tests/run/charptr_from_temp.pyx
View file @
5a3da515
...
...
@@ -74,3 +74,23 @@ def test_more_args_adding(s):
'abxyzqr'
"""
return
cfunc3
(
1
,
b"a"
+
b"b"
+
s
+
b"q"
+
b"r"
,
'xyz%d'
%
3
)
cdef
char
*
ret_charptr
(
char
*
s
):
return
s
def
test_charptr_and_charptr_func
(
char
*
s
):
"""
>>> test_charptr_and_charptr_func(b'abc') == b'abc'
True
"""
return
s
and
ret_charptr
(
s
)
def
test_charptr_and_ucharptr
(
char
*
s
):
"""
>>> test_charptr_and_ucharptr(b'abc') == b'abc'
True
"""
return
s
and
<
unsigned
char
*>
s
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