summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-20 07:13:07 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-20 07:13:07 (GMT)
commit06515833fef7b8b5c7968edf72367d94ff7eb1e0 (patch)
tree58a7c06bba8141883a5e5c8621d2b0683ae9fe2e /Objects
parente20973926a2ec19c4b87e460dc6f0edb478ce352 (diff)
downloadcpython-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 'Objects')
-rw-r--r--Objects/floatobject.c4
-rw-r--r--Objects/moduleobject.c8
-rw-r--r--Objects/object.c4
-rw-r--r--Objects/setobject.c2
-rw-r--r--Objects/structseq.c2
-rw-r--r--Objects/typeobject.c6
6 files changed, 13 insertions, 13 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 0f37618..80bf71e 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -1274,7 +1274,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
* exp+4*ndigits and exp-4*ndigits are within the range of a long.
*/
- s = _PyUnicode_AsStringAndSize(arg, &length);
+ s = PyUnicode_AsUTF8AndSize(arg, &length);
if (s == NULL)
return NULL;
s_end = s + length;
@@ -1628,7 +1628,7 @@ float_getformat(PyTypeObject *v, PyObject* arg)
Py_TYPE(arg)->tp_name);
return NULL;
}
- s = _PyUnicode_AsString(arg);
+ s = PyUnicode_AsUTF8(arg);
if (s == NULL)
return NULL;
if (strcmp(s, "double") == 0) {
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index b6a2d6f..79be51a 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -483,7 +483,7 @@ PyModule_GetName(PyObject *m)
if (name == NULL)
return NULL;
Py_DECREF(name); /* module dict has still a reference */
- return _PyUnicode_AsString(name);
+ return PyUnicode_AsUTF8(name);
}
PyObject*
@@ -516,7 +516,7 @@ PyModule_GetFilename(PyObject *m)
fileobj = PyModule_GetFilenameObject(m);
if (fileobj == NULL)
return NULL;
- utf8 = _PyUnicode_AsString(fileobj);
+ utf8 = PyUnicode_AsUTF8(fileobj);
Py_DECREF(fileobj); /* module dict has still a reference */
return utf8;
}
@@ -569,7 +569,7 @@ _PyModule_ClearDict(PyObject *d)
if (PyUnicode_READ_CHAR(key, 0) == '_' &&
PyUnicode_READ_CHAR(key, 1) != '_') {
if (Py_VerboseFlag > 1) {
- const char *s = _PyUnicode_AsString(key);
+ const char *s = PyUnicode_AsUTF8(key);
if (s != NULL)
PySys_WriteStderr("# clear[1] %s\n", s);
else
@@ -589,7 +589,7 @@ _PyModule_ClearDict(PyObject *d)
!_PyUnicode_EqualToASCIIString(key, "__builtins__"))
{
if (Py_VerboseFlag > 1) {
- const char *s = _PyUnicode_AsString(key);
+ const char *s = PyUnicode_AsUTF8(key);
if (s != NULL)
PySys_WriteStderr("# clear[2] %s\n", s);
else
diff --git a/Objects/object.c b/Objects/object.c
index 5c639b2..d88ae3b 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -890,7 +890,7 @@ PyObject_GetAttr(PyObject *v, PyObject *name)
if (tp->tp_getattro != NULL)
return (*tp->tp_getattro)(v, name);
if (tp->tp_getattr != NULL) {
- char *name_str = _PyUnicode_AsString(name);
+ char *name_str = PyUnicode_AsUTF8(name);
if (name_str == NULL)
return NULL;
return (*tp->tp_getattr)(v, name_str);
@@ -934,7 +934,7 @@ PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value)
return err;
}
if (tp->tp_setattr != NULL) {
- char *name_str = _PyUnicode_AsString(name);
+ char *name_str = PyUnicode_AsUTF8(name);
if (name_str == NULL)
return -1;
err = (*tp->tp_setattr)(v, name_str, value);
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 5846045..fdb9d36 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -2466,7 +2466,7 @@ test_c_api(PySetObject *so)
/* Exercise direct iteration */
i = 0, count = 0;
while (_PySet_NextEntry((PyObject *)dup, &i, &x, &hash)) {
- s = _PyUnicode_AsString(x);
+ s = PyUnicode_AsUTF8(x);
assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c'));
count++;
}
diff --git a/Objects/structseq.c b/Objects/structseq.c
index e315cba..5489aef 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -194,7 +194,7 @@ structseq_repr(PyStructSequence *obj)
repr = PyObject_Repr(val);
if (repr == NULL)
return NULL;
- crepr = _PyUnicode_AsString(repr);
+ crepr = PyUnicode_AsUTF8(repr);
if (crepr == NULL) {
Py_DECREF(repr);
return NULL;
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index dc9a80a..606e08e 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1626,7 +1626,7 @@ consistent method resolution\norder (MRO) for bases");
PyObject *name = class_name(k);
char *name_str;
if (name != NULL) {
- name_str = _PyUnicode_AsString(name);
+ name_str = PyUnicode_AsUTF8(name);
if (name_str == NULL)
name_str = "?";
} else
@@ -2575,7 +2575,7 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
char *doc_str;
char *tp_doc;
- doc_str = _PyUnicode_AsString(doc);
+ doc_str = PyUnicode_AsUTF8(doc);
if (doc_str == NULL)
goto error;
/* Silently truncate the docstring if it contains null bytes. */
@@ -2623,7 +2623,7 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
slotoffset = base->tp_basicsize;
if (et->ht_slots != NULL) {
for (i = 0; i < nslots; i++, mp++) {
- mp->name = _PyUnicode_AsString(
+ mp->name = PyUnicode_AsUTF8(
PyTuple_GET_ITEM(et->ht_slots, i));
if (mp->name == NULL)
goto error;