This is an archive of the discontinued Mercurial Phabricator instance.

hg: make _local() behave consistently on Python 3.8 (issue6287)
ClosedPublic

Authored by durin42 on Mar 18 2020, 3:20 PM.

Details

Summary

Python 3.8 makes os.path.isfile quietly eat "path invalid" errors and
return False instead of allowing the exception to propagate. Given
that this is a change from 2018 (sigh) and it's mentioned in the
release notes (double sigh) we're definitely too late to complain to
Python about the behavior change, so open-code part of
os.path.isfile() in this method so we can catch invalid-path errors
and handle them appropriately. I confirmed that posixpath and ntpath
both delegate to genericpath, which uses os.stat() under the covers.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.Mar 18 2020, 3:20 PM
durin42 retitled this revision from hg: make _local() behave consistently on Python 3.8 to hg: make _local() behave consistently on Python 3.8 (issue6287).Mar 18 2020, 3:26 PM
durin42 updated this revision to Diff 20827.
pulkit accepted this revision.Mar 19 2020, 4:06 AM
This revision is now accepted and ready to land.Mar 19 2020, 4:06 AM