On 4 May 2017 at 18:59, Nathaniel Smith <[email protected]> wrote: > Hi all, > > Currently, given a frame object (e.g. from sys._getframe or > inspect.getouterframes), there's no way to get back to the function > object that created it. This creates an obstacle for various sorts of > introspection. In particular, in the unusual but real situation where > you need to "mark" a function in a way that can be detected via stack > introspection, then the natural way to do that – attaching an > attribute to the function object – doesn't work. Instead, you have to > mangle the frame's locals.
Eric Snow put together a mostly working patch for this quite some time ago: http://bugs.python.org/issue12857 It needs some naming adjustments to better account for generators and coroutines, and rebasing against a recent version of the tree, but I don't see any major barriers to getting the change made other than someone actually working through all the nitty gritty details of finalising the patch. Cheers, Nick. -- Nick Coghlan | [email protected] | Brisbane, Australia _______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
