Commit 19468dd9 authored by Stefan Behnel's avatar Stefan Behnel

Support CPython builds with docstrings disabled by wrapping docstring literals...

Support CPython builds with docstrings disabled by wrapping docstring literals in the `PyDoc_STR()` macro.
Closes GH-884.
parent d6ea7356
......@@ -2209,7 +2209,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if doc:
if doc.is_unicode:
doc = doc.as_utf8_string()
doc_code = doc.as_c_string_literal()
doc_code = "PyDoc_STR(%s)" % doc.as_c_string_literal()
else:
doc_code = "0"
code.putln(
......
......@@ -3483,7 +3483,7 @@ class DefNodeWrapper(FuncDefNode):
docstr = docstr.as_utf8_string()
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,
docstr.as_c_string_literal()))
......
......@@ -446,7 +446,7 @@ class DocStringSlot(SlotDescriptor):
return "0"
if doc.is_unicode:
doc = doc.as_utf8_string()
return doc.as_c_string_literal()
return "PyDoc_STR(%s)" % doc.as_c_string_literal()
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