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
1064a13b
Commit
1064a13b
authored
Jan 09, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not reset the line number because we already set file position to correct
value. (fixes error in patch for issue #18960)
parent
50b82c76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
Lib/test/test_traceback.py
Lib/test/test_traceback.py
+4
-0
Parser/tokenizer.c
Parser/tokenizer.c
+0
-8
No files found.
Lib/test/test_traceback.py
View file @
1064a13b
...
...
@@ -146,6 +146,10 @@ class SyntaxTracebackCases(unittest.TestCase):
text
,
charset
,
4
)
do_test
(
"#!shebang
\
n
# coding: {0}
\
n
"
.
format
(
charset
),
text
,
charset
,
5
)
do_test
(
"
\
t
\
f
\
n
# coding: {0}
\
n
"
.
format
(
charset
),
text
,
charset
,
5
)
# Issue #18960: coding spec should has no effect
do_test
(
"0
\
n
# coding: GBK
\
n
"
,
"h
\
xe9
ho"
,
'utf-8'
,
5
)
class
TracebackFormatTests
(
unittest
.
TestCase
):
...
...
Parser/tokenizer.c
View file @
1064a13b
...
...
@@ -514,14 +514,6 @@ fp_setreadl(struct tok_state *tok, const char* enc)
readline
=
_PyObject_GetAttrId
(
stream
,
&
PyId_readline
);
tok
->
decoding_readline
=
readline
;
/* The file has been reopened; parsing will restart from
* the beginning of the file, we have to reset the line number.
* But this function has been called from inside tok_nextc() which
* will increment lineno before it returns. So we set it -1 so that
* the next call to tok_nextc() will start with tok->lineno == 0.
*/
tok
->
lineno
=
-
1
;
cleanup:
Py_XDECREF
(
stream
);
Py_XDECREF
(
io
);
...
...
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