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
0ee4963a
Commit
0ee4963a
authored
Nov 03, 2012
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Plain Diff
#16152: merge with 3.3.
parents
d56fc582
58260191
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletion
+11
-1
Lib/test/test_tokenize.py
Lib/test/test_tokenize.py
+4
-0
Lib/tokenize.py
Lib/tokenize.py
+3
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_tokenize.py
View file @
0ee4963a
...
@@ -1109,6 +1109,10 @@ class TestTokenize(TestCase):
...
@@ -1109,6 +1109,10 @@ class TestTokenize(TestCase):
token
.
NAME
,
token
.
AMPER
,
token
.
NUMBER
,
token
.
NAME
,
token
.
AMPER
,
token
.
NUMBER
,
token
.
RPAR
)
token
.
RPAR
)
def
test_pathological_trailing_whitespace
(
self
):
# See http://bugs.python.org/issue16152
self
.
assertExactTypeEqual
(
'@ '
,
token
.
AT
)
__test__
=
{
"doctests"
:
doctests
,
'decistmt'
:
decistmt
}
__test__
=
{
"doctests"
:
doctests
,
'decistmt'
:
decistmt
}
def
test_main
():
def
test_main
():
...
...
Lib/tokenize.py
View file @
0ee4963a
...
@@ -162,7 +162,7 @@ ContStr = group(StringPrefix + r"'[^\n'\\]*(?:\\.[^\n'\\]*)*" +
...
@@ -162,7 +162,7 @@ ContStr = group(StringPrefix + r"'[^\n'\\]*(?:\\.[^\n'\\]*)*" +
group
(
"'"
,
r'\\\r?\n'
),
group
(
"'"
,
r'\\\r?\n'
),
StringPrefix
+
r'"[^\n"\\]*(?:\\.[^\n"\\]*)*'
+
StringPrefix
+
r'"[^\n"\\]*(?:\\.[^\n"\\]*)*'
+
group
(
'"'
,
r'\\\r?\n'
))
group
(
'"'
,
r'\\\r?\n'
))
PseudoExtras
=
group
(
r'\\\r?\n'
,
Comment
,
Triple
)
PseudoExtras
=
group
(
r'\\\r?\n
|\
Z
', Comment, Triple)
PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name)
PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name)
def _compile(expr):
def _compile(expr):
...
@@ -555,6 +555,8 @@ def _tokenize(readline, encoding):
...
@@ -555,6 +555,8 @@ def _tokenize(readline, encoding):
if pseudomatch: # scan for tokens
if pseudomatch: # scan for tokens
start, end = pseudomatch.span(1)
start, end = pseudomatch.span(1)
spos, epos, pos = (lnum, start), (lnum, end), end
spos, epos, pos = (lnum, start), (lnum, end), end
if start == end:
continue
token, initial = line[start:end], line[start]
token, initial = line[start:end], line[start]
if (initial in numchars or # ordinary number
if (initial in numchars or # ordinary number
...
...
Misc/ACKS
View file @
0ee4963a
...
@@ -77,6 +77,7 @@ Ulf Bartelt
...
@@ -77,6 +77,7 @@ Ulf Bartelt
Don Bashford
Don Bashford
Pior Bastida
Pior Bastida
Nick Bastin
Nick Bastin
Ned Batchelder
Jeff Bauer
Jeff Bauer
Michael R Bax
Michael R Bax
Anthony Baxter
Anthony Baxter
...
...
Misc/NEWS
View file @
0ee4963a
...
@@ -91,6 +91,9 @@ Core and Builtins
...
@@ -91,6 +91,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #16152: fix tokenize to ignore whitespace at the end of the code when
no newline is found. Patch by Ned Batchelder.
- Issue #16284: Prevent keeping unnecessary references to worker functions
- Issue #16284: Prevent keeping unnecessary references to worker functions
in concurrent.futures ThreadPoolExecutor.
in concurrent.futures ThreadPoolExecutor.
...
...
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