Mercurial > cpython-lru_cache-weakref
diff Python/_warnings.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 | de0bf60f1245 |
| children | caa41e161b04 |
line wrap: on
line diff
--- a/Python/_warnings.c Thu Aug 07 18:47:28 2008 +0000 +++ b/Python/_warnings.c Thu Aug 07 18:54:33 2008 +0000 @@ -132,7 +132,7 @@ return NULL; if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln)) - return PyUnicode_AsString(action); + return _PyUnicode_AsString(action); } m = PyImport_ImportModule(MODULE_NAME); @@ -144,7 +144,7 @@ return NULL; action = PyDict_GetItemString(d, DEFAULT_ACTION_NAME); if (action != NULL) - return PyUnicode_AsString(action); + return _PyUnicode_AsString(action); PyErr_SetString(PyExc_ValueError, MODULE_NAME "." DEFAULT_ACTION_NAME " not found"); @@ -186,7 +186,7 @@ else if (rc == 0) return PyUnicode_FromString("<unknown>"); - mod_str = PyUnicode_AsString(filename); + mod_str = _PyUnicode_AsString(filename); if (mod_str == NULL) return NULL; len = PyUnicode_GetSize(filename); @@ -257,7 +257,7 @@ /* Print " source_line\n" */ if (sourceline) { - char *source_line_str = PyUnicode_AsString(sourceline); + char *source_line_str = _PyUnicode_AsString(sourceline); while (*source_line_str == ' ' || *source_line_str == '\t' || *source_line_str == '\014') source_line_str++; @@ -266,7 +266,7 @@ PyFile_WriteString("\n", f_stderr); } else - _Py_DisplaySourceLine(f_stderr, PyUnicode_AsString(filename), + _Py_DisplaySourceLine(f_stderr, _PyUnicode_AsString(filename), lineno, 2); PyErr_Clear(); } @@ -367,7 +367,7 @@ const char *err_str = "???"; if (to_str != NULL) - err_str = PyUnicode_AsString(to_str); + err_str = _PyUnicode_AsString(to_str); PyErr_Format(PyExc_RuntimeError, "Unrecognized action (%s) in warnings.filters:\n %s", action, err_str); @@ -388,7 +388,7 @@ else { const char *msg = "functions overriding warnings.showwarning() " "must support the 'line' argument"; - const char *text_char = PyUnicode_AsString(text); + const char *text_char = _PyUnicode_AsString(text); if (strcmp(msg, text_char) == 0) { /* Prevent infinite recursion by using built-in implementation @@ -503,7 +503,7 @@ *filename = PyDict_GetItemString(globals, "__file__"); if (*filename != NULL) { Py_ssize_t len = PyUnicode_GetSize(*filename); - const char *file_str = PyUnicode_AsString(*filename); + const char *file_str = _PyUnicode_AsString(*filename); if (file_str == NULL || (len < 0 && PyErr_Occurred())) goto handle_error; @@ -523,7 +523,7 @@ Py_INCREF(*filename); } else { - const char *module_str = PyUnicode_AsString(*module); + const char *module_str = _PyUnicode_AsString(*module); if (module_str && strcmp(module_str, "__main__") == 0) { PyObject *argv = PySys_GetObject("argv"); if (argv != NULL && PyList_Size(argv) > 0) {
