diff options
author | Marc-André Lemburg <mal@egenix.com> | 2008-08-07 18:54:33 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2008-08-07 18:54:33 (GMT) |
commit | 4cc0f24857c345ba99691b2ae6829c6ce3c0edcd (patch) | |
tree | cb4d437c9acb08f213376a499542f2e3bf81b8ad /Python | |
parent | 28bd1a3bd5cf7f8c161bddb1735c4968fb9f6a8f (diff) | |
download | cpython-4cc0f24857c345ba99691b2ae6829c6ce3c0edcd.zip cpython-4cc0f24857c345ba99691b2ae6829c6ce3c0edcd.tar.gz cpython-4cc0f24857c345ba99691b2ae6829c6ce3c0edcd.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 18 | ||||
-rw-r--r-- | Python/ast.c | 2 | ||||
-rw-r--r-- | Python/bltinmodule.c | 4 | ||||
-rw-r--r-- | Python/ceval.c | 8 | ||||
-rw-r--r-- | Python/compile.c | 2 | ||||
-rw-r--r-- | Python/errors.c | 2 | ||||
-rw-r--r-- | Python/future.c | 2 | ||||
-rw-r--r-- | Python/getargs.c | 2 | ||||
-rw-r--r-- | Python/import.c | 14 | ||||
-rw-r--r-- | Python/peephole.c | 2 | ||||
-rw-r--r-- | Python/pythonrun.c | 16 | ||||
-rw-r--r-- | Python/structmember.c | 2 | ||||
-rw-r--r-- | Python/symtable.c | 4 | ||||
-rw-r--r-- | Python/traceback.c | 4 |
14 files changed, 41 insertions, 41 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index cb81b07..fd3f629 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -132,7 +132,7 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, 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 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, 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 @@ normalize_module(PyObject *filename) 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 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject /* 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 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject 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 @@ warn_explicit(PyObject *category, PyObject *message, 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 @@ warn_explicit(PyObject *category, PyObject *message, 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 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno, *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 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno, 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) { diff --git a/Python/ast.c b/Python/ast.c index 9adb5a2..46bfd4e 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1324,7 +1324,7 @@ ast_for_atom(struct compiling *c, const node *n) if (errstr) { char *s = ""; char buf[128]; - s = PyUnicode_AsString(errstr); + s = _PyUnicode_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); } else { diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 27a3d8c..ae7ceec 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1606,7 +1606,7 @@ builtin_input(PyObject *self, PyObject *args) Py_DECREF(stdin_encoding); return NULL; } - prompt = PyUnicode_AsString(po); + prompt = _PyUnicode_AsString(po); if (prompt == NULL) { Py_DECREF(stdin_encoding); Py_DECREF(po); @@ -1639,7 +1639,7 @@ builtin_input(PyObject *self, PyObject *args) else { result = PyUnicode_Decode (s, len-1, - PyUnicode_AsString(stdin_encoding), + _PyUnicode_AsString(stdin_encoding), NULL); } } diff --git a/Python/ceval.c b/Python/ceval.c index af7a67a..40ce038 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -859,7 +859,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyUnicode_AsString(co->co_filename); + filename = _PyUnicode_AsString(co->co_filename); #endif why = WHY_NOT; @@ -3291,7 +3291,7 @@ PyEval_GetFuncName(PyObject *func) if (PyMethod_Check(func)) return PyEval_GetFuncName(PyMethod_GET_FUNCTION(func)); else if (PyFunction_Check(func)) - return PyUnicode_AsString(((PyFunctionObject*)func)->func_name); + return _PyUnicode_AsString(((PyFunctionObject*)func)->func_name); else if (PyCFunction_Check(func)) return ((PyCFunctionObject*)func)->m_ml->ml_name; else @@ -3527,7 +3527,7 @@ update_keyword_args(PyObject *orig_kwdict, int nk, PyObject ***pp_stack, "for keyword argument '%.200s'", PyEval_GetFuncName(func), PyEval_GetFuncDesc(func), - PyUnicode_AsString(key)); + _PyUnicode_AsString(key)); Py_DECREF(key); Py_DECREF(value); Py_DECREF(kwdict); @@ -3874,7 +3874,7 @@ format_exc_check_arg(PyObject *exc, const char *format_str, PyObject *obj) if (!obj) return; - obj_str = PyUnicode_AsString(obj); + obj_str = _PyUnicode_AsString(obj); if (!obj_str) return; diff --git a/Python/compile.c b/Python/compile.c index 942ca1f52..4600589 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1300,7 +1300,7 @@ compiler_make_closure(struct compiler *c, PyCodeObject *co, int args) PyObject_REPR(name), PyBytes_AS_STRING(c->u->u_name), reftype, arg, - PyUnicode_AsString(co->co_name), + _PyUnicode_AsString(co->co_name), PyObject_REPR(co->co_freevars)); Py_FatalError("compiler_make_closure()"); } diff --git a/Python/errors.c b/Python/errors.c index 5ee6255..9c9eb2f 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -709,7 +709,7 @@ PyErr_WriteUnraisable(PyObject *obj) if (moduleName == NULL) PyFile_WriteString("<unknown>", f); else { - char* modstr = PyUnicode_AsString(moduleName); + char* modstr = _PyUnicode_AsString(moduleName); if (modstr && strcmp(modstr, "builtins") != 0) { diff --git a/Python/future.c b/Python/future.c index a5bee0c..e775384 100644 --- a/Python/future.c +++ b/Python/future.c @@ -20,7 +20,7 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename) names = s->v.ImportFrom.names; for (i = 0; i < asdl_seq_LEN(names); i++) { alias_ty name = (alias_ty)asdl_seq_GET(names, i); - const char *feature = PyUnicode_AsString(name->name); + const char *feature = _PyUnicode_AsString(name->name); if (!feature) return 0; if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { diff --git a/Python/getargs.c b/Python/getargs.c index ccd1817..36a6261 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -1537,7 +1537,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, const char *format, "keywords must be strings"); return cleanreturn(0, freelist); } - ks = PyUnicode_AsString(key); + ks = _PyUnicode_AsString(key); for (i = 0; i < len; i++) { if (!strcmp(ks, kwlist[i])) { match = 1; diff --git a/Python/import.c b/Python/import.c index a43bd43..bedec1e 100644 --- a/Python/import.c +++ b/Python/import.c @@ -470,7 +470,7 @@ PyImport_Cleanup(void) 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 @@ PyImport_Cleanup(void) 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 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, 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 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level) "__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 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level) 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 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level) } } 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 @@ PyImport_ReloadModule(PyObject *m) 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; diff --git a/Python/peephole.c b/Python/peephole.c index 30789e4..b9b26fc 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -407,7 +407,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, case LOAD_NAME: case LOAD_GLOBAL: j = GETARG(codestr, i); - name = PyUnicode_AsString(PyTuple_GET_ITEM(names, j)); + name = _PyUnicode_AsString(PyTuple_GET_ITEM(names, j)); h = load_global(codestr, i, name, consts); if (h < 0) goto exitUnchanged; diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 2ab1d46..a1777bd 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -803,7 +803,7 @@ initstdio(void) encoding_attr = PyObject_GetAttrString(std, "encoding"); if (encoding_attr != NULL) { const char * encoding; - encoding = PyUnicode_AsString(encoding_attr); + encoding = _PyUnicode_AsString(encoding_attr); if (encoding != NULL) { _PyCodec_Lookup(encoding); } @@ -909,7 +909,7 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags oenc = PyObject_GetAttrString(v, "encoding"); if (!oenc) return -1; - enc = PyUnicode_AsString(oenc); + enc = _PyUnicode_AsString(oenc); } v = PySys_GetObject("ps1"); if (v != NULL) { @@ -917,7 +917,7 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags if (v == NULL) PyErr_Clear(); else if (PyUnicode_Check(v)) - ps1 = PyUnicode_AsString(v); + ps1 = _PyUnicode_AsString(v); } w = PySys_GetObject("ps2"); if (w != NULL) { @@ -925,7 +925,7 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags if (w == NULL) PyErr_Clear(); else if (PyUnicode_Check(w)) - ps2 = PyUnicode_AsString(w); + ps2 = _PyUnicode_AsString(w); } arena = PyArena_New(); if (arena == NULL) { @@ -1101,7 +1101,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename, goto finally; if (v == Py_None) *filename = NULL; - else if (! (*filename = PyUnicode_AsString(v))) + else if (! (*filename = _PyUnicode_AsString(v))) goto finally; Py_DECREF(v); @@ -1134,7 +1134,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename, if (v == Py_None) *text = NULL; else if (!PyUnicode_Check(v) || - !(*text = PyUnicode_AsString(v))) + !(*text = _PyUnicode_AsString(v))) goto finally; Py_DECREF(v); return 1; @@ -1357,7 +1357,7 @@ print_exception(PyObject *f, PyObject *value) err = PyFile_WriteString("<unknown>", f); } else { - char* modstr = PyUnicode_AsString(moduleName); + char* modstr = _PyUnicode_AsString(moduleName); if (modstr && strcmp(modstr, "builtins")) { err = PyFile_WriteString(modstr, f); @@ -1806,7 +1806,7 @@ err_input(perrdetail *err) if (value != NULL) { u = PyObject_Str(value); if (u != NULL) { - msg = PyUnicode_AsString(u); + msg = _PyUnicode_AsString(u); } } if (msg == NULL) diff --git a/Python/structmember.c b/Python/structmember.c index 6c1e932..9f08a6b 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -247,7 +247,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) PyErr_BadArgument(); return -1; } - string = PyUnicode_AsStringAndSize(v, &len); + string = _PyUnicode_AsStringAndSize(v, &len); if (len != 1) { PyErr_BadArgument(); return -1; diff --git a/Python/symtable.c b/Python/symtable.c index 0c11ee1..92432ab 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1142,7 +1142,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s) asdl_seq *seq = s->v.Global.names; for (i = 0; i < asdl_seq_LEN(seq); i++) { identifier name = (identifier)asdl_seq_GET(seq, i); - char *c_name = PyUnicode_AsString(name); + char *c_name = _PyUnicode_AsString(name); long cur = symtable_lookup(st, name); if (cur < 0) return 0; @@ -1169,7 +1169,7 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s) asdl_seq *seq = s->v.Nonlocal.names; for (i = 0; i < asdl_seq_LEN(seq); i++) { identifier name = (identifier)asdl_seq_GET(seq, i); - char *c_name = PyUnicode_AsString(name); + char *c_name = _PyUnicode_AsString(name); long cur = symtable_lookup(st, name); if (cur < 0) return 0; diff --git a/Python/traceback.c b/Python/traceback.c index d569a18..dffce35 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -257,10 +257,10 @@ tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit) while (tb != NULL && err == 0) { if (depth <= limit) { err = tb_displayline(f, - PyUnicode_AsString( + _PyUnicode_AsString( tb->tb_frame->f_code->co_filename), tb->tb_lineno, - PyUnicode_AsString(tb->tb_frame->f_code->co_name)); + _PyUnicode_AsString(tb->tb_frame->f_code->co_name)); } depth--; tb = tb->tb_next; |