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
fc6d7a7b
Commit
fc6d7a7b
authored
May 03, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.22.x'
Conflicts: Cython/Utility/CythonFunction.c Cython/Utility/Generator.c
parents
5bd29d5e
bf93c499
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
12 deletions
+37
-12
CHANGES.rst
CHANGES.rst
+3
-0
Cython/Utility/CythonFunction.c
Cython/Utility/CythonFunction.c
+11
-7
Cython/Utility/Exceptions.c
Cython/Utility/Exceptions.c
+7
-3
Cython/Utility/Generator.c
Cython/Utility/Generator.c
+14
-2
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+2
-0
No files found.
CHANGES.rst
View file @
fc6d7a7b
...
...
@@ -81,6 +81,9 @@ Bugs fixed
* Crash when returning values on generator termination.
* In some cases, exceptions raised during internal isinstance() checks were
not propagated.
* Runtime reported file paths of source files (e.g for profiling and tracing)
are now relative to the build root directory instead of the main source file.
...
...
Cython/Utility/CythonFunction.c
View file @
fc6d7a7b
...
...
@@ -1058,13 +1058,17 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
#endif
}
if
(
self
&&
!
is_classmethod
&&
!
is_staticmethod
&&
!
PyObject_IsInstance
(
self
,
binding_func
->
type
))
{
PyErr_Format
(
PyExc_TypeError
,
"First argument should be of type %.200s, got %.200s."
,
((
PyTypeObject
*
)
binding_func
->
type
)
->
tp_name
,
self
->
ob_type
->
tp_name
);
goto
bad
;
if
(
self
&&
!
is_classmethod
&&
!
is_staticmethod
)
{
int
is_instance
=
PyObject_IsInstance
(
self
,
binding_func
->
type
);
if
(
unlikely
(
!
is_instance
))
{
PyErr_Format
(
PyExc_TypeError
,
"First argument should be of type %.200s, got %.200s."
,
((
PyTypeObject
*
)
binding_func
->
type
)
->
tp_name
,
self
->
ob_type
->
tp_name
);
goto
bad
;
}
else
if
(
unlikely
(
is_instance
==
-
1
))
{
goto
bad
;
}
}
#if !CYTHON_COMPILING_IN_CPYTHON
Py_XDECREF
(
self
);
...
...
Cython/Utility/Exceptions.c
View file @
fc6d7a7b
...
...
@@ -144,11 +144,15 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
if
(
value
&&
PyExceptionInstance_Check
(
value
))
{
instance_class
=
(
PyObject
*
)
Py_TYPE
(
value
);
if
(
instance_class
!=
type
)
{
if
(
PyObject_IsSubclass
(
instance_class
,
type
))
{
int
is_subclass
=
PyObject_IsSubclass
(
instance_class
,
type
);
if
(
!
is_subclass
)
{
instance_class
=
NULL
;
}
else
if
(
unlikely
(
is_subclass
==
-
1
))
{
// error on subclass test
goto
bad
;
}
else
{
// believe the instance
type
=
instance_class
;
}
else
{
instance_class
=
NULL
;
}
}
}
...
...
Cython/Utility/Generator.c
View file @
fc6d7a7b
...
...
@@ -104,6 +104,7 @@ static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args);
static
int
__Pyx_PyGen_FetchStopIterationValue
(
PyObject
**
pvalue
)
{
PyObject
*
et
,
*
ev
,
*
tb
;
PyObject
*
value
=
NULL
;
int
result
;
__Pyx_ErrFetch
(
&
et
,
&
ev
,
&
tb
);
...
...
@@ -117,6 +118,7 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
// most common case: plain StopIteration without or with separate argument
if
(
likely
(
et
==
PyExc_StopIteration
))
{
int
error
=
0
;
#if PY_VERSION_HEX >= 0x030300A0
if
(
ev
&&
Py_TYPE
(
ev
)
==
(
PyTypeObject
*
)
PyExc_StopIteration
)
{
value
=
((
PyStopIterationObject
*
)
ev
)
->
value
;
...
...
@@ -128,7 +130,7 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
return
0
;
}
#endif
if
(
!
ev
||
!
PyObject_IsInstance
(
ev
,
PyExc_StopIteration
))
{
if
(
!
ev
||
!
(
error
=
PyObject_IsInstance
(
ev
,
PyExc_StopIteration
)
))
{
// PyErr_SetObject() and friends put the value directly into ev
if
(
!
ev
)
{
Py_INCREF
(
Py_None
);
...
...
@@ -139,6 +141,10 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
*
pvalue
=
ev
;
return
0
;
}
if
(
unlikely
(
error
==
-
1
))
{
// error during isinstance() check
return
-
1
;
}
}
else
if
(
!
PyErr_GivenExceptionMatches
(
et
,
PyExc_StopIteration
))
{
__Pyx_ErrRestore
(
et
,
ev
,
tb
);
return
-
1
;
...
...
@@ -146,13 +152,19 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
// otherwise: normalise and check what that gives us
PyErr_NormalizeException
(
&
et
,
&
ev
,
&
tb
);
if
(
unlikely
(
!
PyObject_IsInstance
(
ev
,
PyExc_StopIteration
)))
{
result
=
PyObject_IsInstance
(
ev
,
PyExc_StopIteration
);
if
(
unlikely
(
!
result
))
{
// looks like normalisation failed - raise the new exception
__Pyx_ErrRestore
(
et
,
ev
,
tb
);
return
-
1
;
}
Py_XDECREF
(
tb
);
Py_DECREF
(
et
);
if
(
unlikely
(
result
==
-
1
))
{
// error during isinstance() check
Py_DECREF
(
ev
);
return
-
1
;
}
#if PY_VERSION_HEX >= 0x030300A0
value
=
((
PyStopIterationObject
*
)
ev
)
->
value
;
Py_INCREF
(
value
);
...
...
Cython/Utility/ObjectHandling.c
View file @
fc6d7a7b
...
...
@@ -1422,6 +1422,8 @@ bad:
static
PyObject
*
__Pyx__PyNumber_MatrixMultiply
(
PyObject
*
x
,
PyObject
*
y
,
const
char
*
op_name
)
{
int
right_is_subtype
=
PyObject_IsSubclass
((
PyObject
*
)
Py_TYPE
(
y
),
(
PyObject
*
)
Py_TYPE
(
x
));
if
(
unlikely
(
right_is_subtype
==
-
1
))
return
NULL
;
if
(
right_is_subtype
)
{
// to allow subtypes to override parent behaviour, try reversed operation first
// see note at https://docs.python.org/3/reference/datamodel.html#emulating-numeric-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