<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Lib/test/test_email/test_utils.py, branch enum-private-310</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/'/>
<entry>
<title>bpo-30681: Support invalid date format or value in email Date header (GH-22090)</title>
<updated>2020-10-27T00:31:06+00:00</updated>
<author>
<name>Georges Toth</name>
<email>georges@trypill.org</email>
</author>
<published>2020-10-27T00:31:06+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=303aac8c56609290e122eecc14c038e9b1e4174a'/>
<id>303aac8c56609290e122eecc14c038e9b1e4174a</id>
<content type='text'>
I am re-submitting an older PR which was abandoned but is still relevant, #10783 by @timb07.

The issue being solved () is still relevant. The original PR #10783 was closed as
the final request changes were not applied and since abandoned.

In this new PR I have re-used the original patch plus applied both comments from the review, by @maxking and @pganssle.


For reference, here is the original PR description:
In email.utils.parsedate_to_datetime(), a failure to parse the date, or invalid date components (such as hour outside 0..23) raises an exception. Document this behaviour, and add tests to test_email/test_utils.py to confirm this behaviour.

In email.headerregistry.DateHeader.parse(), check when parsedate_to_datetime() raises an exception and add a new defect InvalidDateDefect; preserve the invalid value as the string value of the header, but set the datetime attribute to None.

Add tests to test_email/test_headerregistry.py to confirm this behaviour; also added test to test_email/test_inversion.py to confirm emails with such defective date headers round trip successfully.

This pull request incorporates feedback gratefully received from @bitdancer, @brettcannon, @Mariatta and @warsaw, and replaces the earlier PR #2254.

Automerge-Triggered-By: GH:warsaw</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I am re-submitting an older PR which was abandoned but is still relevant, #10783 by @timb07.

The issue being solved () is still relevant. The original PR #10783 was closed as
the final request changes were not applied and since abandoned.

In this new PR I have re-used the original patch plus applied both comments from the review, by @maxking and @pganssle.


For reference, here is the original PR description:
In email.utils.parsedate_to_datetime(), a failure to parse the date, or invalid date components (such as hour outside 0..23) raises an exception. Document this behaviour, and add tests to test_email/test_utils.py to confirm this behaviour.

In email.headerregistry.DateHeader.parse(), check when parsedate_to_datetime() raises an exception and add a new defect InvalidDateDefect; preserve the invalid value as the string value of the header, but set the datetime attribute to None.

Add tests to test_email/test_headerregistry.py to confirm this behaviour; also added test to test_email/test_inversion.py to confirm emails with such defective date headers round trip successfully.

This pull request incorporates feedback gratefully received from @bitdancer, @brettcannon, @Mariatta and @warsaw, and replaces the earlier PR #2254.

Automerge-Triggered-By: GH:warsaw</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-35317: Fix mktime() error in test_email (GH-10721)</title>
<updated>2018-11-27T11:40:50+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@redhat.com</email>
</author>
<published>2018-11-27T11:40:50+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=cfaafda8e3e19764682abb4bd4c574accb784c42'/>
<id>cfaafda8e3e19764682abb4bd4c574accb784c42</id>
<content type='text'>
Fix mktime() overflow error in test_email: run
test_localtime_daylight_true_dst_true() and
test_localtime_daylight_false_dst_true() with a specific timezone.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix mktime() overflow error in test_email: run
test_localtime_daylight_true_dst_true() and
test_localtime_daylight_false_dst_true() with a specific timezone.</pre>
</div>
</content>
</entry>
<entry>
<title>Issue #24836: Skip FormatDateTests of test_email.test_utils on Mac OS X Snow</title>
<updated>2015-09-18T14:32:23+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>victor.stinner@gmail.com</email>
</author>
<published>2015-09-18T14:32:23+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=53936474aa2e9057ff9fbb33fb641707e79bc3a2'/>
<id>53936474aa2e9057ff9fbb33fb641707e79bc3a2</id>
<content type='text'>
Leopard because this OS uses out of date (pre 2011k) timezone files.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Leopard because this OS uses out of date (pre 2011k) timezone files.
</pre>
</div>
</content>
</entry>
<entry>
<title>Issue #22932: Fix timezones in email.utils.formatdate.</title>
<updated>2015-07-31T20:18:22+00:00</updated>
<author>
<name>Robert Collins</name>
<email>rbtcollins@hp.com</email>
</author>
<published>2015-07-31T20:18:22+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=2080dc97a7d629384a1dfbad9003f3cbd9011911'/>
<id>2080dc97a7d629384a1dfbad9003f3cbd9011911</id>
<content type='text'>
Patch from Dmitry Shachnev.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Patch from Dmitry Shachnev.
</pre>
</div>
</content>
</entry>
<entry>
<title>Issue #19590: Use specific asserts in email tests.</title>
<updated>2013-11-16T10:56:23+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2013-11-16T10:56:23+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=328cf3cbdfd6b09d4eae496b746e5013291e6aca'/>
<id>328cf3cbdfd6b09d4eae496b746e5013291e6aca</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>#17877: skip test if the Olson's TZ database is missing.</title>
<updated>2013-05-08T08:16:02+00:00</updated>
<author>
<name>Ezio Melotti</name>
<email>ezio.melotti@gmail.com</email>
</author>
<published>2013-05-08T08:16:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=6bcc0f1b5161adf0773ebeba77f1d7662aad4f0e'/>
<id>6bcc0f1b5161adf0773ebeba77f1d7662aad4f0e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Close #15165: Fix test_email on Windows 64 bits</title>
<updated>2012-11-05T01:06:13+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>victor.stinner@gmail.com</email>
</author>
<published>2012-11-05T01:06:13+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=9d95cbeaf97887beca3bbee36cb5466268bdf8e1'/>
<id>9d95cbeaf97887beca3bbee36cb5466268bdf8e1</id>
<content type='text'>
Use year 1990 instead of year 1970 to avoid issues with negative timestamps.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use year 1990 instead of year 1970 to avoid issues with negative timestamps.
</pre>
</div>
</content>
</entry>
<entry>
<title>Added test for a bug fixed in issue #665194.</title>
<updated>2012-08-23T02:06:37+00:00</updated>
<author>
<name>Alexander Belopolsky</name>
<email>alexander.belopolsky@gmail.com</email>
</author>
<published>2012-08-23T02:06:37+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=1f924d21d3f8a7fba3409544abca53a814de15f6'/>
<id>1f924d21d3f8a7fba3409544abca53a814de15f6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>#665194: Update email.utils.localtime to use astimezone, and fix bug.</title>
<updated>2012-08-23T01:34:00+00:00</updated>
<author>
<name>R David Murray</name>
<email>rdmurray@bitdance.com</email>
</author>
<published>2012-08-23T01:34:00+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=b8687df6532b809f41d77dfc617363d3c093ec88'/>
<id>b8687df6532b809f41d77dfc617363d3c093ec88</id>
<content type='text'>
The new code correctly handles historic changes in UTC offsets.
A test for this should follow.

Original patch by Alexander Belopolsky.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The new code correctly handles historic changes in UTC offsets.
A test for this should follow.

Original patch by Alexander Belopolsky.
</pre>
</div>
</content>
</entry>
<entry>
<title>#665194: Add a localtime function to email.utils.</title>
<updated>2012-05-26T03:22:59+00:00</updated>
<author>
<name>R David Murray</name>
<email>rdmurray@bitdance.com</email>
</author>
<published>2012-05-26T03:22:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=d2d521eafdea651de075f987ca80bece033b9b40'/>
<id>d2d521eafdea651de075f987ca80bece033b9b40</id>
<content type='text'>
Without this function people would be tempted to use the other date functions
in email.utils to compute an aware localtime, and those functions are not as
good for that purpose as this code.  The code is Alexander Belopolsy's from
his proposed patch for issue 9527, with a fix (and additional tests) by Brian
K. Jones.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without this function people would be tempted to use the other date functions
in email.utils to compute an aware localtime, and those functions are not as
good for that purpose as this code.  The code is Alexander Belopolsy's from
his proposed patch for issue 9527, with a fix (and additional tests) by Brian
K. Jones.
</pre>
</div>
</content>
</entry>
</feed>
