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
158465fc
Commit
158465fc
authored
Nov 18, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More refcount fixes
parent
42014a09
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
10 deletions
+14
-10
from_cpython/Include/pyerrors.h
from_cpython/Include/pyerrors.h
+1
-1
src/runtime/capi.cpp
src/runtime/capi.cpp
+1
-3
src/runtime/dict.cpp
src/runtime/dict.cpp
+11
-5
src/runtime/types.h
src/runtime/types.h
+1
-1
No files found.
from_cpython/Include/pyerrors.h
View file @
158465fc
...
...
@@ -93,7 +93,7 @@ PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC
(
PyObject
*
)
PyErr_Occurred
(
void
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
void
)
PyErr_Clear
(
void
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
void
)
PyErr_Fetch
(
PyObject
**
,
PyObject
**
,
PyObject
**
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
void
)
PyErr_Restore
(
PyObject
*
,
PyObject
*
,
PyObject
*
)
PYSTON_NOEXCEPT
;
PyAPI_FUNC
(
void
)
PyErr_Restore
(
STOLEN
(
PyObject
*
),
STOLEN
(
PyObject
*
),
STOLEN
(
PyObject
*
)
)
PYSTON_NOEXCEPT
;
// Pyton change: This functions are normally only available in CPython >= 3.3 and PyPy but Cython can use them.
PyAPI_FUNC
(
void
)
PyErr_GetExcInfo
(
PyObject
**
ptype
,
PyObject
**
pvalue
,
PyObject
**
ptraceback
)
PYSTON_NOEXCEPT
;
...
...
src/runtime/capi.cpp
View file @
158465fc
...
...
@@ -779,9 +779,7 @@ finally:
}
void
setCAPIException
(
const
ExcInfo
&
e
)
{
cur_thread_state
.
curexc_type
=
e
.
type
;
cur_thread_state
.
curexc_value
=
e
.
value
;
cur_thread_state
.
curexc_traceback
=
e
.
traceback
;
PyErr_Restore
(
e
.
type
,
e
.
value
,
e
.
traceback
);
}
void
ensureCAPIExceptionSet
()
{
...
...
src/runtime/dict.cpp
View file @
158465fc
...
...
@@ -405,14 +405,18 @@ extern "C" PyObject* PyDict_GetItemString(PyObject* dict, const char* key) noexc
Box
*
dictSetitem
(
BoxedDict
*
self
,
Box
*
k
,
Box
*
v
)
{
Box
*&
pos
=
self
->
d
[
k
];
Py_INCREF
(
v
);
if
(
pos
!=
NULL
)
{
Box
*
old
=
pos
;
pos
=
v
;
if
(
old
)
{
Py_DECREF
(
old
);
}
else
{
pos
=
v
;
Py_INCREF
(
k
)
;
}
return
None
;
Py_RETURN_NONE
;
}
Box
*
dictDelitem
(
BoxedDict
*
self
,
Box
*
k
)
{
...
...
@@ -420,6 +424,7 @@ Box* dictDelitem(BoxedDict* self, Box* k) {
raiseExcHelper
(
TypeError
,
"descriptor '__delitem__' requires a 'dict' object but received a '%s'"
,
getTypeName
(
self
));
assert
(
0
&&
"check refcounting"
);
auto
it
=
self
->
d
.
find
(
k
);
if
(
it
==
self
->
d
.
end
())
{
raiseExcHelper
(
KeyError
,
k
);
...
...
@@ -427,7 +432,7 @@ Box* dictDelitem(BoxedDict* self, Box* k) {
self
->
d
.
erase
(
it
);
return
None
;
Py_RETURN_NONE
;
}
// Analoguous to CPython's, used for sq_ slots.
...
...
@@ -440,6 +445,7 @@ static int dict_ass_sub(PyDictObject* mp, PyObject* v, PyObject* w) noexcept {
res
=
dictSetitem
((
BoxedDict
*
)
mp
,
v
,
w
);
}
assert
(
res
==
None
);
Py_DECREF
(
res
);
}
catch
(
ExcInfo
e
)
{
setCAPIException
(
e
);
return
-
1
;
...
...
src/runtime/types.h
View file @
158465fc
...
...
@@ -170,7 +170,7 @@ void checkAndThrowCAPIException();
void
throwCAPIException
()
__attribute__
((
noreturn
));
void
ensureCAPIExceptionSet
();
struct
ExcInfo
;
void
setCAPIException
(
const
ExcInfo
&
e
);
void
setCAPIException
(
STOLEN
(
const
ExcInfo
&
)
e
);
// Finalizer-related
void
dealloc_null
(
Box
*
box
);
...
...
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