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

Change from "bool is_unwinding" to "int num_uncaught"

Since the unwinder now supports throwing exceptions inside destructors (as long
as they don't propagate out).

This is the same change that C++17 makes, from "bool uncaught_exception()" to
"int uncaught_exceptions()".
parent ef322709
......@@ -26,8 +26,6 @@ class AutoFileTests(unittest.TestCase):
self.f.close()
os.remove(TESTFN)
# pyston change:
@unittest.skip("does not work with GC")
def testWeakRefs(self):
# verify weak references
p = proxy(self.f)
......
......@@ -89,15 +89,10 @@ static thread_local Timer per_thread_cleanup_timer(-1);
#ifndef NDEBUG
static __thread bool in_cleanup_code = false;
#endif
static __thread bool is_unwinding = false;
static __thread int num_uncaught_exceptions = 0;
bool isUnwinding() {
return is_unwinding;
}
void setUnwinding(bool b) {
assert(!in_cleanup_code);
is_unwinding = b;
return num_uncaught_exceptions > 0;
}
extern "C" {
......@@ -574,7 +569,7 @@ static inline void unwind_loop(ExcInfo* exc_data) {
#if STAT_TIMERS
pyston::StatTimer::finishOverride();
#endif
pyston::is_unwinding = false;
pyston::num_uncaught_exceptions--;
}
static_assert(THREADING_USE_GIL, "have to make the unwind session usage in this file thread safe!");
// there is a python unwinding implementation detail leaked
......@@ -692,9 +687,7 @@ extern "C" HIDDEN void __cxa_throw(void* exc_obj, std::type_info* tinfo, void (*
pyston::ExcInfo* exc_data = (pyston::ExcInfo*)exc_obj;
checkExcInfo(exc_data);
ASSERT(!pyston::is_unwinding, "We don't support throwing exceptions in destructors!");
pyston::is_unwinding = true;
pyston::num_uncaught_exceptions++;
#if STAT_TIMERS
pyston::StatTimer::overrideCounter(unwinding_stattimer);
#endif
......
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