Commit 24a56544 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix traceback handling on reraise (aka raise3)

parent 3e4896eb
...@@ -26,6 +26,12 @@ namespace pyston { ...@@ -26,6 +26,12 @@ namespace pyston {
#ifndef NDEBUG #ifndef NDEBUG
int AST::next_lineno = 100000; int AST::next_lineno = 100000;
AST::AST(AST_TYPE::AST_TYPE type) : type(type), lineno(++next_lineno) {
//if (lineno == 100644)
//raise(SIGTRAP);
}
#endif #endif
llvm::StringRef getOpSymbol(int op_type) { llvm::StringRef getOpSymbol(int op_type) {
......
...@@ -149,12 +149,12 @@ public: ...@@ -149,12 +149,12 @@ public:
#ifndef NDEBUG #ifndef NDEBUG
private: private:
// In debug mode, initialize lineno to something unique, so that if we see something ridiculous
// appear in the traceback, we can isolate the allocation which created it.
static int next_lineno; static int next_lineno;
public: public:
// In debug mode, initialize lineno to something unique, so that if we see something ridiculous AST(AST_TYPE::AST_TYPE type);
// appear in the traceback, we can isolate the allocation which created it.
AST(AST_TYPE::AST_TYPE type) : type(type), lineno(++next_lineno) {}
#else #else
AST(AST_TYPE::AST_TYPE type) : type(type) {} AST(AST_TYPE::AST_TYPE type) : type(type) {}
#endif #endif
......
...@@ -247,7 +247,8 @@ void raise3(Box* arg0, Box* arg1, Box* arg2) { ...@@ -247,7 +247,8 @@ void raise3(Box* arg0, Box* arg1, Box* arg2) {
exc_obj = exceptionNew2(c, arg1); exc_obj = exceptionNew2(c, arg1);
else else
exc_obj = exceptionNew1(c); exc_obj = exceptionNew1(c);
raiseExc(exc_obj);
raiseRaw(ExcInfo(c, exc_obj, arg2));
} else { } else {
raiseExcHelper(TypeError, "exceptions must be old-style classes or derived from BaseException, not %s", raiseExcHelper(TypeError, "exceptions must be old-style classes or derived from BaseException, not %s",
getTypeName(arg0)->c_str()); getTypeName(arg0)->c_str());
...@@ -257,9 +258,7 @@ void raise3(Box* arg0, Box* arg1, Box* arg2) { ...@@ -257,9 +258,7 @@ void raise3(Box* arg0, Box* arg1, Box* arg2) {
if (arg1 != None) if (arg1 != None)
raiseExcHelper(TypeError, "instance exception may not have a separate value"); raiseExcHelper(TypeError, "instance exception may not have a separate value");
// TODO: should only allow throwing of old-style classes or things derived raiseRaw(ExcInfo(arg0, arg1, arg2));
// from BaseException:
raiseExc(arg0);
} }
void raiseExcHelper(BoxedClass* cls, const char* msg, ...) { void raiseExcHelper(BoxedClass* cls, const char* msg, ...) {
......
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