Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b3bbfb4c
Commit
b3bbfb4c
authored
Oct 17, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docstring bugfix (#103)
parent
e2f43afd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+4
-2
tests/run/r_docstrings.pyx
tests/run/r_docstrings.pyx
+14
-2
No files found.
Cython/Compiler/Parsing.py
View file @
b3bbfb4c
...
...
@@ -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
]
" % (
...
...
tests/run/r_docstrings.pyx
View file @
b3bbfb4c
__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."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment