summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-11-18 22:08:38 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-11-18 22:08:38 (GMT)
commit81f68a7d4b36be360b1dd28e6cbb49a43dc8937b (patch)
treef5f4ddb2c8e9f62dbaa5c81298d0d0407364360c /Python/compile.c
parent60fe569673eecaffd4afccd9b4d8a2c2bb4df15e (diff)
downloadcpython-81f68a7d4b36be360b1dd28e6cbb49a43dc8937b.zip
cpython-81f68a7d4b36be360b1dd28e6cbb49a43dc8937b.tar.gz
cpython-81f68a7d4b36be360b1dd28e6cbb49a43dc8937b.tar.bz2
Issue #22453: Warn against the use of leaking macro PyObject_REPR().
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 69419ec..ec7a4ac 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1412,12 +1412,12 @@ get_ref_type(struct compiler *c, PyObject *name)
PyOS_snprintf(buf, sizeof(buf),
"unknown scope for %.100s in %.100s(%s)\n"
"symbols: %s\nlocals: %s\nglobals: %s",
- PyBytes_AS_STRING(name),
- PyBytes_AS_STRING(c->u->u_name),
- PyObject_REPR(c->u->u_ste->ste_id),
- PyObject_REPR(c->u->u_ste->ste_symbols),
- PyObject_REPR(c->u->u_varnames),
- PyObject_REPR(c->u->u_names)
+ PyUnicode_AsUTF8(name),
+ PyUnicode_AsUTF8(c->u->u_name),
+ PyUnicode_AsUTF8(PyObject_Repr(c->u->u_ste->ste_id)),
+ PyUnicode_AsUTF8(PyObject_Repr(c->u->u_ste->ste_symbols)),
+ PyUnicode_AsUTF8(PyObject_Repr(c->u->u_varnames)),
+ PyUnicode_AsUTF8(PyObject_Repr(c->u->u_names))
);
Py_FatalError(buf);
}
@@ -1474,11 +1474,11 @@ compiler_make_closure(struct compiler *c, PyCodeObject *co, Py_ssize_t args, PyO
fprintf(stderr,
"lookup %s in %s %d %d\n"
"freevars of %s: %s\n",
- PyObject_REPR(name),
- PyBytes_AS_STRING(c->u->u_name),
+ PyUnicode_AsUTF8(PyObject_Repr(name)),
+ PyUnicode_AsUTF8(c->u->u_name),
reftype, arg,
- _PyUnicode_AsString(co->co_name),
- PyObject_REPR(co->co_freevars));
+ PyUnicode_AsUTF8(co->co_name),
+ PyUnicode_AsUTF8(PyObject_Repr(co->co_freevars)));
Py_FatalError("compiler_make_closure()");
}
ADDOP_I(c, LOAD_CLOSURE, arg);