Commit ce233891 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix bare raise

parent 19e1b6d8
...@@ -681,6 +681,9 @@ ExcInfo* getFrameExcInfo() { ...@@ -681,6 +681,9 @@ ExcInfo* getFrameExcInfo() {
FrameInfo* frame_info = getTopFrameInfo(); FrameInfo* frame_info = getTopFrameInfo();
while (frame_info) { while (frame_info) {
if (copy_from_exc)
to_update.push_back(copy_from_exc);
copy_from_exc = &frame_info->exc; copy_from_exc = &frame_info->exc;
if (!cur_exc) if (!cur_exc)
cur_exc = copy_from_exc; cur_exc = copy_from_exc;
...@@ -688,7 +691,6 @@ ExcInfo* getFrameExcInfo() { ...@@ -688,7 +691,6 @@ ExcInfo* getFrameExcInfo() {
if (copy_from_exc->type) if (copy_from_exc->type)
break; break;
to_update.push_back(copy_from_exc);
frame_info = frame_info->back; frame_info = frame_info->back;
}; };
...@@ -700,6 +702,7 @@ ExcInfo* getFrameExcInfo() { ...@@ -700,6 +702,7 @@ ExcInfo* getFrameExcInfo() {
} }
for (auto* ex : to_update) { for (auto* ex : to_update) {
assert(ex != copy_from_exc);
*ex = *copy_from_exc; *ex = *copy_from_exc;
Py_INCREF(ex->type); Py_INCREF(ex->type);
Py_INCREF(ex->value); Py_INCREF(ex->value);
......
...@@ -159,7 +159,6 @@ ExcInfo excInfoForRaise(STOLEN(Box*) type, STOLEN(Box*) value, STOLEN(Box*) tb) ...@@ -159,7 +159,6 @@ ExcInfo excInfoForRaise(STOLEN(Box*) type, STOLEN(Box*) value, STOLEN(Box*) tb)
} }
extern "C" void raise0(ExcInfo* frame_exc_info) { extern "C" void raise0(ExcInfo* frame_exc_info) {
assert(0 && "check refcounting");
updateFrameExcInfoIfNeeded(frame_exc_info); updateFrameExcInfoIfNeeded(frame_exc_info);
assert(frame_exc_info->type); assert(frame_exc_info->type);
...@@ -169,6 +168,10 @@ extern "C" void raise0(ExcInfo* frame_exc_info) { ...@@ -169,6 +168,10 @@ extern "C" void raise0(ExcInfo* frame_exc_info) {
startReraise(); startReraise();
assert(!PyErr_Occurred()); assert(!PyErr_Occurred());
Py_INCREF(frame_exc_info->type);
Py_INCREF(frame_exc_info->value);
Py_INCREF(frame_exc_info->traceback);
throw * frame_exc_info; throw * frame_exc_info;
} }
......
...@@ -285,7 +285,7 @@ extern "C" void setFrameExcInfo(FrameInfo* frame_info, STOLEN(Box*) type, STOLEN ...@@ -285,7 +285,7 @@ extern "C" void setFrameExcInfo(FrameInfo* frame_info, STOLEN(Box*) type, STOLEN
if (old_type) { if (old_type) {
Py_DECREF(old_type); Py_DECREF(old_type);
Py_DECREF(old_value); Py_DECREF(old_value);
Py_DECREF(old_traceback); Py_XDECREF(old_traceback);
} }
} }
......
# expected: reffail
import imp import imp
print len(imp.find_module("os")) print len(imp.find_module("os"))
e = imp.find_module("encodings") e = imp.find_module("encodings")
......
# expected: reffail
import traceback import traceback
import sys import sys
def f(): def f():
......
# expected: reffail
# This is the same as incremental_tb_bjit.py but tests the baseline JIT. # This is the same as incremental_tb_bjit.py but tests the baseline JIT.
try: try:
import __pyston__ import __pyston__
......
# expected: reffail
import sys import sys
import traceback import traceback
......
# expected: reffail
# try-finally support # try-finally support
import sys import sys
......
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