diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-20 07:13:07 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-20 07:13:07 (GMT) |
commit | 06515833fef7b8b5c7968edf72367d94ff7eb1e0 (patch) | |
tree | 58a7c06bba8141883a5e5c8621d2b0683ae9fe2e /Python | |
parent | e20973926a2ec19c4b87e460dc6f0edb478ce352 (diff) | |
download | cpython-06515833fef7b8b5c7968edf72367d94ff7eb1e0.zip cpython-06515833fef7b8b5c7968edf72367d94ff7eb1e0.tar.gz cpython-06515833fef7b8b5c7968edf72367d94ff7eb1e0.tar.bz2 |
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 8 | ||||
-rw-r--r-- | Python/ceval.c | 4 | ||||
-rw-r--r-- | Python/future.c | 2 | ||||
-rw-r--r-- | Python/pylifecycle.c | 4 | ||||
-rw-r--r-- | Python/pythonrun.c | 8 | ||||
-rw-r--r-- | Python/structmember.c | 2 | ||||
-rw-r--r-- | Python/sysmodule.c | 4 |
7 files changed, 16 insertions, 16 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index cee013f..a49cb9d 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1903,8 +1903,8 @@ builtin_input_impl(PyObject *module, PyObject *prompt) /* stdin is a text stream, so it must have an encoding. */ goto _readline_errors; - stdin_encoding_str = _PyUnicode_AsString(stdin_encoding); - stdin_errors_str = _PyUnicode_AsString(stdin_errors); + stdin_encoding_str = PyUnicode_AsUTF8(stdin_encoding); + stdin_errors_str = PyUnicode_AsUTF8(stdin_errors); if (!stdin_encoding_str || !stdin_errors_str) goto _readline_errors; tmp = _PyObject_CallMethodId(fout, &PyId_flush, NULL); @@ -1920,8 +1920,8 @@ builtin_input_impl(PyObject *module, PyObject *prompt) stdout_errors = _PyObject_GetAttrId(fout, &PyId_errors); if (!stdout_encoding || !stdout_errors) goto _readline_errors; - stdout_encoding_str = _PyUnicode_AsString(stdout_encoding); - stdout_errors_str = _PyUnicode_AsString(stdout_errors); + stdout_encoding_str = PyUnicode_AsUTF8(stdout_encoding); + stdout_errors_str = PyUnicode_AsUTF8(stdout_errors); if (!stdout_encoding_str || !stdout_errors_str) goto _readline_errors; stringpo = PyObject_Str(prompt); diff --git a/Python/ceval.c b/Python/ceval.c index 6bdc998..a9d7c2f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4712,7 +4712,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_AsUTF8(((PyFunctionObject*)func)->func_name); else if (PyCFunction_Check(func)) return ((PyCFunctionObject*)func)->m_ml->ml_name; else @@ -5286,7 +5286,7 @@ format_exc_check_arg(PyObject *exc, const char *format_str, PyObject *obj) if (!obj) return; - obj_str = _PyUnicode_AsString(obj); + obj_str = PyUnicode_AsUTF8(obj); if (!obj_str) return; diff --git a/Python/future.c b/Python/future.c index d94b23d..9c1f430 100644 --- a/Python/future.c +++ b/Python/future.c @@ -21,7 +21,7 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *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_AsUTF8(name->name); if (!feature) return 0; if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 71f23dd..a4f7f82 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -205,7 +205,7 @@ get_codec_name(const char *encoding) if (!name) goto error; - name_utf8 = _PyUnicode_AsString(name); + name_utf8 = PyUnicode_AsUTF8(name); if (name_utf8 == NULL) goto error; name_str = _PyMem_RawStrdup(name_utf8); @@ -1285,7 +1285,7 @@ initstdio(void) encoding_attr = PyObject_GetAttrString(std, "encoding"); if (encoding_attr != NULL) { const char * std_encoding; - std_encoding = _PyUnicode_AsString(encoding_attr); + std_encoding = PyUnicode_AsUTF8(encoding_attr); if (std_encoding != NULL) { PyObject *codec_info = _PyCodec_Lookup(std_encoding); Py_XDECREF(codec_info); diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 5b1b786..c881f90 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -171,7 +171,7 @@ PyRun_InteractiveOneObject(FILE *fp, PyObject *filename, PyCompilerFlags *flags) if (v && v != Py_None) { oenc = _PyObject_GetAttrId(v, &PyId_encoding); if (oenc) - enc = _PyUnicode_AsString(oenc); + enc = PyUnicode_AsUTF8(oenc); if (!enc) PyErr_Clear(); } @@ -182,7 +182,7 @@ PyRun_InteractiveOneObject(FILE *fp, PyObject *filename, PyCompilerFlags *flags) if (v == NULL) PyErr_Clear(); else if (PyUnicode_Check(v)) { - ps1 = _PyUnicode_AsString(v); + ps1 = PyUnicode_AsUTF8(v); if (ps1 == NULL) { PyErr_Clear(); ps1 = ""; @@ -195,7 +195,7 @@ PyRun_InteractiveOneObject(FILE *fp, PyObject *filename, PyCompilerFlags *flags) if (w == NULL) PyErr_Clear(); else if (PyUnicode_Check(w)) { - ps2 = _PyUnicode_AsString(w); + ps2 = PyUnicode_AsUTF8(w); if (ps2 == NULL) { PyErr_Clear(); ps2 = ""; @@ -514,7 +514,7 @@ print_error_text(PyObject *f, int offset, PyObject *text_obj) char *text; char *nl; - text = _PyUnicode_AsString(text_obj); + text = PyUnicode_AsUTF8(text_obj); if (text == NULL) return; diff --git a/Python/structmember.c b/Python/structmember.c index 86d4c66..be2737d 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -252,7 +252,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) char *string; Py_ssize_t len; - string = _PyUnicode_AsStringAndSize(v, &len); + string = PyUnicode_AsUTF8AndSize(v, &len); if (string == NULL || len != 1) { PyErr_BadArgument(); return -1; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index e348b38..52034ff 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -114,7 +114,7 @@ sys_displayhook_unencodable(PyObject *outf, PyObject *o) stdout_encoding = _PyObject_GetAttrId(outf, &PyId_encoding); if (stdout_encoding == NULL) goto error; - stdout_encoding_str = _PyUnicode_AsString(stdout_encoding); + stdout_encoding_str = PyUnicode_AsUTF8(stdout_encoding); if (stdout_encoding_str == NULL) goto error; @@ -2411,7 +2411,7 @@ sys_format(_Py_Identifier *key, FILE *fp, const char *format, va_list va) if (message != NULL) { if (sys_pyfile_write_unicode(message, file) != 0) { PyErr_Clear(); - utf8 = _PyUnicode_AsString(message); + utf8 = PyUnicode_AsUTF8(message); if (utf8 != NULL) fputs(utf8, fp); } |