<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>The `Path.resolve()` method behaves differently on Python 3.5 vs Python 3.6.</div><div><br></div><div>The docs <a href="https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve" target="_blank">https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve</a></div><div>fail to mention this.</div><div><br></div><div>This is the behavior on 3.5:</div><div><br></div><div>```</div><div><div>Python 3.5.2 (default, Nov 12 2018, 13:43:14)</div><div>[GCC 5.4.0 20160609] on linux</div><div>Type "help", "copyright", "credits" or "license" for more information.</div><div>>>> from pathlib import Path</div><div>>>> p = Path('/var/../doesnotexist.txt')</div><div>>>> p.resolve()</div><div>Traceback (most recent call last):</div><div>  File "<stdin>", line 1, in <module></div><div>  File "/usr/lib/python3.5/pathlib.py", line 1109, in resolve</div><div>    s = self._flavour.resolve(self)</div><div>  File "/usr/lib/python3.5/pathlib.py", line 330, in resolve</div><div>    return _resolve(base, str(path)) or sep</div><div>  File "/usr/lib/python3.5/pathlib.py", line 315, in _resolve</div><div>    target = accessor.readlink(newpath)</div><div>  File "/usr/lib/python3.5/pathlib.py", line 422, in readlink</div><div>    return os.readlink(path)</div><div>FileNotFoundError: [Errno 2] No such file or directory: '/doesnotexist.txt'</div></div><div>```</div><div><br></div><div>This is the behavior on 3.6:</div><div><br></div><div><div>```</div><div>Python 3.6.6 (default, Sep 12 2018, 18:26:19)</div><div>[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux</div><div>Type "help", "copyright", "credits" or "license" for more information.</div><div>>>> from pathlib import Path</div><div>>>> p = Path('/var/../doesnotexist.txt')</div><div>>>> p.resolve()</div><div>PosixPath('/doesnotexist.txt')</div><div>```</div></div><div><br></div><div>I'd even say this change is a bug in the standard lib (if done on purpose,<br></div><div>it is not listed as a backwards incompatible change in the release notes,</div><div>didn't dig further).</div><div><br></div><div>The docs mention "New in version 3.6: The strict argument". IMO the docs </div><div>should also mention that before 3.5, this method would raise FileNotFound</div><div>by default.</div><div><br></div><div>Thanks and kind regards,</div><div>Laurens Duijvesteijn</div></div></div></div></div></div>