[New-bugs-announce] [issue30639] inspect.getfile(obj) calls object repr on failure

Thomas Kluyver report at bugs.python.org
Mon Jun 12 09:54:06 EDT 2017


New submission from Thomas Kluyver:

This came up in IPython & Jedi: several functions in inspect end up calling getfile(). If the object is something for which it can't find the source file, it throws an error, the message for which contains the object's repr.

This is problematic for us because for some objects the repr may be expensive to calculate (e.g. data tables where the repr forms primary output, not just debugging information). In some cases, it could also throw another error.

I plan to make a PR for this, but I'm opening an issue so I've got a bpo number.

https://github.com/ipython/ipython/issues/10493
https://github.com/davidhalter/jedi/issues/919

----------
components: Library (Lib)
messages: 295782
nosy: takluyver
priority: normal
severity: normal
status: open
title: inspect.getfile(obj) calls object repr on failure
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30639>
_______________________________________


More information about the New-bugs-announce mailing list