mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
Add a byte_order value to the sys module. The value is "big" for
big-endian machines and "little" for little-endian machines.
This commit is contained in:
parent
107b9679c4
commit
099325e01b
1 changed files with 13 additions and 0 deletions
|
@ -456,6 +456,19 @@ _PySys_Init(void)
|
||||||
PyDict_SetItemString(sysdict, "builtin_module_names",
|
PyDict_SetItemString(sysdict, "builtin_module_names",
|
||||||
v = list_builtin_module_names());
|
v = list_builtin_module_names());
|
||||||
Py_XDECREF(v);
|
Py_XDECREF(v);
|
||||||
|
{
|
||||||
|
/* Assumes that longs are at least 2 bytes long.
|
||||||
|
Should be safe! */
|
||||||
|
unsigned long number = 1;
|
||||||
|
|
||||||
|
s = (char *) &number;
|
||||||
|
if (s[0] == 0)
|
||||||
|
PyDict_SetItemString(sysdict, "byte_order",
|
||||||
|
PyString_FromString("big"));
|
||||||
|
else
|
||||||
|
PyDict_SetItemString(sysdict, "byte_order",
|
||||||
|
PyString_FromString("little"));
|
||||||
|
}
|
||||||
#ifdef MS_COREDLL
|
#ifdef MS_COREDLL
|
||||||
PyDict_SetItemString(sysdict, "dllhandle",
|
PyDict_SetItemString(sysdict, "dllhandle",
|
||||||
v = PyLong_FromVoidPtr(PyWin_DLLhModule));
|
v = PyLong_FromVoidPtr(PyWin_DLLhModule));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue