diff --git a/debian/changelog b/debian/changelog
index 8a96a5eea7c31f340376cc24d273586b0c0f0dc6..989a26c0d6c6515b0d2da25ddd3ee9123bdab40c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ python-defaults (2.6.6-11) UNRELEASED; urgency=low
     - replace a file with a symlink also if there's a matching one in
       pyshared directory already
     - add support for DH_OPTIONS env. variable
+    - fix checking shebangs in private directories (executable bit wasn't
+      checked correctly)
   * pycompile:
     - --exclude now works with private dirs
     - use /usr/bin/pythonX.Y rather than pythonX.Y (to avoid /usr/local
diff --git a/dh_python2 b/dh_python2
index dac6fa4cb6d2a320d10cd0ae5225b588cbc8e107..d760290629ff4b0b608ee68ad874e95845e026ba 100755
--- a/dh_python2
+++ b/dh_python2
@@ -373,7 +373,7 @@ def scan(package, dname=None):
 
             elif private_dir:
                 mode = os.stat(join(root, fn))[ST_MODE]
-                if mode is S_IXUSR or mode is S_IXGRP or mode is S_IXOTH:
+                if mode & S_IXUSR or mode & S_IXGRP or mode & S_IXOTH:
                     res = shebang2pyver(join(root, fn))
                     if res:
                         r['private_dirs'].setdefault(private_dir, {})\