Commit 6d52bc8b authored by Kevin Modzelewski's avatar Kevin Modzelewski

More refcounting fixes

parent 97f3f482
...@@ -53,9 +53,7 @@ PyTypeObject PyTraceBack_Type = { ...@@ -53,9 +53,7 @@ PyTypeObject PyTraceBack_Type = {
"traceback", "traceback",
sizeof(PyTracebackObject), sizeof(PyTracebackObject),
0, 0,
// Pyston change: (destructor)tb_dealloc, /*tp_dealloc*/
//(destructor)tb_dealloc, /*tp_dealloc*/
(destructor)0,
0, /*tp_print*/ 0, /*tp_print*/
0, /*tp_getattr*/ 0, /*tp_getattr*/
0, /*tp_setattr*/ 0, /*tp_setattr*/
...@@ -126,8 +124,10 @@ PyTraceBack_Here(PyFrameObject *frame) ...@@ -126,8 +124,10 @@ PyTraceBack_Here(PyFrameObject *frame)
int int
PyTraceBack_Here_Tb(PyFrameObject *frame, PyTracebackObject** tb) PyTraceBack_Here_Tb(PyFrameObject *frame, PyTracebackObject** tb)
{ {
if ((PyObject*)*tb == Py_None) if ((PyObject*)*tb == Py_None) {
Py_DECREF(*tb);
*tb = NULL; *tb = NULL;
}
*tb = newtracebackobject(*tb, frame); *tb = newtracebackobject(*tb, frame);
if (*tb == NULL) if (*tb == NULL)
return -1; return -1;
......
...@@ -6,3 +6,6 @@ skip file /usr/include/c++/4.9/bits/stl_vector.h ...@@ -6,3 +6,6 @@ skip file /usr/include/c++/4.9/bits/stl_vector.h
skip pyston::ArgPassSpec::ArgPassSpec(int, int, bool, bool) skip pyston::ArgPassSpec::ArgPassSpec(int, int, bool, bool)
skip pyston::InternedString::getBox() const skip pyston::InternedString::getBox() const
skip pyston::BoxedString::s() const skip pyston::BoxedString::s() const
skip pyston::autoDecref<pyston::Box, false>(pyston::Box*)
skip pyston::autoDecref<pyston::Box, true>(pyston::Box*)
...@@ -43,8 +43,8 @@ void raiseSyntaxError(const char* msg, int lineno, int col_offset, llvm::StringR ...@@ -43,8 +43,8 @@ void raiseSyntaxError(const char* msg, int lineno, int col_offset, llvm::StringR
loc = Py_None; loc = Py_None;
} }
auto args = BoxedTuple::create({ boxString(file), boxInt(lineno), None, loc }); auto args = BoxedTuple::create({ autoDecref(boxString(file)), autoDecref(boxInt(lineno)), None, loc });
Box* exc = runtimeCall(SyntaxError, ArgPassSpec(2), boxString(msg), args, NULL, NULL, NULL); Box* exc = runtimeCall(SyntaxError, ArgPassSpec(2), autoDecref(boxString(msg)), args, NULL, NULL, NULL);
assert(!PyErr_Occurred()); assert(!PyErr_Occurred());
throw ExcInfo(exc->cls, exc, None); throw ExcInfo(exc->cls, exc, None);
} else { } else {
...@@ -166,6 +166,7 @@ extern "C" void raise0_capi(ExcInfo* frame_exc_info) noexcept { ...@@ -166,6 +166,7 @@ extern "C" void raise0_capi(ExcInfo* frame_exc_info) noexcept {
// TODO need to clean up when we call normalize, do_raise, etc // TODO need to clean up when we call normalize, do_raise, etc
if (frame_exc_info->type == None) { if (frame_exc_info->type == None) {
assert(0 && "check refcounting");
frame_exc_info->type = TypeError; frame_exc_info->type = TypeError;
frame_exc_info->value frame_exc_info->value
= boxString("exceptions must be old-style classes or derived from BaseException, not NoneType"); = boxString("exceptions must be old-style classes or derived from BaseException, not NoneType");
......
...@@ -221,7 +221,7 @@ extern "C" void deinitFrame(FrameInfo* frame_info) { ...@@ -221,7 +221,7 @@ extern "C" void deinitFrame(FrameInfo* frame_info) {
extern "C" int PyFrame_GetLineNumber(PyFrameObject* _f) noexcept { extern "C" int PyFrame_GetLineNumber(PyFrameObject* _f) noexcept {
BoxedInt* lineno = (BoxedInt*)BoxedFrame::lineno((Box*)_f, NULL); BoxedInt* lineno = (BoxedInt*)BoxedFrame::lineno((Box*)_f, NULL);
return lineno->n; return autoDecref(lineno)->n;
} }
extern "C" PyObject* PyFrame_GetGlobals(PyFrameObject* f) noexcept { extern "C" PyObject* PyFrame_GetGlobals(PyFrameObject* f) noexcept {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment