You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(editor's note: the description below indicates that realpath() is unaffected, but that's not correct - see comment)
If a file descriptor is created in /proc/self/fd/ and then passed to pathlib.Path, the resolve() method produces a result which is no longer a real and valid path to the file.
MRE, including os.path.realpath for comparison:
This can occur easily if another program uses the /proc/self/fd/ mechanism to pass temporary files to a python application.
For example, using ZSH on linux:
I looked at pathlib.py and in 3.11 it looks like it's primarily relying on realpath, so I'm not clear on where or how the discrepancy gets introduced. I'm sure I don't understand something about pathlib which explains.
Bug report
(editor's note: the description below indicates that
realpath()is unaffected, but that's not correct - see comment)If a file descriptor is created in
/proc/self/fd/and then passed topathlib.Path, theresolve()method produces a result which is no longer a real and valid path to the file.MRE, including
os.path.realpathfor comparison:This can occur easily if another program uses the
/proc/self/fd/mechanism to pass temporary files to a python application.For example, using ZSH on linux:
I looked at
pathlib.pyand in 3.11 it looks like it's primarily relying onrealpath, so I'm not clear on where or how the discrepancy gets introduced. I'm sure I don't understand something aboutpathlibwhich explains.Your environment