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.'
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."