> On 22 Feb 2021, at 10:15, Paul Sokolovsky <pmis...@gmail.com> wrote: > > It looks like: > > Traceback (most recent call last): > File "pseudoc_tool.py", line 91, in <module> > File ".../xforms.py", line 25, in print > TypeError: unexpected keyword argument 'noann' > > - that makes clear that it's "print" function of "xforms.py" module, > line 25, which got an unexpected keyword argument.
You are proposing to fake a stack frame that I have to know is not a stack frame but is in fact the location of the function in the exception? I'm -1 on that as its confusing. Having checked that its python code and not a C extension function you could use the info in fn.__code__ to get the filename and line of where the function is defined and put that info into the exception. Example of the info: | >>> os.path.join.__code__ <code object join at 0x7fb19aebc7c0, file "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/posixpath.py", line 71> I use repr(fn.__code__) a lot when debugging complex code. Barry
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/YJ3RNTHGZWJ2DG2T5HFGXKTKFYN3CGAN/ Code of Conduct: http://python.org/psf/codeofconduct/