<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Lib/test/test_email/test_email.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>[3.10] bpo-45239: Fix parsedate_tz when time has more than 2 dots in it (GH-28452) (GH-28930)</title>
<updated>2021-10-13T17:12:22+00:00</updated>
<author>
<name>Łukasz Langa</name>
<email>lukasz@langa.pl</email>
</author>
<published>2021-10-13T17:12:22+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=f8473f6f7603f8cccccc3307d4cb853587be41b3'/>
<id>f8473f6f7603f8cccccc3307d4cb853587be41b3</id>
<content type='text'>
Co-authored-by: Łukasz Langa &lt;lukasz@langa.pl&gt;
(cherry picked from commit b9e687618d3489944f29adbd2be50b46940c9e70)

Co-authored-by: Ben Hoyt &lt;benhoyt@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: Łukasz Langa &lt;lukasz@langa.pl&gt;
(cherry picked from commit b9e687618d3489944f29adbd2be50b46940c9e70)

Co-authored-by: Ben Hoyt &lt;benhoyt@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-45001: Make email date parsing more robust against malformed input (GH-27946)</title>
<updated>2021-08-26T15:47:27+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2021-08-26T15:47:27+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=9a79242567d79f42ad1a953cce2b1c4a94df23ea'/>
<id>9a79242567d79f42ad1a953cce2b1c4a94df23ea</id>
<content type='text'>
Various date parsing utilities in the email module, such as
email.utils.parsedate(), are supposed to gracefully handle invalid
input, typically by raising an appropriate exception or by returning
None.

The internal email._parseaddr._parsedate_tz() helper used by some of
these date parsing routines tries to be robust against malformed input,
but unfortunately it can still crash ungracefully when a non-empty but
whitespace-only input is passed. This manifests as an unexpected
IndexError.

In practice, this can happen when parsing an email with only a newline
inside a ‘Date:’ header, which unfortunately happens occasionally in the
real world.

Here's a minimal example:

    $ python
    Python 3.9.6 (default, Jun 30 2021, 10:22:16)
    [GCC 11.1.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    &gt;&gt;&gt; import email.utils
    &gt;&gt;&gt; email.utils.parsedate('foo')
    &gt;&gt;&gt; email.utils.parsedate(' ')
    Traceback (most recent call last):
      File "&lt;stdin&gt;", line 1, in &lt;module&gt;
      File "/usr/lib/python3.9/email/_parseaddr.py", line 176, in parsedate
        t = parsedate_tz(data)
      File "/usr/lib/python3.9/email/_parseaddr.py", line 50, in parsedate_tz
        res = _parsedate_tz(data)
      File "/usr/lib/python3.9/email/_parseaddr.py", line 72, in _parsedate_tz
        if data[0].endswith(',') or data[0].lower() in _daynames:
    IndexError: list index out of range

The fix is rather straight-forward: guard against empty lists, after
splitting on whitespace, but before accessing the first element.
(cherry picked from commit 989f6a3800f06b2bd31cfef7c3269a443ad94fac)

Co-authored-by: wouter bolsterlee &lt;wouter@bolsterl.ee&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Various date parsing utilities in the email module, such as
email.utils.parsedate(), are supposed to gracefully handle invalid
input, typically by raising an appropriate exception or by returning
None.

The internal email._parseaddr._parsedate_tz() helper used by some of
these date parsing routines tries to be robust against malformed input,
but unfortunately it can still crash ungracefully when a non-empty but
whitespace-only input is passed. This manifests as an unexpected
IndexError.

In practice, this can happen when parsing an email with only a newline
inside a ‘Date:’ header, which unfortunately happens occasionally in the
real world.

Here's a minimal example:

    $ python
    Python 3.9.6 (default, Jun 30 2021, 10:22:16)
    [GCC 11.1.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    &gt;&gt;&gt; import email.utils
    &gt;&gt;&gt; email.utils.parsedate('foo')
    &gt;&gt;&gt; email.utils.parsedate(' ')
    Traceback (most recent call last):
      File "&lt;stdin&gt;", line 1, in &lt;module&gt;
      File "/usr/lib/python3.9/email/_parseaddr.py", line 176, in parsedate
        t = parsedate_tz(data)
      File "/usr/lib/python3.9/email/_parseaddr.py", line 50, in parsedate_tz
        res = _parsedate_tz(data)
      File "/usr/lib/python3.9/email/_parseaddr.py", line 72, in _parsedate_tz
        if data[0].endswith(',') or data[0].lower() in _daynames:
    IndexError: list index out of range

The fix is rather straight-forward: guard against empty lists, after
splitting on whitespace, but before accessing the first element.
(cherry picked from commit 989f6a3800f06b2bd31cfef7c3269a443ad94fac)

Co-authored-by: wouter bolsterlee &lt;wouter@bolsterl.ee&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-27513: email.utils.getaddresses() now handles Header objects (GH-13797) (GH-27242)</title>
<updated>2021-07-19T16:54:45+00:00</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2021-07-19T16:54:45+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=8c43bf1a923754fa6d97772151c6ac23c48759d3'/>
<id>8c43bf1a923754fa6d97772151c6ac23c48759d3</id>
<content type='text'>
getaddresses() should be able to handle a Header object if passed
one.

Co-authored-by: Łukasz Langa &lt;lukasz@langa.pl&gt;
(cherry picked from commit 89f4c34797de2f0e5045da2b97c1c8cbbb42fbb2)

Co-authored-by: Zackery Spytz &lt;zspytz@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
getaddresses() should be able to handle a Header object if passed
one.

Co-authored-by: Łukasz Langa &lt;lukasz@langa.pl&gt;
(cherry picked from commit 89f4c34797de2f0e5045da2b97c1c8cbbb42fbb2)

Co-authored-by: Zackery Spytz &lt;zspytz@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-43651: PEP 597: Fix test_email (GH-25158)</title>
<updated>2021-04-05T03:30:12+00:00</updated>
<author>
<name>Inada Naoki</name>
<email>songofacandy@gmail.com</email>
</author>
<published>2021-04-05T03:30:12+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=de522a89e42a35da9275169b113460c3581e32d7'/>
<id>de522a89e42a35da9275169b113460c3581e32d7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-43125: Fix: return expected type (str), not original value (bytes) in email/base64mime.py::body_encode (GH-24476)</title>
<updated>2021-03-30T08:37:37+00:00</updated>
<author>
<name>Grégory Starck</name>
<email>g.starck@gmail.com</email>
</author>
<published>2021-03-30T08:37:37+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=cf35e05f89bb008d6f4553f9875e0fe87fc02406'/>
<id>cf35e05f89bb008d6f4553f9875e0fe87fc02406</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-27321 Fix email.generator.py to not replace a non-existent header. (GH-18074)</title>
<updated>2020-10-19T22:49:19+00:00</updated>
<author>
<name>Mark Sapiro</name>
<email>mark@msapiro.net</email>
</author>
<published>2020-10-19T22:49:19+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=bf838227c35212709dc43b3c3c57f8e1655c1d24'/>
<id>bf838227c35212709dc43b3c3c57f8e1655c1d24</id>
<content type='text'>
This PR replaces #1977. The reason for the replacement is two-fold.

The fix itself is different is that if the CTE header doesn't exist in the original message, it is inserted. This is important because the new CTE could be quoted-printable whereas the original is implicit 8bit.

Also the tests are different. The test_nonascii_as_string_without_cte test in #1977 doesn't actually test the issue in that it passes without the fix. The test_nonascii_as_string_without_content_type_and_cte test is improved here, and even though it doesn't fail without the fix, it is included for completeness.

Automerge-Triggered-By: @warsaw</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR replaces #1977. The reason for the replacement is two-fold.

The fix itself is different is that if the CTE header doesn't exist in the original message, it is inserted. This is important because the new CTE could be quoted-printable whereas the original is implicit 8bit.

Also the tests are different. The test_nonascii_as_string_without_cte test in #1977 doesn't actually test the issue in that it passes without the fix. The test_nonascii_as_string_without_content_type_and_cte test is improved here, and even though it doesn't fail without the fix, it is included for completeness.

Automerge-Triggered-By: @warsaw</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-40275: Use new test.support helper submodules in tests (GH-21452)</title>
<updated>2020-08-04T15:51:43+00:00</updated>
<author>
<name>Hai Shi</name>
<email>shihai1992@gmail.com</email>
</author>
<published>2020-08-04T15:51:43+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=604bba1f8fe32479c89b9824b2231cc4480dd110'/>
<id>604bba1f8fe32479c89b9824b2231cc4480dd110</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-40275: Adding threading_helper submodule in test.support (GH-20263)</title>
<updated>2020-05-27T22:10:27+00:00</updated>
<author>
<name>Hai Shi</name>
<email>shihai1992@gmail.com</email>
</author>
<published>2020-05-27T22:10:27+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=e80697d687b610bd7fb9104af905dec8f0bc55a7'/>
<id>e80697d687b610bd7fb9104af905dec8f0bc55a7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-39793: use the same domain on make_msgid tests (#18698)</title>
<updated>2020-04-16T17:29:12+00:00</updated>
<author>
<name>Batuhan Taşkaya</name>
<email>batuhanosmantaskaya@gmail.com</email>
</author>
<published>2020-04-16T17:29:12+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=5565c30f0b25996a0e73477fc0e1e1aced52b926'/>
<id>5565c30f0b25996a0e73477fc0e1e1aced52b926</id>
<content type='text'>
* bpo-39793: use same domain on make_msgid tests

* apply suggestions</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bpo-39793: use same domain on make_msgid tests

* apply suggestions</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239)</title>
<updated>2019-08-31T15:25:35+00:00</updated>
<author>
<name>Ashwin Ramaswami</name>
<email>aramaswamis@gmail.com</email>
</author>
<published>2019-08-31T15:25:35+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=c5b242f87f31286ad38991bc3868cf4cfbf2b681'/>
<id>c5b242f87f31286ad38991bc3868cf4cfbf2b681</id>
<content type='text'>
Fixes a case in which email._header_value_parser.get_unstructured hangs the system for some invalid headers. This covers the cases in which the header contains either:
- a case without trailing whitespace
- an invalid encoded word

https://bugs.python.org/issue37764

This fix should also be backported to 3.7 and 3.8


https://bugs.python.org/issue37764</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes a case in which email._header_value_parser.get_unstructured hangs the system for some invalid headers. This covers the cases in which the header contains either:
- a case without trailing whitespace
- an invalid encoded word

https://bugs.python.org/issue37764

This fix should also be backported to 3.7 and 3.8


https://bugs.python.org/issue37764</pre>
</div>
</content>
</entry>
</feed>
