diff options
| author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-11-11 02:24:37 +0100 |
|---|---|---|
| committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-11-11 02:24:37 +0100 |
| commit | 1672dbd709963c9b62601d4e043a9ae2ad826760 (patch) | |
| tree | 32766fab405441365921b84da4ba405ce9cb45c2 /Python/sysmodule.c | |
| parent | 0a76d75a9c1c11c8cea679a0c334e367ab3ec335 (diff) | |
| parent | f110b41731bd946ed008065e37375c7240790bd1 (diff) | |
| download | cpython-1672dbd709963c9b62601d4e043a9ae2ad826760.tar.gz | |
Issue #16350, part 2: Set unused_data (and unconsumed_tail) correctly in decompressobj().flush().
Additionally, fix a bug where a MemoryError in allocating a bytes object could
leave the decompressor object in an invalid state (with its unconsumed_tail
member being NULL).
Patch by Serhiy Storchaka.
Diffstat (limited to 'Python/sysmodule.c')
| -rw-r--r-- | Python/sysmodule.c | 23 |
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)); |
