Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
415ed937
Commit
415ed937
authored
Feb 27, 2006
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip over doc strings.
parent
b9eb5510
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
Lib/compiler/future.py
Lib/compiler/future.py
+8
-1
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/compiler/future.py
View file @
415ed937
...
...
@@ -22,7 +22,14 @@ class FutureParser:
def
visitModule
(
self
,
node
):
stmt
=
node
.
node
found_docstring
=
False
for
s
in
stmt
.
nodes
:
# Skip over docstrings
if
not
found_docstring
and
isinstance
(
s
,
ast
.
Discard
)
\
and
isinstance
(
s
.
expr
,
ast
.
Const
)
\
and
isinstance
(
s
.
expr
.
value
,
str
):
found_docstring
=
True
continue
if
not
self
.
check_stmt
(
s
):
break
...
...
@@ -50,7 +57,7 @@ class BadFutureParser:
return
if
node
.
modname
!=
"__future__"
:
return
raise
SyntaxError
,
"invalid future statement
"
raise
SyntaxError
,
"invalid future statement
"
+
repr
(
node
)
def
find_futures
(
node
):
p1
=
FutureParser
()
...
...
Misc/NEWS
View file @
415ed937
...
...
@@ -393,6 +393,8 @@ Extension Modules
Library
-------
-
The
compiler
package
now
supports
future
imports
after
the
module
docstring
.
-
Bug
#
1413790
:
zipfile
now
sanitizes
absolute
archive
names
that
are
not
allowed
by
the
specs
.
...
...
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