summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-11-11 20:11:15 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2012-11-11 20:11:15 +0100
commit58570e2a9e801c9d6758a79968e54d74f7ce0c45 (patch)
treef66bd116f1e85f3743868c514e6e8de1ce26812f /Python/sysmodule.c
parent3b142536f70f81872eac135b55e0572429c5ab46 (diff)
parentaae0fc1b4754dafd00a40c1c48e19e5e19b64343 (diff)
downloadcpython-58570e2a9e801c9d6758a79968e54d74f7ce0c45.tar.gz
Add a test for hashing of unaligned memory buffers (from issue #16427).
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 20bfa555b3..cafbb58667 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1561,7 +1561,6 @@ PyObject *
_PySys_Init(void)
{
PyObject *m, *v, *sysdict, *version_info;
- char *s;
m = PyModule_Create(&sysmodule);
if (m == NULL)
@@ -1638,20 +1637,14 @@ _PySys_Init(void)
PyLong_FromLong(0x10FFFF));
SET_SYS_FROM_STRING("builtin_module_names",
list_builtin_module_names());
- {
- /* Assumes that longs are at least 2 bytes long.
- Should be safe! */
- unsigned long number = 1;
- char *value;
-
- s = (char *) &number;
- if (s[0] == 0)
- value = "big";
- else
- value = "little";
- SET_SYS_FROM_STRING("byteorder",
- PyUnicode_FromString(value));
- }
+#if PY_BIG_ENDIAN
+ SET_SYS_FROM_STRING("byteorder",
+ PyUnicode_FromString("big"));
+#else
+ SET_SYS_FROM_STRING("byteorder",
+ PyUnicode_FromString("little"));
+#endif
+
#ifdef MS_COREDLL
SET_SYS_FROM_STRING("dllhandle",
PyLong_FromVoidPtr(PyWin_DLLhModule));