Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 48660:85b67fb5672b
Rename PyUnicode_AsString -> _PyUnicode_AsString and
PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark
them for interpreter internal use only.
We'll have to rework these APIs or create new ones for the
purpose of accessing the UTF-8 representation of Unicode objects
for 3.1.
| author | Marc-André Lemburg <mal@egenix.com> |
|---|---|
| date | Thu, 07 Aug 2008 18:54:33 +0000 |
| parents | 40b0e3318a8b |
| children | 3b9608118f8d |
line wrap: on
line diff
--- a/Python/import.c Thu Aug 07 18:47:28 2008 +0000 +++ b/Python/import.c Thu Aug 07 18:54:33 2008 +0000 @@ -470,7 +470,7 @@ if (value->ob_refcnt != 1) continue; if (PyUnicode_Check(key) && PyModule_Check(value)) { - name = PyUnicode_AsString(key); + name = _PyUnicode_AsString(key); if (strcmp(name, "builtins") == 0) continue; if (strcmp(name, "sys") == 0) @@ -489,7 +489,7 @@ pos = 0; while (PyDict_Next(modules, &pos, &key, &value)) { if (PyUnicode_Check(key) && PyModule_Check(value)) { - name = PyUnicode_AsString(key); + name = _PyUnicode_AsString(key); if (strcmp(name, "builtins") == 0) continue; if (strcmp(name, "sys") == 0) @@ -1296,7 +1296,7 @@ if (path != NULL && PyUnicode_Check(path)) { /* The only type of submodule allowed inside a "frozen" package are other frozen modules or packages. */ - char *p = PyUnicode_AsString(path); + char *p = _PyUnicode_AsString(path); if (strlen(p) + 1 + strlen(name) >= (size_t)buflen) { PyErr_SetString(PyExc_ImportError, "full frozen module name too long"); @@ -2197,7 +2197,7 @@ "__package__ set to non-string"); return NULL; } - pkgname_str = PyUnicode_AsStringAndSize(pkgname, &len); + pkgname_str = _PyUnicode_AsStringAndSize(pkgname, &len); if (len == 0) { if (level > 0) { PyErr_SetString(PyExc_ValueError, @@ -2225,7 +2225,7 @@ Py_ssize_t len; int error; - modname_str = PyUnicode_AsStringAndSize(modname, &len); + modname_str = _PyUnicode_AsStringAndSize(modname, &len); if (len > MAXPATHLEN) { PyErr_SetString(PyExc_ValueError, "Module name too long"); @@ -2240,7 +2240,7 @@ } } else { /* Normal module, so work out the package name if any */ - char *start = PyUnicode_AsString(modname); + char *start = _PyUnicode_AsString(modname); char *lastdot = strrchr(start, '.'); size_t len; int error; @@ -2635,7 +2635,7 @@ if (parent == NULL) { PyErr_Format(PyExc_ImportError, "reload(): parent %.200s not in sys.modules", - PyUnicode_AsString(parentname)); + _PyUnicode_AsString(parentname)); Py_DECREF(parentname); imp_modules_reloading_clear(); return NULL;
