summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-24 08:35:35 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-24 08:35:35 (GMT)
commit5951f2300f43d75d344d542e171daed47a0382a6 (patch)
tree2e173dda0c0d4c4bf887e8a6a309430d0d9cd5be /Python/compile.c
parent6ed42ea08b3a961944e94f1dd941ffabc7657065 (diff)
downloadcpython-5951f2300f43d75d344d542e171daed47a0382a6.zip
cpython-5951f2300f43d75d344d542e171daed47a0382a6.tar.gz
cpython-5951f2300f43d75d344d542e171daed47a0382a6.tar.bz2
Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 2900757..01b9fe0 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1455,9 +1455,8 @@ compiler_class(struct compiler *c, stmt_ty s)
if (!compiler_enter_scope(c, s->v.ClassDef.name, (void *)s,
s->lineno))
return 0;
- Py_XDECREF(c->u->u_private);
- c->u->u_private = s->v.ClassDef.name;
- Py_INCREF(c->u->u_private);
+ Py_INCREF(s->v.ClassDef.name);
+ Py_SETREF(c->u->u_private, s->v.ClassDef.name);
str = PyString_InternFromString("__name__");
if (!str || !compiler_nameop(c, str, Load)) {
Py_XDECREF(str);