summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-09-28 05:41:54 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-09-28 05:41:54 (GMT)
commitd63a3b8beb4a0841cb59fb3515347ccaab34b733 (patch)
tree3b4e3cc63151c5a5a910c3550a190aefaea96ad4 /Objects/moduleobject.c
parent48d49497c50e79d14e9df9527d766ca3a0a38be5 (diff)
downloadcpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.zip
cpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.gz
cpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.bz2
Implement PEP 393.
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 3817ef3..4b4f9d1 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -285,8 +285,8 @@ _PyModule_Clear(PyObject *m)
pos = 0;
while (PyDict_Next(d, &pos, &key, &value)) {
if (value != Py_None && PyUnicode_Check(key)) {
- Py_UNICODE *u = PyUnicode_AS_UNICODE(key);
- if (u[0] == '_' && u[1] != '_') {
+ if (PyUnicode_READ_CHAR(key, 0) == '_' &&
+ PyUnicode_READ_CHAR(key, 1) != '_') {
if (Py_VerboseFlag > 1) {
const char *s = _PyUnicode_AsString(key);
if (s != NULL)
@@ -303,9 +303,8 @@ _PyModule_Clear(PyObject *m)
pos = 0;
while (PyDict_Next(d, &pos, &key, &value)) {
if (value != Py_None && PyUnicode_Check(key)) {
- Py_UNICODE *u = PyUnicode_AS_UNICODE(key);
- if (u[0] != '_'
- || PyUnicode_CompareWithASCIIString(key, "__builtins__") != 0)
+ if (PyUnicode_READ_CHAR(key, 0) != '_' ||
+ PyUnicode_CompareWithASCIIString(key, "__builtins__") != 0)
{
if (Py_VerboseFlag > 1) {
const char *s = _PyUnicode_AsString(key);