Skip to content

Commit b70a575

Browse files
authored
Merge pull request #51 from myd7349/fix-issue-50
fix #50
2 parents c8a9cd8 + 96d7042 commit b70a575

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

PyStand.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,12 @@ const char *init_script =
341341
" fp = os.fdopen(fd, 'w')\n"
342342
" sys.stdout = fp\n"
343343
" sys.stderr = fp\n"
344+
" attached = True\n"
344345
"except Exception as e:\n"
345346
" fp = open(os.devnull, 'w')\n"
346347
" sys.stdout = fp\n"
347348
" sys.stderr = fp\n"
349+
" attached = False\n"
348350
#endif
349351
"for n in ['.', 'lib', 'site-packages']:\n"
350352
" test = os.path.abspath(os.path.join(PYSTAND_HOME, n))\n"
@@ -358,7 +360,9 @@ const char *init_script =
358360
"try:\n"
359361
" code = compile(text, PYSTAND_SCRIPT, 'exec')\n"
360362
" exec(code, environ)\n"
361-
"except:\n"
363+
"except Exception:\n"
364+
" if attached:\n"
365+
" raise\n"
362366
" import traceback, io\n"
363367
" sio = io.StringIO()\n"
364368
" traceback.print_exc(file = sio)\n"

0 commit comments

Comments
 (0)