avoid unnecessary overhead when setting Python class docstrings
authorStefan Behnel <stefan_ml@behnel.de>
Sun, 13 Oct 2013 18:44:49 +0000 (20:44 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Sun, 13 Oct 2013 18:44:49 +0000 (20:44 +0200)
Cython/Compiler/ExprNodes.py

index 6a74f6c..d95ca8b 100755 (executable)
@@ -6680,8 +6680,10 @@ class ClassNode(ExprNode, ModuleNameMixin):
 
         if self.doc:
             code.put_error_if_neg(self.pos,
-                'PyDict_SetItemString(%s, "__doc__", %s)' % (
+                'PyDict_SetItem(%s, %s, %s)' % (
                     self.dict.py_result(),
+                    code.intern_identifier(
+                        StringEncoding.EncodedString("__doc__")),
                     self.doc.py_result()))
         py_mod_name = self.get_py_mod_name(code)
         qualname = self.get_py_qualified_name(code)