Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
db5c5739
Commit
db5c5739
authored
May 08, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refcounting fixes for numpy in PyTuple_GetSlice, PyErr_SetExcInfo and PyErr_GetExcInfo
parent
b163e6cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
src/runtime/capi.cpp
src/runtime/capi.cpp
+9
-7
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+7
-4
No files found.
src/runtime/capi.cpp
View file @
db5c5739
...
...
@@ -747,18 +747,20 @@ extern "C" void Py_Exit(int sts) noexcept {
}
extern
"C"
void
PyErr_GetExcInfo
(
PyObject
**
ptype
,
PyObject
**
pvalue
,
PyObject
**
ptraceback
)
noexcept
{
assert
(
0
&&
"check refcounting"
);
ExcInfo
*
exc
=
getFrameExcInfo
();
*
ptype
=
exc
->
type
;
*
pvalue
=
exc
->
value
;
*
ptraceback
=
exc
->
traceback
;
*
ptype
=
xincref
(
exc
->
type
)
;
*
pvalue
=
xincref
(
exc
->
value
)
;
*
ptraceback
=
xincref
(
exc
->
traceback
)
;
}
extern
"C"
void
PyErr_SetExcInfo
(
PyObject
*
type
,
PyObject
*
value
,
PyObject
*
traceback
)
noexcept
{
assert
(
0
&&
"check refcounting"
);
ExcInfo
*
exc
=
getFrameExcInfo
();
exc
->
type
=
type
?
type
:
None
;
exc
->
value
=
value
?
value
:
None
;
AUTO_XDECREF
(
exc
->
type
);
AUTO_XDECREF
(
exc
->
value
);
AUTO_XDECREF
(
exc
->
traceback
);
exc
->
type
=
type
?
type
:
incref
(
None
);
exc
->
value
=
value
?
value
:
incref
(
None
);
exc
->
traceback
=
traceback
;
}
...
...
src/runtime/tuple.cpp
View file @
db5c5739
...
...
@@ -92,9 +92,12 @@ Box* tupleGetitemSlice(BoxedTuple* self, BoxedSlice* slice) {
}
extern
"C"
PyObject
*
PyTuple_GetSlice
(
PyObject
*
p
,
Py_ssize_t
low
,
Py_ssize_t
high
)
noexcept
{
RELEASE_ASSERT
(
PyTuple_Check
(
p
),
""
);
BoxedTuple
*
t
=
static_cast
<
BoxedTuple
*>
(
p
);
if
(
p
==
NULL
||
!
PyTuple_Check
(
p
))
{
PyErr_BadInternalCall
();
return
NULL
;
}
BoxedTuple
*
t
=
static_cast
<
BoxedTuple
*>
(
p
);
Py_ssize_t
n
=
t
->
size
();
if
(
low
<
0
)
low
=
0
;
...
...
@@ -103,8 +106,8 @@ extern "C" PyObject* PyTuple_GetSlice(PyObject* p, Py_ssize_t low, Py_ssize_t hi
if
(
high
<
low
)
high
=
low
;
if
(
low
==
0
&&
high
==
n
)
return
p
;
if
(
low
==
0
&&
high
==
n
&&
PyTuple_CheckExact
(
p
)
)
return
incref
(
p
)
;
return
BoxedTuple
::
create
(
high
-
low
,
&
t
->
elts
[
low
]);
}
...
...
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