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
a07548e9
Commit
a07548e9
authored
Jun 21, 2012
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14653: email.utils.mktime_tz() no longer relies on system
mktime() when timezone offest is supplied.
parent
9ed8b4e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
Lib/email/_parseaddr.py
Lib/email/_parseaddr.py
+4
-4
Lib/email/test/test_email.py
Lib/email/test/test_email.py
+6
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/email/_parseaddr.py
View file @
a07548e9
...
...
@@ -13,7 +13,7 @@ __all__ = [
'quote'
,
]
import
time
import
time
,
calendar
SPACE
=
' '
EMPTYSTRING
=
''
...
...
@@ -152,13 +152,13 @@ def parsedate(data):
def
mktime_tz
(
data
):
"""Turn a 10-tuple as returned by parsedate_tz() into a
UTC
timestamp."""
"""Turn a 10-tuple as returned by parsedate_tz() into a
POSIX
timestamp."""
if
data
[
9
]
is
None
:
# No zone info, so localtime is better assumption than GMT
return
time
.
mktime
(
data
[:
8
]
+
(
-
1
,))
else
:
t
=
time
.
mktime
(
data
[:
8
]
+
(
0
,)
)
return
t
-
data
[
9
]
-
time
.
timezone
t
=
calendar
.
timegm
(
data
)
return
t
-
data
[
9
]
def
quote
(
str
):
...
...
Lib/email/test/test_email.py
View file @
a07548e9
...
...
@@ -2585,6 +2585,12 @@ class TestMiscellaneous(TestEmailBase):
eq
(
time
.
localtime
(
t
)[:
6
],
timetup
[:
6
])
eq
(
int
(
time
.
strftime
(
'%Y'
,
timetup
[:
9
])),
2003
)
def
test_mktime_tz
(
self
):
self
.
assertEqual
(
utils
.
mktime_tz
((
1970
,
1
,
1
,
0
,
0
,
0
,
-
1
,
-
1
,
-
1
,
0
)),
0
)
self
.
assertEqual
(
utils
.
mktime_tz
((
1970
,
1
,
1
,
0
,
0
,
0
,
-
1
,
-
1
,
-
1
,
1234
)),
-
1234
)
def
test_parsedate_y2k
(
self
):
"""Test for parsing a date with a two-digit year.
...
...
Misc/NEWS
View file @
a07548e9
...
...
@@ -73,6 +73,9 @@ Core and Builtins
Library
-------
- Issue #14653: email.utils.mktime_tz() no longer relies on system
mktime() when timezone offest is supplied.
- Fix GzipFile's handling of filenames given as bytes objects.
- Issue #15101: Make pool finalizer avoid joining current thread.
...
...
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