mirror of
https://github.com/python/cpython.git
synced 2025-09-11 19:27:07 +00:00
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
This commit is contained in:
parent
9ada3d6e29
commit
49fd7fa443
640 changed files with 52240 additions and 18408 deletions
|
@ -17,6 +17,9 @@
|
|||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern time_t PyOS_GetLastModificationTime(char *, FILE *);
|
||||
/* In getmtime.c */
|
||||
|
@ -40,6 +43,7 @@ extern time_t PyOS_GetLastModificationTime(char *, FILE *);
|
|||
Python 1.5: 20121
|
||||
Python 1.5.1: 20121
|
||||
Python 1.5.2: 20121
|
||||
Python 1.6: 50428
|
||||
Python 2.0: 50823
|
||||
Python 2.0.1: 50823
|
||||
Python 2.1: 60202
|
||||
|
@ -1217,12 +1221,12 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
|
|||
#endif
|
||||
if (!PyString_Check(v))
|
||||
continue;
|
||||
len = PyString_Size(v);
|
||||
len = PyString_GET_SIZE(v);
|
||||
if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen) {
|
||||
Py_XDECREF(copy);
|
||||
continue; /* Too long */
|
||||
}
|
||||
strcpy(buf, PyString_AsString(v));
|
||||
strcpy(buf, PyString_AS_STRING(v));
|
||||
if (strlen(buf) != len) {
|
||||
Py_XDECREF(copy);
|
||||
continue; /* v contains '\0' */
|
||||
|
@ -1934,6 +1938,16 @@ import_module_level(char *name, PyObject *globals, PyObject *locals,
|
|||
}
|
||||
tail = next;
|
||||
}
|
||||
if (tail == Py_None) {
|
||||
/* If tail is Py_None, both get_parent and load_next found
|
||||
an empty module name: someone called __import__("") or
|
||||
doctored faulty bytecode */
|
||||
Py_DECREF(tail);
|
||||
Py_DECREF(head);
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Empty module name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fromlist != NULL) {
|
||||
if (fromlist == Py_None || !PyObject_IsTrue(fromlist))
|
||||
|
@ -2094,7 +2108,8 @@ load_next(PyObject *mod, PyObject *altmod, char **p_name, char *buf,
|
|||
PyObject *result;
|
||||
|
||||
if (strlen(name) == 0) {
|
||||
/* empty module name only happens in 'from . import' */
|
||||
/* completely empty module name should only happen in
|
||||
'from . import' (or '__import__("")')*/
|
||||
Py_INCREF(mod);
|
||||
*p_name = NULL;
|
||||
return mod;
|
||||
|
@ -2936,3 +2951,7 @@ PyImport_AppendInittab(char *name, void (*initfunc)(void))
|
|||
|
||||
return PyImport_ExtendInittab(newtab);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue