<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Lib/email, branch refactor-lambda-parameters</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/'/>
<entry>
<title>bpo-39073: validate Address parts to disallow CRLF (#19007)</title>
<updated>2020-03-30T00:38:41+00:00</updated>
<author>
<name>Ashwin Ramaswami</name>
<email>aramaswamis@gmail.com</email>
</author>
<published>2020-03-30T00:38:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=614f17211c5fc0e5b828be1d3320661d1038fe8f'/>
<id>614f17211c5fc0e5b828be1d3320661d1038fe8f</id>
<content type='text'>
 Disallow CR or LF in email.headerregistry.Address arguments to guard against header injection attacks. </content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
 Disallow CR or LF in email.headerregistry.Address arguments to guard against header injection attacks. </pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504)</title>
<updated>2019-12-09T01:37:34+00:00</updated>
<author>
<name>Abhilash Raj</name>
<email>maxking@users.noreply.github.com</email>
</author>
<published>2019-12-09T01:37:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=3ae4ea1931361dd2743e464790e739d9285501bf'/>
<id>3ae4ea1931361dd2743e464790e739d9285501bf</id>
<content type='text'>
Fix a potential IndexError when passing an empty value to the message-id
parser. Instead, HeaderParseError should be raised.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a potential IndexError when passing an empty value to the message-id
parser. Instead, HeaderParseError should be raised.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38698: Add a new InvalidMessageID token to email header parser. (GH-17503)</title>
<updated>2019-12-09T01:35:38+00:00</updated>
<author>
<name>Abhilash Raj</name>
<email>maxking@users.noreply.github.com</email>
</author>
<published>2019-12-09T01:35:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=68157da8b42b26408af5d157d2dba4fcf29c6320'/>
<id>68157da8b42b26408af5d157d2dba4fcf29c6320</id>
<content type='text'>
This adds a new InvalidMessageID token to the email header parser which can be
used to represent invalid message-id headers in the parse tree.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds a new InvalidMessageID token to the email header parser which can be
used to represent invalid message-id headers in the parse tree.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38698: Prevent UnboundLocalError to pop up in parse_message_id (GH-17277)</title>
<updated>2019-12-05T03:14:26+00:00</updated>
<author>
<name>Claudiu Popa</name>
<email>pcmanticore@gmail.com</email>
</author>
<published>2019-12-05T03:14:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=bb815499af855b1759c02535f8d7a9d0358e74e8'/>
<id>bb815499af855b1759c02535f8d7a9d0358e74e8</id>
<content type='text'>
parse_message_id() was improperly using a token defined inside an exception
handler, which was raising `UnboundLocalError` on parsing an invalid value.




https://bugs.python.org/issue38698</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
parse_message_id() was improperly using a token defined inside an exception
handler, which was raising `UnboundLocalError` on parsing an invalid value.




https://bugs.python.org/issue38698</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38332: Catch KeyError from unknown cte in encoded-word. (GH-16503)</title>
<updated>2019-10-05T16:19:15+00:00</updated>
<author>
<name>Andrei Troie</name>
<email>andreitroie90@gmail.com</email>
</author>
<published>2019-10-05T16:19:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=65dcc8a8dc41d3453fd6b987073a5f1b30c5c0fd'/>
<id>65dcc8a8dc41d3453fd6b987073a5f1b30c5c0fd</id>
<content type='text'>
KeyError should cause a failure in parsing the encoded word and should be caught and raised as a _InvalidEWError instead.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
KeyError should cause a failure in parsing the encoded word and should be caught and raised as a _InvalidEWError instead.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-34002: Minor efficiency and clarity improvements in email package. (GH-7999)</title>
<updated>2019-09-20T03:25:55+00:00</updated>
<author>
<name>Michael Selik</name>
<email>mike@selik.org</email>
</author>
<published>2019-09-20T03:25:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=2702638eabe5f7b25f36d295f0ad78cb8d4eda05'/>
<id>2702638eabe5f7b25f36d295f0ad78cb8d4eda05</id>
<content type='text'>
* Check intersection of two sets explicitly

Comparing ``len(a) &gt; ``len(a - b)`` is essentially looking for an
intersection between the two sets. If set ``b`` does not intersect ``a``
then ``len(a - b)`` will be equal to ``len(a)``. This logic is more
clearly expressed as ``a &amp; b``.

* Change while/pop to a for-loop

Copying the list, then repeatedly popping the first element was
unnecessarily slow. I also cleaned up a couple other inefficiencies.
There's no need to unpack a tuple, then re-pack and append it. The list
can be created with the first element instead of empty. Secondly, the
``endswith`` method returns a bool, so there's no need for an if-
statement to set ``encoding`` to True or False.

* Use set.intersection to check for intersections

``a.intersection(b)`` method is more clear of purpose than ``not
a.isdisjoint(b)`` and avoids an unnecessary set construction that ``a &amp;
set(b)`` performs.

* Use not isdisjoint instead of intersection

While it reads slightly worse, the isdisjoint method will stop when it
finds a counterexample and returns a bool, rather than looping over the
entire iterable and constructing a new set.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Check intersection of two sets explicitly

Comparing ``len(a) &gt; ``len(a - b)`` is essentially looking for an
intersection between the two sets. If set ``b`` does not intersect ``a``
then ``len(a - b)`` will be equal to ``len(a)``. This logic is more
clearly expressed as ``a &amp; b``.

* Change while/pop to a for-loop

Copying the list, then repeatedly popping the first element was
unnecessarily slow. I also cleaned up a couple other inefficiencies.
There's no need to unpack a tuple, then re-pack and append it. The list
can be created with the first element instead of empty. Secondly, the
``endswith`` method returns a bool, so there's no need for an if-
statement to set ``encoding`` to True or False.

* Use set.intersection to check for intersections

``a.intersection(b)`` method is more clear of purpose than ``not
a.isdisjoint(b)`` and avoids an unnecessary set construction that ``a &amp;
set(b)`` performs.

* Use not isdisjoint instead of intersection

While it reads slightly worse, the isdisjoint method will stop when it
finds a counterexample and returns a bool, rather than looping over the
entire iterable and constructing a new set.
</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://git.baserock.org/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>
<entry>
<title>bpo-37482: Fix email address name with encoded words and special chars (GH-14561)</title>
<updated>2019-08-21T23:00:39+00:00</updated>
<author>
<name>bsiem</name>
<email>52461103+bsiem@users.noreply.github.com</email>
</author>
<published>2019-08-21T23:00:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=df0c21ff46c5c37b6913828ef8c7651f523432f8'/>
<id>df0c21ff46c5c37b6913828ef8c7651f523432f8</id>
<content type='text'>
Special characters in email address header display names are normally
put within double quotes. However, encoded words (=?charset?x?...?=) are
not allowed withing double quotes. When the header contains a word with
special characters and another word that must be encoded, the first one
must also be encoded.

In the next example, the display name in the From header is quoted and
therefore the comma is allowed; in the To header, the comma is not
within quotes and not encoded, which is not allowed and therefore
rejected by some mail servers.

From: "Foo Bar, France" &lt;foo@example.com&gt;
To: Foo Bar, =?utf-8?q?Espa=C3=B1a?= &lt;foo@example.com&gt;





https://bugs.python.org/issue37482</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Special characters in email address header display names are normally
put within double quotes. However, encoded words (=?charset?x?...?=) are
not allowed withing double quotes. When the header contains a word with
special characters and another word that must be encoded, the first one
must also be encoded.

In the next example, the display name in the From header is quoted and
therefore the comma is allowed; in the To header, the comma is not
within quotes and not encoded, which is not allowed and therefore
rejected by some mail servers.

From: "Foo Bar, France" &lt;foo@example.com&gt;
To: Foo Bar, =?utf-8?q?Espa=C3=B1a?= &lt;foo@example.com&gt;





https://bugs.python.org/issue37482</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-32178: Fix IndexError trying to parse 'To' header starting with ':'. (GH-15044)</title>
<updated>2019-08-11T20:45:09+00:00</updated>
<author>
<name>Abhilash Raj</name>
<email>maxking@users.noreply.github.com</email>
</author>
<published>2019-08-11T20:45:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=09a1872a8007048dcdf825a476816c5e3498b8f8'/>
<id>09a1872a8007048dcdf825a476816c5e3498b8f8</id>
<content type='text'>
This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.




https://bugs.python.org/issue32178</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.




https://bugs.python.org/issue32178</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)</title>
<updated>2019-08-08T05:42:54+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2019-08-08T05:42:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=662db125cddbca1db68116c547c290eb3943d98e'/>
<id>662db125cddbca1db68116c547c290eb3943d98e</id>
<content type='text'>
They now return NotImplemented for unsupported type of the other operand.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
They now return NotImplemented for unsupported type of the other operand.
</pre>
</div>
</content>
</entry>
</feed>
