Commit c429f19d authored by Marius Wachtler's avatar Marius Wachtler

Merge pull request #1185 from undingen/sqlalchemy_ref

enable sqlalchemy_smalltest
parents 88070844 1257cf68
...@@ -85,6 +85,9 @@ void RefcountTracker::refConsumed(llvm::Value* v, llvm::Instruction* inst) { ...@@ -85,6 +85,9 @@ void RefcountTracker::refConsumed(llvm::Value* v, llvm::Instruction* inst) {
} }
void RefcountTracker::refUsed(llvm::Value* v, llvm::Instruction* inst) { void RefcountTracker::refUsed(llvm::Value* v, llvm::Instruction* inst) {
if (llvm::isa<UndefValue>(v))
return;
assert(this->vars[v].reftype != RefType::UNKNOWN); assert(this->vars[v].reftype != RefType::UNKNOWN);
this->refs_used[inst].push_back(v); this->refs_used[inst].push_back(v);
......
...@@ -545,14 +545,17 @@ public: ...@@ -545,14 +545,17 @@ public:
stat.log(); stat.log();
} }
std::tuple<FrameInfo*, ExcInfo, PythonStackExtractor> pause() { std::tuple<FrameInfo*, ExcInfo, PythonStackExtractor, bool> pause() {
static StatCounter stat("us_unwind_session"); static StatCounter stat("us_unwind_session");
stat.log(t.end()); stat.log(t.end());
return std::make_tuple(std::move(prev_frame_info), std::move(exc_info), std::move(pystack_extractor)); bool is_reraise = getIsReraiseFlag();
getIsReraiseFlag() = false;
return std::make_tuple(std::move(prev_frame_info), std::move(exc_info), std::move(pystack_extractor),
is_reraise);
} }
void resume(std::tuple<FrameInfo*, ExcInfo, PythonStackExtractor>&& state) { void resume(std::tuple<FrameInfo*, ExcInfo, PythonStackExtractor, bool>&& state) {
std::tie(prev_frame_info, exc_info, pystack_extractor) = state; std::tie(prev_frame_info, exc_info, pystack_extractor, getIsReraiseFlag()) = state;
t.restart(); t.restart();
} }
...@@ -620,11 +623,12 @@ public: ...@@ -620,11 +623,12 @@ public:
// make sure that our libunwind based python frame handling and the manual one are the same. // make sure that our libunwind based python frame handling and the manual one are the same.
assert(prev_frame_info == getTopFrameInfo()); assert(prev_frame_info == getTopFrameInfo());
if (exceptionAtLineCheck()) { if (!getIsReraiseFlag()) {
// TODO: shouldn't fetch this multiple times? // TODO: shouldn't fetch this multiple times?
frame_iter.getCurrentStatement()->cxx_exception_count++; frame_iter.getCurrentStatement()->cxx_exception_count++;
exceptionAtLine(&exc_info.traceback); exceptionAtLine(&exc_info.traceback);
} } else
getIsReraiseFlag() = false;
} }
} }
}; };
......
...@@ -59,8 +59,10 @@ void unwindingThroughFrame(PythonUnwindSession* unwind_session, unw_cursor_t* cu ...@@ -59,8 +59,10 @@ void unwindingThroughFrame(PythonUnwindSession* unwind_session, unw_cursor_t* cu
// TODO move these to exceptions.h // TODO move these to exceptions.h
void logException(ExcInfo* exc_info); void logException(ExcInfo* exc_info);
void startReraise(); bool& getIsReraiseFlag();
bool exceptionAtLineCheck(); inline void startReraise() {
getIsReraiseFlag() = true;
}
void exceptionAtLine(Box** traceback); void exceptionAtLine(Box** traceback);
void caughtCxxException(ExcInfo* exc_info); void caughtCxxException(ExcInfo* exc_info);
extern "C" void caughtCapiException(); extern "C" void caughtCapiException();
......
...@@ -299,30 +299,20 @@ void caughtCxxException(ExcInfo* exc_info) { ...@@ -299,30 +299,20 @@ void caughtCxxException(ExcInfo* exc_info) {
exceptionAtLine(&exc_info->traceback); exceptionAtLine(&exc_info->traceback);
} }
struct ExcState { struct ExcState {
bool is_reraise; bool is_reraise;
constexpr ExcState() : is_reraise(false) {} constexpr ExcState() : is_reraise(false) {}
} static __thread exc_state; } static __thread exc_state;
bool exceptionAtLineCheck() { bool& getIsReraiseFlag() {
if (exc_state.is_reraise) { return exc_state.is_reraise;
exc_state.is_reraise = false;
return false;
}
return true;
} }
void exceptionAtLine(Box** traceback) { void exceptionAtLine(Box** traceback) {
if (exceptionAtLineCheck()) { if (!getIsReraiseFlag())
PyTraceBack_Here_Tb((struct _frame*)getFrame((FrameInfo*)cur_thread_state.frame_info), PyTraceBack_Here_Tb((struct _frame*)getFrame((FrameInfo*)cur_thread_state.frame_info),
(PyTracebackObject**)traceback); (PyTracebackObject**)traceback);
} else
} getIsReraiseFlag() = false;
void startReraise() {
assert(!exc_state.is_reraise);
exc_state.is_reraise = true;
} }
} }
# expected: reffail
import gc import gc
import os import os
import sys import sys
...@@ -192,21 +191,22 @@ MODULES_TO_TEST = [ ...@@ -192,21 +191,22 @@ MODULES_TO_TEST = [
'test.sql.test_rowcount', 'test.sql.test_rowcount',
'test.sql.test_selectable', 'test.sql.test_selectable',
'test.sql.test_text', 'test.sql.test_text',
'test.sql.test_unicode',
'test.aaa_profiling.test_resultset',
'test.dialect.test_sqlite',
'test.orm.test_dynamic',
'test.orm.test_merge',
'test.orm.test_relationships',
'test.orm.test_versioning',
'test.sql.test_compiler',
] ]
FAILING = [ FAILING = [
# 'test.aaa_profiling.test_memusage', # Wants gc.get_objects
# 'test.aaa_profiling.test_resultset', # Wants sys.getrefcount
# 'test.dialect.test_sqlite', # ascii codec can't encode
# 'test.ext.test_extendedattr', # does `locals()[42] = 99` in a classdef to prove it can. maybe we could say is_pypy to avoid it. # 'test.ext.test_extendedattr', # does `locals()[42] = 99` in a classdef to prove it can. maybe we could say is_pypy to avoid it.
# 'test.orm.test_dynamic', # not sure; things end up being put in tuples # 'test.aaa_profiling.test_memusage', # assert(obj->cls != closure_cls);
# 'test.orm.test_merge', # needs PyObject_AsWriteBuffer
# 'test.orm.test_relationships', # not sure; things end up being put in tuples
# 'test.orm.test_session', # unclear # 'test.orm.test_session', # unclear
# 'test.orm.test_versioning', # crashes in the uuid module with an AttributeError from ctypes
# 'test.sql.test_compiler', # unclear
# 'test.sql.test_quote', # unclear # 'test.sql.test_quote', # unclear
# 'test.sql.test_unicode', # "ascii codec can't encod character"
] ]
# MODULES_TO_TEST = ['test.orm.test_bulk'] # MODULES_TO_TEST = ['test.orm.test_bulk']
......
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