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
052969a6
Commit
052969a6
authored
Jul 21, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use calculations on values gotten from tell(). Also use a
slightly different way to test for the existence of unread.
parent
897b9f0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
Lib/rfc822.py
Lib/rfc822.py
+11
-4
No files found.
Lib/rfc822.py
View file @
052969a6
...
...
@@ -125,7 +125,14 @@ class Message:
self
.
status
=
''
headerseen
=
""
firstline
=
1
startofline
=
unread
=
tell
=
None
if
hasattr
(
self
.
fp
,
'unread'
):
unread
=
self
.
fp
.
unread
elif
self
.
seekable
:
tell
=
self
.
fp
.
tell
while
1
:
if
tell
:
startofline
=
tell
()
line
=
self
.
fp
.
readline
()
if
not
line
:
self
.
status
=
'EOF in headers'
...
...
@@ -160,10 +167,10 @@ class Message:
else
:
self
.
status
=
'Non-header line where header expected'
# Try to undo the read.
if
hasattr
(
self
.
fp
,
'unread'
)
:
self
.
fp
.
unread
(
line
)
elif
self
.
seekable
:
self
.
fp
.
seek
(
-
len
(
line
),
1
)
if
unread
:
unread
(
line
)
elif
tell
:
self
.
fp
.
seek
(
startofline
)
else
:
self
.
status
=
self
.
status
+
'; bad seek'
break
...
...
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