Hello,
On Mon, 22 Feb 2021 19:47:04 +
Barry Scott wrote:
> > On 22 Feb 2021, at 10:15, Paul Sokolovsky wrote:
> >
> > It looks like:
> >
> > Traceback (most recent call last):
> > File "pseudoc_tool.py", line 91, in
> > 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?
No, I'm proposing to stop faking lack of the last stack frame due to
CPython's implementation details. See the original message for more
info.
> 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.
Could use crystal ball, even.
>
> Example of the info:
> | >>> os.path.join.__code__
> "/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
>
--
Best regards,
Paul mailto:pmis...@gmail.com
___
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/FB65TFWGZEBENGT3W2X7RBPY63RINU25/
Code of Conduct: http://python.org/psf/codeofconduct/