Commit b3bbfb4c authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Docstring bugfix (#103)

parent e2f43afd
......@@ -2401,14 +2401,16 @@ def p_compiler_directive_comments(s):
def p_module(s, pxd, full_module_name):
pos = s.position()
option_comments = p_compiler_directive_comments(s)
s.parse_comments = False
doc = p_doc_string(s)
if pxd:
level = 'module_pxd'
else:
level = 'module'
option_comments = p_compiler_directive_comments(s)
s.parse_comments = False
body = p_statement_list(s, Ctx(level = level), first_statement = 1)
if s.sy != 'EOF':
s.error("Syntax error in statement [%s,%s]" % (
......
__doc__ = u"""# Python 3 gets all of these right ...
# Some comments first
# More comments
'A module docstring'
doctest = u"""# Python 3 gets all of these right ...
>>> __doc__
'A module docstring'
>>> f.__doc__
'This is a function docstring.'
......@@ -38,7 +48,9 @@ Compare with standard Python:
import sys
if sys.version_info[0] >= 3:
__doc__ = __doc__.replace(u" u'", u" '")
doctest = doctest.replace(u" u'", u" '")
__test__ = {"test_docstrings" : doctest}
def f():
u"This is a function docstring."
......
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