Skip to content

Commit beac6c3

Browse files
committed
Merge branch 'unfix-system-exit'
2 parents aeb55b1 + e96a260 commit beac6c3

File tree

7 files changed

+187
-96
lines changed

7 files changed

+187
-96
lines changed

src/compile.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ Compiler.prototype.outputSuspensionHelpers = function (unit) {
932932
}
933933
}
934934

935-
output += "try { $ret=susp.child.resume(); } catch(err) { if (!(err instanceof Sk.builtin.Exception)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+this.filename+"'}); if($exc.length>0) { $err=err; $blk=$exc.pop(); } else { throw err; } }" +
935+
output += "try { $ret=susp.child.resume(); } catch(err) { if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+this.filename+"'}); if($exc.length>0) { $err=err; $blk=$exc.pop(); } else { throw err; } }" +
936936
"};";
937937

938938
output += "var $saveSuspension = function(child, filename, lineno, colno) {" +
@@ -1591,7 +1591,7 @@ Compiler.prototype.buildcodeobj = function (n, coname, decorator_list, args, cal
15911591
this.u.switchCode = "while(true){try{"
15921592
this.u.switchCode += this.outputInterruptTest();
15931593
this.u.switchCode += "switch($blk){";
1594-
this.u.suffixCode = "} }catch(err){ if (!(err instanceof Sk.builtin.Exception)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} }});";
1594+
this.u.suffixCode = "} }catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} }});";
15951595

15961596
//
15971597
// jump back to the handler so it can do the main actual work of the
@@ -2230,8 +2230,6 @@ Compiler.prototype.cmod = function (mod) {
22302230
this.u.varDeclsCode += "if (typeof Sk.lastYield === 'undefined') {Sk.lastYield = Date.now()}";
22312231
}
22322232

2233-
this.u.varDeclsCode += "try {";
2234-
22352233
this.u.varDeclsCode += "if ("+modf+".wakingSuspension!==undefined) { $wakeFromSuspension(); }" +
22362234
"if (Sk.retainGlobals) {" +
22372235
" if (Sk.globals) { $gbl = Sk.globals; Sk.globals = $gbl; $loc = $gbl; }" +
@@ -2250,8 +2248,8 @@ Compiler.prototype.cmod = function (mod) {
22502248
this.u.switchCode = "while(true){try{";
22512249
this.u.switchCode += this.outputInterruptTest();
22522250
this.u.switchCode += "switch($blk){";
2253-
this.u.suffixCode = "} }catch(err){ if (!(err instanceof Sk.builtin.Exception)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} }" +
2254-
" }catch(err){ if (err instanceof Sk.builtin.SystemExit && !Sk.throwSystemExit) { Sk.misceval.print_(err.toString() + '\\n'); return $loc; } else { throw err; } } });";
2251+
this.u.suffixCode = "}"
2252+
this.u.suffixCode += "}catch(err){ if (!(err instanceof Sk.builtin.BaseException)) { err = new Sk.builtin.ExternalError(err); } err.traceback.push({lineno: currLineNo, colno: currColNo, filename: '"+this.filename+"'}); if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} } });";
22552253

22562254
// Note - this change may need to be adjusted for all the other instances of
22572255
// switchCode and suffixCode in this file. Not knowing how to test those

src/env.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ Sk.configure = function (options) {
4646
Sk.inputfun = options["inputfun"] || Sk.inputfun;
4747
goog.asserts.assert(typeof Sk.inputfun === "function");
4848

49-
Sk.throwSystemExit = options["systemexit"] || false;
50-
goog.asserts.assert(typeof Sk.throwSystemExit === "boolean");
51-
5249
Sk.retainGlobals = options["retainglobals"] || false;
53-
goog.asserts.assert(typeof Sk.throwSystemExit === "boolean");
50+
goog.asserts.assert(typeof Sk.retainGlobals === "boolean");
5451

5552
Sk.debugging = options["debugging"] || false;
5653
goog.asserts.assert(typeof Sk.debugging === "boolean");

0 commit comments

Comments
 (0)