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
6b043aa3
Commit
6b043aa3
authored
May 14, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testcase fix, update error message
parent
405ec484
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
tests/errors/e_tempcast.pyx
tests/errors/e_tempcast.pyx
+4
-3
tests/errors/pyobjcastdisallow_T313.pyx
tests/errors/pyobjcastdisallow_T313.pyx
+1
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
6b043aa3
...
...
@@ -3939,7 +3939,7 @@ class TypecastNode(NewTempExprNode):
if
self
.
type
.
from_py_function
:
self
.
operand
=
self
.
operand
.
coerce_to
(
self
.
type
,
env
)
elif
self
.
type
.
is_ptr
and
not
(
self
.
type
.
base_type
.
is_void
or
self
.
type
.
base_type
.
is_struct
):
error
(
self
.
pos
,
"Python objects can
only be cast to void*
"
)
error
(
self
.
pos
,
"Python objects can
not be casted to pointers of primitive types
"
)
else
:
warning
(
self
.
pos
,
"No conversion from %s to %s, python object pointer used."
%
(
self
.
type
,
self
.
operand
.
type
))
elif
from_py
and
to_py
:
...
...
tests/errors/e_tempcast.pyx
View file @
6b043aa3
cdef
object
blarg
def
foo
(
obj
):
cdef
int
*
p
p
=
<
int
*>
blarg
# okay
p
=
<
int
*>
(
foo
+
blarg
)
# error - temporary
cdef
void
*
p
p
=
<
void
*>
blarg
# ok
p
=
<
void
*>
(
obj
+
blarg
)
# error - temporary
_ERRORS
=
u"""
6:5: Casting temporary Python object to non-numeric non-Python type
"""
tests/errors/pyobjcastdisallow_T313.pyx
View file @
6b043aa3
...
...
@@ -5,5 +5,5 @@ cdef void* allowed = <void*>a
cdef
double
*
disallowed
=
<
double
*>
a
_ERRORS
=
u"""
5:26: Python objects can
only be cast to void*
5:26: Python objects can
not be casted to pointers of primitive types
"""
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