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
cf57d8b8
Commit
cf57d8b8
authored
Jan 19, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tok_nextc() should return unsigned characters, to avoid mistaking
'\377' for EOF.
parent
d29806c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
Parser/tokenizer.c
Parser/tokenizer.c
+10
-2
No files found.
Parser/tokenizer.c
View file @
cf57d8b8
...
...
@@ -46,6 +46,14 @@ extern char *PyOS_Readline Py_PROTO((char *));
/* Don't ever change this -- it would break the portability of Python code */
#define TABSIZE 8
/* Convert a possibly signed character to a nonnegative int */
/* XXX This assumes characters are 8 bits wide */
#ifdef __CHAR_UNSIGNED__
#define Py_CHARMASK(c) (c)
#else
#define Py_CHARMASK(c) ((c) & 0xff)
#endif
/* Forward */
static
struct
tok_state
*
tok_new
Py_PROTO
((
void
));
static
int
tok_nextc
Py_PROTO
((
struct
tok_state
*
tok
));
...
...
@@ -178,7 +186,7 @@ tok_nextc(tok)
{
for
(;;)
{
if
(
tok
->
cur
!=
tok
->
inp
)
{
return
*
tok
->
cur
++
;
/* Fast path */
return
Py_CHARMASK
(
*
tok
->
cur
++
)
;
/* Fast path */
}
if
(
tok
->
done
!=
E_OK
)
return
EOF
;
...
...
@@ -197,7 +205,7 @@ tok_nextc(tok)
tok
->
buf
=
tok
->
cur
;
tok
->
lineno
++
;
tok
->
inp
=
end
;
return
*
tok
->
cur
++
;
return
Py_CHARMASK
(
*
tok
->
cur
++
)
;
}
if
(
tok
->
prompt
!=
NULL
)
{
char
*
new
=
PyOS_Readline
(
tok
->
prompt
);
...
...
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