[issue1666807] Incorrect file path reported by inspect.getabsfile()

Guido van Rossum report at bugs.python.org
Thu Mar 3 11:06:17 EST 2022


Guido van Rossum <guido at python.org> added the comment:

So this bug is referenced when pydevd encounters some problem with 3.11a5+:

https://github.com/fabioz/PyDev.Debugger/issues/213

Since the link to this bug is apparently baked into the error messages printed by pydevd, I am adding this comment to this old, closed bug.

I can't seem to reproduce it. I modernized the reproducer script:

###

import inspect,sys

print('Version info:',sys.version_info)
print()

f1 = inspect.getabsfile(inspect)
f2 = inspect.getabsfile(inspect.iscode)
print('File for `inspect`       :',f1)
print('File for `inspect.iscode`:',f2)
print('Do these match?',f1==f2)
if f1==f2:
    print('OK')
else:
    print('BUG - this is a bug in this version of Python')

###EOF

And the output is:

Version info: sys.version_info(major=3, minor=11, micro=0, releaselevel='alpha', serial=5)

File for `inspect`       : c:\users\gvanrossum\appdata\local\programs\python\python311\lib\inspect.py    
File for `inspect.iscode`: c:\users\gvanrossum\appdata\local\programs\python\python311\lib\inspect.py    
Do these match? True
OK

I tried it with the most recent Python built from source and get the same result:

Version info: sys.version_info(major=3, minor=11, micro=0, releaselevel='alpha', serial=5)

File for `inspect`       : c:\users\gvanrossum\cpython\lib\inspect.py
File for `inspect.iscode`: c:\users\gvanrossum\cpython\lib\inspect.py
Do these match? True
OK


So I wonder if the problem that's currently plagueing pydevd in 3.11 alpha releases is slightly different?

----------
nosy: +gvanrossum

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue1666807>
_______________________________________


More information about the Python-bugs-list mailing list