diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 15 | ||||
-rw-r--r-- | Python/import.c | 6 |
2 files changed, 19 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c index 77c6a77..8ae4036 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -914,7 +914,20 @@ compiler_add_o(struct compiler *c, PyObject *dict, PyObject *o) Py_ssize_t arg; /* necessary to make sure types aren't coerced (e.g., int and long) */ - t = PyTuple_Pack(2, o, o->ob_type); + /* _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms */ + if (PyFloat_Check(o)) { + double d = PyFloat_AS_DOUBLE(o); + unsigned char* p = (unsigned char*) &d; + /* all we need is to make the tuple different in either the 0.0 + * or -0.0 case from all others, just to avoid the "coercion". + */ + if (*p==0 && p[sizeof(double)-1]==0) + t = PyTuple_Pack(3, o, o->ob_type, Py_None); + else + t = PyTuple_Pack(2, o, o->ob_type); + } else { + t = PyTuple_Pack(2, o, o->ob_type); + } if (t == NULL) return -1; diff --git a/Python/import.c b/Python/import.c index 49a47bb..72138c2 100644 --- a/Python/import.c +++ b/Python/import.c @@ -118,15 +118,19 @@ _PyImport_Init(void) /* prepare _PyImport_Filetab: copy entries from _PyImport_DynLoadFiletab and _PyImport_StandardFiletab. */ +#ifdef HAVE_DYNAMIC_LOADING for (scan = _PyImport_DynLoadFiletab; scan->suffix != NULL; ++scan) ++countD; +#endif for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan) ++countS; filetab = PyMem_NEW(struct filedescr, countD + countS + 1); if (filetab == NULL) Py_FatalError("Can't initialize import file table."); +#ifdef HAVE_DYNAMIC_LOADING memcpy(filetab, _PyImport_DynLoadFiletab, countD * sizeof(struct filedescr)); +#endif memcpy(filetab + countD, _PyImport_StandardFiletab, countS * sizeof(struct filedescr)); filetab[countD + countS].suffix = NULL; @@ -1321,7 +1325,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, saved_namelen = namelen; #endif /* PYOS_OS2 */ for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) { -#if defined(PYOS_OS2) +#if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING) /* OS/2 limits DLLs to 8 character names (w/o extension) * so if the name is longer than that and its a |