Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@isidentical
Created July 11, 2019 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isidentical/0e214006eeace655dba2837ee8e11be0 to your computer and use it in GitHub Desktop.
Save isidentical/0e214006eeace655dba2837ee8e11be0 to your computer and use it in GitHub Desktop.
__import__("sys").settrace(lambda frame, event, arg: (setattr(frame, "f_lineno", (getattr(frame, "f_lineno") + tuple(__import__("dis").Bytecode(frame.f_code))[(frame.f_lasti // 2) + 1].argval)) if event == "line" and tuple(__import__("dis").Bytecode(frame.f_code))[(frame.f_lasti // 2)].argval == "goto" else None) or (lambda frame, event, arg: (setattr(frame, "f_lineno", (getattr(frame, "f_lineno") + tuple(__import__("dis").Bytecode(frame.f_code))[(frame.f_lasti // 2) + 1].argval)) if event == "line" and tuple(__import__("dis").Bytecode(frame.f_code))[(frame.f_lasti // 2)].argval == "goto" else None)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment