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 /Modules | |
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 'Modules')
30 files changed, 65 insertions, 65 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 48fe772..02a08a4 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -683,8 +683,8 @@ StructType_setattro(PyObject *self, PyObject *key, PyObject *value) return -1; if (value && PyUnicode_Check(key) && - /* XXX struni PyUnicode_AsString can fail (also in other places)! */ - 0 == strcmp(PyUnicode_AsString(key), "_fields_")) + /* XXX struni _PyUnicode_AsString can fail (also in other places)! */ + 0 == strcmp(_PyUnicode_AsString(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 1); return 0; } @@ -698,7 +698,7 @@ UnionType_setattro(PyObject *self, PyObject *key, PyObject *value) return -1; if (PyUnicode_Check(key) && - 0 == strcmp(PyUnicode_AsString(key), "_fields_")) + 0 == strcmp(_PyUnicode_AsString(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 0); return 0; } @@ -1681,7 +1681,7 @@ c_void_p_from_param(PyObject *type, PyObject *value) if (stgd && CDataObject_Check(value) && stgd->proto && PyUnicode_Check(stgd->proto)) { PyCArgObject *parg; - switch (PyUnicode_AsString(stgd->proto)[0]) { + switch (_PyUnicode_AsString(stgd->proto)[0]) { case 'z': /* c_char_p */ case 'Z': /* c_wchar_p */ parg = new_CArgObject(); @@ -1791,7 +1791,7 @@ SimpleType_paramfunc(CDataObject *self) dict = PyObject_stgdict((PyObject *)self); assert(dict); /* Cannot be NULL for CDataObject instances */ - fmt = PyUnicode_AsString(dict->proto); + fmt = _PyUnicode_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -2012,7 +2012,7 @@ SimpleType_from_param(PyObject *type, PyObject *value) assert(dict); /* I think we can rely on this being a one-character string */ - fmt = PyUnicode_AsString(dict->proto); + fmt = _PyUnicode_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -3058,7 +3058,7 @@ _check_outarg_type(PyObject *arg, Py_ssize_t index) /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ && PyUnicode_Check(dict->proto) /* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */ - && (strchr("PzZ", PyUnicode_AsString(dict->proto)[0]))) { + && (strchr("PzZ", _PyUnicode_AsString(dict->proto)[0]))) { return 1; } @@ -3148,7 +3148,7 @@ _get_name(PyObject *obj, char **pname) return *pname ? 1 : 0; } if (PyUnicode_Check(obj)) { - *pname = PyUnicode_AsString(obj); + *pname = _PyUnicode_AsString(obj); return *pname ? 1 : 0; } PyErr_SetString(PyExc_TypeError, @@ -5127,7 +5127,7 @@ cast_check_pointertype(PyObject *arg) dict = PyType_stgdict(arg); if (dict) { if (PyUnicode_Check(dict->proto) - && (strchr("sPzUZXO", PyUnicode_AsString(dict->proto)[0]))) { + && (strchr("sPzUZXO", _PyUnicode_AsString(dict->proto)[0]))) { /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ return 1; } diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index d452785..6dced06 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1750,7 +1750,7 @@ POINTER(PyObject *self, PyObject *cls) return result; } if (PyUnicode_CheckExact(cls)) { - char *name = PyUnicode_AsString(cls); + char *name = _PyUnicode_AsString(cls); buf = alloca(strlen(name) + 3 + 1); sprintf(buf, "LP_%s", name); result = PyObject_CallFunction((PyObject *)Py_TYPE(&Pointer_Type), diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c index 085b19f..aac073f 100644 --- a/Modules/_ctypes/stgdict.c +++ b/Modules/_ctypes/stgdict.c @@ -479,7 +479,7 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct) bitsize = 0; if (isStruct && !isPacked) { char *fieldfmt = dict->format ? dict->format : "B"; - char *fieldname = PyUnicode_AsString(name); + char *fieldname = _PyUnicode_AsString(name); char *ptr; Py_ssize_t len = strlen(fieldname) + strlen(fieldfmt); char *buf = alloca(len + 2 + 1); diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index da223c4..767c6ee 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1303,7 +1303,7 @@ element_getattro(ElementObject* self, PyObject* nameobj) char *name = ""; if (PyUnicode_Check(nameobj)) - name = PyUnicode_AsString(nameobj); + name = _PyUnicode_AsString(nameobj); if (strcmp(name, "tag") == 0) res = self->tag; @@ -2529,7 +2529,7 @@ xmlparser_getattro(XMLParserObject* self, PyObject* nameobj) char *name = ""; if (PyUnicode_Check(nameobj)) - name = PyUnicode_AsString(nameobj); + name = _PyUnicode_AsString(nameobj); PyErr_Clear(); diff --git a/Modules/_gestalt.c b/Modules/_gestalt.c index 3a7279f..462a6d2 100644 --- a/Modules/_gestalt.c +++ b/Modules/_gestalt.c @@ -38,7 +38,7 @@ convert_to_OSType(PyObject *v, OSType *pr) "OSType arg must be string of 4 chars"); return 0; } - memcpy((char *)&tmp, PyUnicode_AsString(v), 4); + memcpy((char *)&tmp, _PyUnicode_AsString(v), 4); *pr = (OSType)ntohl(tmp); return 1; } diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 8965f43..bd04411 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -241,7 +241,7 @@ EVP_repr(PyObject *self) { char buf[100]; PyOS_snprintf(buf, sizeof(buf), "<%s HASH object @ %p>", - PyUnicode_AsString(((EVPobject *)self)->name), self); + _PyUnicode_AsString(((EVPobject *)self)->name), self); return PyUnicode_FromString(buf); } diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 69ecaf1..a6fd1f8 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -180,7 +180,7 @@ normalizeUserObj(PyObject *obj) PyObject *mod = fn->m_module; const char *modname; if (mod && PyUnicode_Check(mod)) { - modname = PyUnicode_AsString(mod); + modname = _PyUnicode_AsString(mod); } else if (mod && PyModule_Check(mod)) { modname = PyModule_GetName(mod); diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 98cb62e..0f5b06b 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -927,7 +927,7 @@ save_long(PicklerObject *self, PyObject *obj) repr = PyUnicode_FromStringAndSize(NULL, (int)nbytes); if (repr == NULL) goto error; - pdata = (unsigned char *)PyUnicode_AsString(repr); + pdata = (unsigned char *)_PyUnicode_AsString(repr); i = _PyLong_AsByteArray((PyLongObject *)obj, pdata, nbytes, 1 /* little endian */ , 1 /* signed */ ); @@ -972,7 +972,7 @@ save_long(PicklerObject *self, PyObject *obj) if (repr == NULL) goto error; - string = PyUnicode_AsStringAndSize(repr, &size); + string = _PyUnicode_AsStringAndSize(repr, &size); if (string == NULL) goto error; @@ -1869,7 +1869,7 @@ save_pers(PicklerObject *self, PyObject *obj, PyObject *func) /* XXX: Should it check whether the persistent id only contains ASCII characters? And what if the pid contains embedded newlines? */ - pid_ascii_bytes = PyUnicode_AsStringAndSize(pid_str, &size); + pid_ascii_bytes = _PyUnicode_AsStringAndSize(pid_str, &size); Py_DECREF(pid_str); if (pid_ascii_bytes == NULL) goto error; diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 1e52918..7b931c0 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -434,7 +434,7 @@ void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val) } else if (PyFloat_Check(py_val)) { sqlite3_result_double(context, PyFloat_AsDouble(py_val)); } else if (PyUnicode_Check(py_val)) { - sqlite3_result_text(context, PyUnicode_AsString(py_val), -1, SQLITE_TRANSIENT); + sqlite3_result_text(context, _PyUnicode_AsString(py_val), -1, SQLITE_TRANSIENT); } else if (PyObject_CheckBuffer(py_val)) { if (PyObject_AsCharBuffer(py_val, &buffer, &buflen) != 0) { PyErr_SetString(PyExc_ValueError, "could not convert BLOB to buffer"); @@ -901,7 +901,7 @@ static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, Py return -1; } - statement = PyUnicode_AsStringAndSize(begin_statement, &size); + statement = _PyUnicode_AsStringAndSize(begin_statement, &size); if (!statement) { Py_DECREF(statement); return -1; @@ -1194,7 +1194,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args) goto finally; } - chk = PyUnicode_AsString(uppercase_name); + chk = _PyUnicode_AsString(uppercase_name); while (*chk) { if ((*chk >= '0' && *chk <= '9') || (*chk >= 'A' && *chk <= 'Z') @@ -1219,7 +1219,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args) } rc = sqlite3_create_collation(self->db, - PyUnicode_AsString(uppercase_name), + _PyUnicode_AsString(uppercase_name), SQLITE_UTF8, (callable != Py_None) ? callable : NULL, (callable != Py_None) ? pysqlite_collation_callback : NULL); diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index 14dd002..9ac25f5 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -490,7 +490,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* rc = pysqlite_statement_reset(self->statement); } - operation_cstr = PyUnicode_AsStringAndSize(operation, &operation_len); + operation_cstr = _PyUnicode_AsStringAndSize(operation, &operation_len); if (operation == NULL) goto error; @@ -793,7 +793,7 @@ PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args) } if (PyUnicode_Check(script_obj)) { - script_cstr = PyUnicode_AsString(script_obj); + script_cstr = _PyUnicode_AsString(script_obj); if (!script_cstr) { return NULL; } diff --git a/Modules/_sqlite/row.c b/Modules/_sqlite/row.c index 008f19e..8778af0 100644 --- a/Modules/_sqlite/row.c +++ b/Modules/_sqlite/row.c @@ -82,12 +82,12 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx) Py_XINCREF(item); return item; } else if (PyUnicode_Check(idx)) { - key = PyUnicode_AsString(idx); + key = _PyUnicode_AsString(idx); nitems = PyTuple_Size(self->description); for (i = 0; i < nitems; i++) { - compare_key = PyUnicode_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); + compare_key = _PyUnicode_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); if (!compare_key) { return NULL; } diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index fb1eec7..d2f3c1e 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -59,7 +59,7 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con self->st = NULL; self->in_use = 0; - sql_cstr = PyUnicode_AsStringAndSize(sql, &sql_cstr_len); + sql_cstr = _PyUnicode_AsStringAndSize(sql, &sql_cstr_len); if (sql_cstr == NULL) { rc = PYSQLITE_SQL_WRONG_TYPE; return rc; @@ -140,7 +140,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); break; case TYPE_UNICODE: - string = PyUnicode_AsString(parameter); + string = _PyUnicode_AsString(parameter); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); break; case TYPE_BUFFER: @@ -296,7 +296,7 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params) Py_ssize_t sql_len; sqlite3_stmt* new_st; - sql_cstr = PyUnicode_AsStringAndSize(self->sql, &sql_len); + sql_cstr = _PyUnicode_AsStringAndSize(self->sql, &sql_len); if (sql_cstr == NULL) { rc = PYSQLITE_SQL_WRONG_TYPE; return rc; diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 25b82b4..48318a8 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1461,7 +1461,7 @@ PySSL_RAND_egd(PyObject *self, PyObject *arg) return PyErr_Format(PyExc_TypeError, "RAND_egd() expected string, found %s", Py_TYPE(arg)->tp_name); - bytes = RAND_egd(PyUnicode_AsString(arg)); + bytes = RAND_egd(_PyUnicode_AsString(arg)); if (bytes == -1) { PyErr_SetString(PySSLErrorObject, "EGD connection failed or EGD did not return " diff --git a/Modules/_struct.c b/Modules/_struct.c index a1e56be..43be9ed 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -406,7 +406,7 @@ _range_error(const formatdef *f, int is_unsigned) if (msg == NULL) return -1; rval = PyErr_WarnEx(PyExc_DeprecationWarning, - PyUnicode_AsString(msg), 2); + _PyUnicode_AsString(msg), 2); Py_DECREF(msg); if (rval == 0) return 0; diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 45494dd..3ee3bf4 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -788,7 +788,7 @@ test_string_from_format(PyObject *self, PyObject *args) result = PyUnicode_FromFormat(FORMAT, (TYPE)1); \ if (result == NULL) \ return NULL; \ - if (strcmp(PyUnicode_AsString(result), "1")) { \ + if (strcmp(_PyUnicode_AsString(result), "1")) { \ msg = FORMAT " failed at 1"; \ goto Fail; \ } \ diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 4e36dac..3bbc7e4 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1424,7 +1424,7 @@ varname_converter(PyObject *in, void *_out) return 1; } if (PyUnicode_Check(in)) { - *out = PyUnicode_AsString(in); + *out = _PyUnicode_AsString(in); return 1; } if (PyTclObject_Check(in)) { diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h index 89c644c..0530a33 100644 --- a/Modules/cjkcodecs/cjkcodecs.h +++ b/Modules/cjkcodecs/cjkcodecs.h @@ -266,7 +266,7 @@ getcodec(PyObject *self, PyObject *encoding) "encoding name must be a string."); return NULL; } - enc = PyUnicode_AsString(encoding); + enc = _PyUnicode_AsString(encoding); if (enc == NULL) return NULL; diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index e65a9a4..dbd5314 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -95,7 +95,7 @@ call_error_callback(PyObject *errors, PyObject *exc) const char *str; assert(PyUnicode_Check(errors)); - str = PyUnicode_AsString(errors); + str = _PyUnicode_AsString(errors); if (str == NULL) return NULL; cb = PyCodec_LookupError(str); @@ -148,7 +148,7 @@ codecctx_errors_set(MultibyteStatefulCodecContext *self, PyObject *value, return -1; } - str = PyUnicode_AsString(value); + str = _PyUnicode_AsString(value); if (str == NULL) return -1; diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index 4dd4fe31..702b6b9 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -1219,7 +1219,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, assert(object && format && timetuple); assert(PyUnicode_Check(format)); /* Convert the input format to a C string and size */ - pin = PyUnicode_AsStringAndSize(format, &flen); + pin = _PyUnicode_AsStringAndSize(format, &flen); if (!pin) return NULL; @@ -1312,7 +1312,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, } assert(Zreplacement != NULL); assert(PyUnicode_Check(Zreplacement)); - ptoappend = PyUnicode_AsStringAndSize(Zreplacement, + ptoappend = _PyUnicode_AsStringAndSize(Zreplacement, &ntoappend); ntoappend = Py_SIZE(Zreplacement); } diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index 039f794..ca442e5 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -113,7 +113,7 @@ grp_getgrnam(PyObject *self, PyObject *pyo_name) py_str_name = PyObject_Str(pyo_name); if (!py_str_name) return NULL; - name = PyUnicode_AsString(py_str_name); + name = _PyUnicode_AsString(py_str_name); if ((p = getgrnam(name)) == NULL) { PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %s", name); diff --git a/Modules/operator.c b/Modules/operator.c index d31b178..1398fca 100644 --- a/Modules/operator.c +++ b/Modules/operator.c @@ -449,7 +449,7 @@ dotted_getattr(PyObject *obj, PyObject *attr) return NULL; } - s = PyUnicode_AsString(attr); + s = _PyUnicode_AsString(attr); Py_INCREF(obj); for (;;) { PyObject *newobj, *str; diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index 8f66144..5828c3f 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -809,7 +809,7 @@ oss_getattro(oss_audio_t *self, PyObject *nameobj) PyObject * rval = NULL; if (PyUnicode_Check(nameobj)) - name = PyUnicode_AsString(nameobj); + name = _PyUnicode_AsString(nameobj); if (strcmp(name, "closed") == 0) { rval = (self->fd == -1) ? Py_True : Py_False; diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 4056816..2a61eec 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -718,7 +718,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num) Py_DECREF(o); } } - temp_str = PyUnicode_AsStringAndSize(temp, &len); + temp_str = _PyUnicode_AsStringAndSize(temp, &len); strn = (char *)PyObject_MALLOC(len + 1); if (strn != NULL) (void) memcpy(strn, temp_str, len + 1); @@ -807,7 +807,7 @@ build_node_tree(PyObject *tuple) if (res && encoding) { Py_ssize_t len; const char *temp; - temp = PyUnicode_AsStringAndSize(encoding, &len); + temp = _PyUnicode_AsStringAndSize(encoding, &len); res->n_str = (char *)PyObject_MALLOC(len + 1); if (res->n_str != NULL && temp != NULL) (void) memcpy(res->n_str, temp, len + 1); diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 4cdaf25..3b79d05 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5566,7 +5566,7 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table, "configuration names must be strings or integers"); return 0; } - confname = PyUnicode_AsString(arg); + confname = _PyUnicode_AsString(arg); if (confname == NULL) return 0; while (lo < hi) { @@ -5897,7 +5897,7 @@ posix_confstr(PyObject *self, PyObject *args) if ((unsigned int)len >= sizeof(buffer)) { result = PyUnicode_FromStringAndSize(NULL, len-1); if (result != NULL) - confstr(name, PyUnicode_AsString(result), len); + confstr(name, _PyUnicode_AsString(result), len); } else result = PyUnicode_FromStringAndSize(buffer, len-1); diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index e85f392..df37589 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1338,7 +1338,7 @@ xmlparse_getattro(xmlparseobject *self, PyObject *nameobj) int handlernum = -1; if (PyUnicode_Check(nameobj)) - name = PyUnicode_AsString(nameobj); + name = _PyUnicode_AsString(nameobj); handlernum = handlername2int(name); diff --git a/Modules/readline.c b/Modules/readline.c index 98da33b..8371942 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -724,7 +724,7 @@ on_completion(const char *text, int state) result = NULL; } else { - char *s = PyUnicode_AsString(r); + char *s = _PyUnicode_AsString(r); if (s == NULL) goto error; result = strdup(s); diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index b948132..de802ae 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -3744,7 +3744,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args) PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", value); pptr = pbuf; } else if (PyUnicode_Check(pobj)) { - pptr = PyUnicode_AsString(pobj); + pptr = _PyUnicode_AsString(pobj); } else if (PyBytes_Check(pobj)) { pptr = PyBytes_AsString(pobj); } else if (pobj == Py_None) { diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 6c78679..c6a3b36 100644 --- a/Modules/syslogmodule.c +++ b/Modules/syslogmodule.c @@ -72,7 +72,7 @@ syslog_openlog(PyObject * self, PyObject * args) S_ident_o = new_S_ident_o; Py_INCREF(S_ident_o); - ident = PyUnicode_AsString(S_ident_o); + ident = _PyUnicode_AsString(S_ident_o); if (ident == NULL) return NULL; openlog(ident, logopt, facility); @@ -97,7 +97,7 @@ syslog_syslog(PyObject * self, PyObject * args) return NULL; } - message = PyUnicode_AsString(message_object); + message = _PyUnicode_AsString(message_object); if (message == NULL) return NULL; Py_BEGIN_ALLOW_THREADS; diff --git a/Modules/timemodule.c b/Modules/timemodule.c index d2817fb..c32b53d 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -509,7 +509,7 @@ time_strftime(PyObject *self, PyObject *args) } /* Convert the unicode string to an ascii one */ - fmt = PyUnicode_AsString(format); + fmt = _PyUnicode_AsString(format); fmtlen = strlen(fmt); diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 023d1d4..336859d 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -180,9 +180,9 @@ zipimporter_repr(ZipImporter *self) char *prefix = ""; if (self->archive != NULL && PyUnicode_Check(self->archive)) - archive = PyUnicode_AsString(self->archive); + archive = _PyUnicode_AsString(self->archive); if (self->prefix != NULL && PyUnicode_Check(self->prefix)) - prefix = PyUnicode_AsString(self->prefix); + prefix = _PyUnicode_AsString(self->prefix); if (prefix != NULL && *prefix) return PyUnicode_FromFormat("<zipimporter object \"%.300s%c%.150s\">", archive, SEP, prefix); @@ -248,7 +248,7 @@ get_module_info(ZipImporter *self, char *fullname) subname = get_subname(fullname); - len = make_filename(PyUnicode_AsString(self->prefix), subname, path); + len = make_filename(_PyUnicode_AsString(self->prefix), subname, path); if (len < 0) return MI_ERROR; @@ -321,12 +321,12 @@ zipimporter_load_module(PyObject *obj, PyObject *args) /* add __path__ to the module *before* the code gets executed */ PyObject *pkgpath, *fullpath; - char *prefix = PyUnicode_AsString(self->prefix); + char *prefix = _PyUnicode_AsString(self->prefix); char *subname = get_subname(fullname); int err; fullpath = PyUnicode_FromFormat("%s%c%s%s", - PyUnicode_AsString(self->archive), + _PyUnicode_AsString(self->archive), SEP, prefix ? prefix : "", subname); @@ -404,7 +404,7 @@ zipimporter_get_data(PyObject *obj, PyObject *args) } path = buf; #endif - archive_str = PyUnicode_AsStringAndSize(self->archive, &len); + archive_str = _PyUnicode_AsStringAndSize(self->archive, &len); if ((size_t)len < strlen(path) && strncmp(path, archive_str, len) == 0 && path[len] == SEP) { @@ -453,7 +453,7 @@ zipimporter_get_source(PyObject *obj, PyObject *args) } subname = get_subname(fullname); - len = make_filename(PyUnicode_AsString(self->prefix), subname, path); + len = make_filename(_PyUnicode_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -466,7 +466,7 @@ zipimporter_get_source(PyObject *obj, PyObject *args) toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) { - PyObject *bytes = get_data(PyUnicode_AsString(self->archive), toc_entry); + PyObject *bytes = get_data(_PyUnicode_AsString(self->archive), toc_entry); PyObject *res = PyUnicode_FromString(PyByteArray_AsString(bytes)); Py_XDECREF(bytes); return res; @@ -1053,7 +1053,7 @@ get_code_from_data(ZipImporter *self, int ispackage, int isbytecode, { PyObject *data, *code; char *modpath; - char *archive = PyUnicode_AsString(self->archive); + char *archive = _PyUnicode_AsString(self->archive); if (archive == NULL) return NULL; @@ -1062,7 +1062,7 @@ get_code_from_data(ZipImporter *self, int ispackage, int isbytecode, if (data == NULL) return NULL; - modpath = PyUnicode_AsString(PyTuple_GetItem(toc_entry, 0)); + modpath = _PyUnicode_AsString(PyTuple_GetItem(toc_entry, 0)); if (isbytecode) { code = unmarshal_code(modpath, data, mtime); @@ -1087,7 +1087,7 @@ get_module_code(ZipImporter *self, char *fullname, subname = get_subname(fullname); - len = make_filename(PyUnicode_AsString(self->prefix), subname, path); + len = make_filename(_PyUnicode_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -1097,7 +1097,7 @@ get_module_code(ZipImporter *self, char *fullname, strcpy(path + len, zso->suffix); if (Py_VerboseFlag > 1) PySys_WriteStderr("# trying %s%c%s\n", - PyUnicode_AsString(self->archive), + _PyUnicode_AsString(self->archive), SEP, path); toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) { @@ -1119,7 +1119,7 @@ get_module_code(ZipImporter *self, char *fullname, continue; } if (code != NULL && p_modpath != NULL) - *p_modpath = PyUnicode_AsString( + *p_modpath = _PyUnicode_AsString( PyTuple_GetItem(toc_entry, 0)); return code; } |