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
4e91e8fa
Commit
4e91e8fa
authored
Sep 07, 2007
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check return values before PyErr_Occurred() for coercion nodes.
parent
c1609002
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+12
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+10
-4
No files found.
Cython/Compiler/ExprNodes.py
View file @
4e91e8fa
...
...
@@ -3177,7 +3177,18 @@ class CoerceFromPyTypeNode(CoercionNode):
code
.
putln
(
'%s = %s; %s'
%
(
self
.
result_code
,
rhs
,
code
.
error_goto_if_PyErr
(
self
.
pos
)))
code
.
error_goto_if
(
self
.
error_cond
(),
self
.
pos
)))
def
error_cond
(
self
):
conds
=
[]
if
self
.
type
.
exception_value
is
not
None
:
conds
.
append
(
"(%s == %s)"
%
(
self
.
result_code
,
self
.
type
.
exception_value
))
if
self
.
type
.
exception_check
:
conds
.
append
(
"PyErr_Occurred()"
)
if
len
(
conds
)
>
0
:
return
" && "
.
join
(
conds
)
else
:
return
0
class
CoerceToBooleanNode
(
CoercionNode
):
...
...
Cython/Compiler/PyrexTypes.py
View file @
4e91e8fa
...
...
@@ -260,6 +260,8 @@ class CType(PyrexType):
to_py_function
=
None
from_py_function
=
None
exception_value
=
None
exception_check
=
1
#class CSimpleType(CType):
...
...
@@ -332,6 +334,7 @@ class CIntType(CNumericType):
typedef_flag
=
0
to_py_function
=
"PyInt_FromLong"
from_py_function
=
"PyInt_AsLong"
exception_value
=
-
1
def
__init__
(
self
,
rank
,
signed
,
pymemberdef_typecode
=
None
,
is_returncode
=
0
):
CNumericType
.
__init__
(
self
,
rank
,
signed
,
pymemberdef_typecode
)
...
...
@@ -347,33 +350,35 @@ class CBIntType(CIntType):
# and no error checking should be needed (just an incref).
to_py_function
=
"__Pyx_PyBool_FromLong"
from_py_function
=
"__Pyx_PyObject_IsTrue"
exception_check
=
0
class
CPySSizeTType
(
CIntType
):
to_py_function
=
"PyInt_FromSsize_t"
from_py_function
=
"__pyx_PyIndex_AsSsize_t"
exception_value
=
None
class
CUIntType
(
CIntType
):
to_py_function
=
"PyLong_FromUnsignedLong"
from_py_function
=
"PyInt_AsUnsignedLongMask"
exception_value
=
None
class
CULongType
(
CIntType
):
class
CULongType
(
C
U
IntType
):
to_py_function
=
"PyLong_FromUnsignedLong"
from_py_function
=
"PyInt_AsUnsignedLongMask"
class
CLongLongType
(
CIntType
):
class
CLongLongType
(
C
U
IntType
):
to_py_function
=
"PyLong_FromLongLong"
from_py_function
=
"PyInt_AsUnsignedLongLongMask"
class
CULongLongType
(
CIntType
):
class
CULongLongType
(
C
U
IntType
):
to_py_function
=
"PyLong_FromUnsignedLongLong"
from_py_function
=
"PyInt_AsUnsignedLongLongMask"
...
...
@@ -703,6 +708,7 @@ class CStringType:
to_py_function
=
"PyString_FromString"
from_py_function
=
"PyString_AsString"
exception_value
=
"NULL"
def
literal_code
(
self
,
value
):
return
'"%s"'
%
value
...
...
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