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
fafa8b77
Commit
fafa8b77
authored
Nov 03, 2012
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Plain Diff
#16152: merge with 3.2.
parents
4af77a02
2cc3b4ba
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 @
fafa8b77
...
...
@@ -1109,6 +1109,10 @@ class TestTokenize(TestCase):
token
.
NAME
,
token
.
AMPER
,
token
.
NUMBER
,
token
.
RPAR
)
def
test_pathological_trailing_whitespace
(
self
):
# See http://bugs.python.org/issue16152
self
.
assertExactTypeEqual
(
'@ '
,
token
.
AT
)
__test__
=
{
"doctests"
:
doctests
,
'decistmt'
:
decistmt
}
def
test_main
():
...
...
Lib/tokenize.py
View file @
fafa8b77
...
...
@@ -162,7 +162,7 @@ ContStr = group(StringPrefix + r"'[^\n'\\]*(?:\\.[^\n'\\]*)*" +
group
(
"'"
,
r'\\\r?\n'
),
StringPrefix
+
r'"[^\n"\\]*(?:\\.[^\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)
def _compile(expr):
...
...
@@ -555,6 +555,8 @@ def _tokenize(readline, encoding):
if pseudomatch: # scan for tokens
start, end = pseudomatch.span(1)
spos, epos, pos = (lnum, start), (lnum, end), end
if start == end:
continue
token, initial = line[start:end], line[start]
if (initial in numchars or # ordinary number
...
...
Misc/ACKS
View file @
fafa8b77
...
...
@@ -77,6 +77,7 @@ Ulf Bartelt
Don Bashford
Pior Bastida
Nick Bastin
Ned Batchelder
Jeff Bauer
Michael R Bax
Anthony Baxter
...
...
Misc/NEWS
View file @
fafa8b77
...
...
@@ -61,6 +61,9 @@ Core and Builtins
Library
-------
-
Issue
#
16152
:
fix
tokenize
to
ignore
whitespace
at
the
end
of
the
code
when
no
newline
is
found
.
Patch
by
Ned
Batchelder
.
-
Issue
#
1207589
:
Add
Cut
/
Copy
/
Paste
items
to
IDLE
right
click
Context
Menu
Patch
by
Todd
Rovito
.
...
...
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