summaryrefslogtreecommitdiff
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
authorMariatta Wijaya <mariatta.wijaya@gmail.com>2017-02-06 20:16:58 -0800
committerMariatta Wijaya <mariatta.wijaya@gmail.com>2017-02-06 20:16:58 -0800
commitda79bcf8ac7ae72218ab023e1ed54390bc1a3a27 (patch)
tree74845e2dbd9521d9748b9c32f1922f4123083bf3 /Objects/moduleobject.c
parente3c7e835bdfc97750eb9b7fc0ad2493108c2d438 (diff)
parent1fe806ac56f8b83694d24ab604eb695d00bc8497 (diff)
downloadcpython-da79bcf8ac7ae72218ab023e1ed54390bc1a3a27.tar.gz
Issue #29371: merge with 3.5
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index ae72da6e3b..79be51a806 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -380,7 +380,7 @@ PyModule_ExecDef(PyObject *module, PyModuleDef *def)
for (cur_slot = def->m_slots; cur_slot && cur_slot->slot; cur_slot++) {
switch (cur_slot->slot) {
case Py_mod_create:
- /* handled in PyModule_CreateFromSlots */
+ /* handled in PyModule_FromDefAndSpec2 */
break;
case Py_mod_exec:
ret = ((int (*)(PyObject *))cur_slot->value)(module);
@@ -450,8 +450,7 @@ PyModule_GetDict(PyObject *m)
return NULL;
}
d = ((PyModuleObject *)m) -> md_dict;
- if (d == NULL)
- ((PyModuleObject *)m) -> md_dict = d = PyDict_New();
+ assert(d != NULL);
return d;
}
@@ -484,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*
@@ -517,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;
}
@@ -570,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
@@ -590,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