Author lunixbochs2
Recipients ammar2, christian.heimes, lunixbochs2, steve.dower, vstinner
Date 2021-01-09.02:25:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I'm definitely not proposing to hook all of object.__getattr__, as my intuition says that would be very slow. I simply refer to "object.__getattr__" as the event name used by a couple of rare event audit hooks. This is how getting __code__ is emitted:

However, there's not much point in the sys._getframe and func.__code__ family of audit hooks right now as tracebacks expose the same information (and may even do so accidentally). I am personally interested in these hooks for non sandbox reasons in a production application that cares about perf, FWIW.

I think this would be implemented by extending the traceback object's getters to include tb_code and tb_frame:

I project it won't have any noticeable perf impact (especially if the audit hook is written in C), as most reasons to inspect a traceback object will be exceptional and not in critical paths.

I'd be happy to write a proposed patch if that would help.
Date User Action Args
2021-01-09 02:25:37lunixbochs2setrecipients: + lunixbochs2, vstinner, christian.heimes, steve.dower, ammar2
2021-01-09 02:25:37lunixbochs2setmessageid: <>
2021-01-09 02:25:37lunixbochs2linkissue42800 messages
2021-01-09 02:25:36lunixbochs2create