Hello,

On Mon, 22 Feb 2021 19:47:04 +0000
Barry Scott <ba...@barrys-emacs.org> wrote:

> > 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? 

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__
> <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
> 



-- 
Best regards,
 Paul                          mailto:pmis...@gmail.com
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/FB65TFWGZEBENGT3W2X7RBPY63RINU25/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to