Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 13968:841cf9012ac3 legacy-trunk
Add a byte_order value to the sys module. The value is "big" for
big-endian machines and "little" for little-endian machines.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Mon, 14 Aug 2000 15:47:03 +0000 |
| parents | b54f11ada91e |
| children | aa4202702252 |
comparison
equal
deleted
inserted
replaced
| 13967:7b7ee58901fb | 13968:841cf9012ac3 |
|---|---|
| 454 v = PyInt_FromLong(PyInt_GetMax())); | 454 v = PyInt_FromLong(PyInt_GetMax())); |
| 455 Py_XDECREF(v); | 455 Py_XDECREF(v); |
| 456 PyDict_SetItemString(sysdict, "builtin_module_names", | 456 PyDict_SetItemString(sysdict, "builtin_module_names", |
| 457 v = list_builtin_module_names()); | 457 v = list_builtin_module_names()); |
| 458 Py_XDECREF(v); | 458 Py_XDECREF(v); |
| 459 { | |
| 460 /* Assumes that longs are at least 2 bytes long. | |
| 461 Should be safe! */ | |
| 462 unsigned long number = 1; | |
| 463 | |
| 464 s = (char *) &number; | |
| 465 if (s[0] == 0) | |
| 466 PyDict_SetItemString(sysdict, "byte_order", | |
| 467 PyString_FromString("big")); | |
| 468 else | |
| 469 PyDict_SetItemString(sysdict, "byte_order", | |
| 470 PyString_FromString("little")); | |
| 471 } | |
| 459 #ifdef MS_COREDLL | 472 #ifdef MS_COREDLL |
| 460 PyDict_SetItemString(sysdict, "dllhandle", | 473 PyDict_SetItemString(sysdict, "dllhandle", |
| 461 v = PyLong_FromVoidPtr(PyWin_DLLhModule)); | 474 v = PyLong_FromVoidPtr(PyWin_DLLhModule)); |
| 462 Py_XDECREF(v); | 475 Py_XDECREF(v); |
| 463 PyDict_SetItemString(sysdict, "winver", | 476 PyDict_SetItemString(sysdict, "winver", |
