Path: blob/main/python/cpython/src/patches/06-platform.patch
1067 views
The patch below changes the behavior of the platform module slightly to not1use uname -p on the host, in the case of wasm32, since that makes2no sense for our use case. Also, we change the corresponding unit test as well.34--- native/Lib/platform.py 2022-08-05 07:45:18.000000000 -07005+++ wasm/Lib/platform.py 2022-09-12 20:53:45.000000000 -07006@@ -663,6 +663,9 @@7binary defaults from _default_architecture are used.89"""10+ # the bitiness is the *size of a pointer*, which is 32-bit on WASM;11+ # analyzing binaries on host system isn't robust so we hardcode this.12+ return ("32bit", linkage)13# Use the sizeof(pointer) as default number of bits if nothing14# else is given as default.15if not bits:16@@ -753,6 +756,10 @@17"""18Fall back to `uname -p`19"""20+ # Special case for WASM where on nodejs we do NOT21+ # want to get the host processor.22+ return "wasm32"23+24try:25import subprocess26except ImportError:2728--- native/Lib/test/test_platform.py 2022-08-05 07:45:18.000000000 -070029+++ wasm/Lib/test/test_platform.py 2022-09-15 22:50:06.000000000 -070030@@ -269,7 +269,7 @@31self.assertEqual(res[:], expected)32self.assertEqual(res[:5], expected[:5])3334- @unittest.skipIf(sys.platform in ['win32', 'OpenVMS'], "uname -p not used")35+ @unittest.skipIf(sys.platform in ['wasi', 'win32', 'OpenVMS'], "uname -p not used")36@support.requires_subprocess()37def test_uname_processor(self):38"""394041