Commit 2895952e authored by Stefan Behnel's avatar Stefan Behnel

class names are identifiers, too

parent eaa1722e
......@@ -2423,11 +2423,10 @@ class ClassNode(ExprNode):
# doc ExprNode or None Doc string
# module_name string Name of defining module
subexprs = ['name', 'bases', 'doc']
subexprs = ['bases', 'doc']
def analyse_types(self, env):
self.name.analyse_types(env)
self.name = self.name.coerce_to_pyobject(env)
self.cname = env.intern_identifier(self.name)
self.bases.analyse_types(env)
if self.doc:
self.doc.analyse_types(env)
......@@ -2448,7 +2447,7 @@ class ClassNode(ExprNode):
self.result_code,
self.bases.py_result(),
self.dict.py_result(),
self.name.py_result(),
self.cname,
self.module_name,
code.error_goto_if_null(self.result_code, self.pos)))
......@@ -4022,7 +4021,11 @@ static PyObject *__Pyx_CreateClass(
PyObject *py_modname;
PyObject *result = 0;
#if PY_MAJOR_VERSION < 3
py_modname = PyString_FromString(modname);
#else
py_modname = PyUnicode_FromString(modname);
#endif
if (!py_modname)
goto bad;
if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
......
......@@ -1967,8 +1967,7 @@ class PyClassDefNode(StatNode, BlockNode):
doc_node = ExprNodes.StringNode(pos, value = doc)
else:
doc_node = None
self.classobj = ExprNodes.ClassNode(pos,
name = ExprNodes.StringNode(pos, value = name),
self.classobj = ExprNodes.ClassNode(pos, name = name,
bases = bases, dict = self.dict, doc = doc_node)
self.target = ExprNodes.NameNode(pos, name = name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment