Commit a1b85697 authored by Stefan Behnel's avatar Stefan Behnel Committed by GitHub

Merge pull request #2883 from cython/gh884_docstrings

Support CPython builds with docstrings disabled
parents d6ea7356 19468dd9
...@@ -2209,7 +2209,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -2209,7 +2209,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if doc: if doc:
if doc.is_unicode: if doc.is_unicode:
doc = doc.as_utf8_string() doc = doc.as_utf8_string()
doc_code = doc.as_c_string_literal() doc_code = "PyDoc_STR(%s)" % doc.as_c_string_literal()
else: else:
doc_code = "0" doc_code = "0"
code.putln( code.putln(
......
...@@ -3483,7 +3483,7 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3483,7 +3483,7 @@ class DefNodeWrapper(FuncDefNode):
docstr = docstr.as_utf8_string() docstr = docstr.as_utf8_string()
if not (entry.is_special and entry.name in ('__getbuffer__', '__releasebuffer__')): if not (entry.is_special and entry.name in ('__getbuffer__', '__releasebuffer__')):
code.putln('static char %s[] = %s;' % ( code.putln('PyDoc_STRVAR(%s, %s);' % (
entry.doc_cname, entry.doc_cname,
docstr.as_c_string_literal())) docstr.as_c_string_literal()))
......
...@@ -446,7 +446,7 @@ class DocStringSlot(SlotDescriptor): ...@@ -446,7 +446,7 @@ class DocStringSlot(SlotDescriptor):
return "0" return "0"
if doc.is_unicode: if doc.is_unicode:
doc = doc.as_utf8_string() doc = doc.as_utf8_string()
return doc.as_c_string_literal() return "PyDoc_STR(%s)" % doc.as_c_string_literal()
class SuiteSlot(SlotDescriptor): class SuiteSlot(SlotDescriptor):
......
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