[PATCH 4 of 4 STABLE] check-code: check os.path.join(*, '') not working correctly with Python 2.7.9

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Apr 22 09:43:59 CDT 2015


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1429713535 -32400
#      Wed Apr 22 23:38:55 2015 +0900
# Branch stable
# Node ID 9d8c1df552f6c7d97c35fdbfae40b8b2c7cf5795
# Parent  f0d4d87183cb8ce88a29863086cc77af52cc81d9
check-code: check os.path.join(*, '') not working correctly with Python 2.7.9

Since Python 2.7.9, "os.path.join(path, '')" doesn't append "os.sep"
for UNC path (see issue4557 for detail).

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -301,6 +301,8 @@ pypats = [
      "missing _() in ui message (use () to hide false-positives)"),
     (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
     (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
+    (r'os\.path\.join\(.*, *(""|\'\')\)',
+     "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
   ],
   # warnings
   [


More information about the Mercurial-devel mailing list