mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Python: CG trace: Proper exception handling
This commit is contained in:
@@ -164,9 +164,10 @@ class CallGraphTracer:
|
|||||||
try:
|
try:
|
||||||
sys.setprofile(self.profilefunc)
|
sys.setprofile(self.profilefunc)
|
||||||
exec(code, globals, locals)
|
exec(code, globals, locals)
|
||||||
# TODO: exception handling?
|
|
||||||
finally:
|
|
||||||
sys.setprofile(None)
|
sys.setprofile(None)
|
||||||
|
except Exception:
|
||||||
|
sys.setprofile(None)
|
||||||
|
LOGGER.info("Exception occurred while running program:", exc_info=True)
|
||||||
|
|
||||||
def profilefunc(self, frame: FrameType, event: str, arg):
|
def profilefunc(self, frame: FrameType, event: str, arg):
|
||||||
# ignore everything until the first call, since that is `exec` from the `run`
|
# ignore everything until the first call, since that is `exec` from the `run`
|
||||||
|
|||||||
Reference in New Issue
Block a user