Skip to content

Commit d693ef0

Browse files
authored
Disable a hack that causes breakage on Python 3.8 (swiftlang#33137)
Hacking sys.modules here was added unconditionally to fix an import problem on Windows (with Python 2.7???). This script works fine on Python 2.7 on macOS either with or without this hack. This script breaks badly on Python 3.8 on macOS with this hack, so I've disabled it here for all Python 3.
1 parent 01f4ee6 commit d693ef0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

utils/update-checkout

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import sys
55
import update_checkout
66

77
if __name__ == '__main__':
8-
# The internal Windows implementation tries to import the current module using
9-
# sys.modules[__name__]. This file (called 'update-checkout') is not a valid
10-
# Python module name, as it contains a '-' and doesn't end with '.py'. This
11-
# results in errors running update-checkout on Windows:'ImportError: No module
12-
# named update-checkout'.
13-
# As such, we need to manually set sys.modules[__name__] to a valid module
14-
# identifier to work around these errors.
15-
sys.modules[__name__] = sys.modules['update_checkout']
8+
# This line was added in dfe3af81b2 to address an importing issue on
9+
# Windows. It causes this script to break badly when used with
10+
# Python 3.8 on macOS. Disabling for all Python 3 until someone
11+
# can help sort out what's really needed for Windows:
12+
if sys.version_info.major < 3:
13+
sys.modules[__name__] = sys.modules['update_checkout']
1614

1715
update_checkout.main()

0 commit comments

Comments
 (0)