aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_email/test_email.py
Commit message (Collapse)AuthorAge
* gh-95087: Fix IndexError in parsing invalid date in the email module (GH-95201)Serhiy Storchaka2022-07-25
| | | | Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
* gh-84623: Remove unused imports in tests (#93772)Victor Stinner2022-06-13
|
* gh-93010: InvalidHeaderError used but nonexistent (#93015)oda-gitso2022-05-23
| | | | | * fix issue 93010 Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-43323: Fix UnicodeEncodeError in the email module (GH-32137)Serhiy Storchaka2022-04-30
| | | | | It was raised if the charset itself contains characters not encodable in UTF-8 (in particular \udcxx characters representing non-decodable bytes in the source).
* Rewrite audio.py to jive with image.py (#91886)Barry Warsaw2022-04-24
| | | | | | | Similar to the rewrite of email/mime/image.py and associated test after the deprecation of imghdr.py, thisrewrites email/mime/audio.py and associated tests after the deprecation of sndhdr.py. Closes #91885
* gh-91520: Rewrite imghdr inlining for clarity and completeness (#91521)Barry Warsaw2022-04-14
| | | | | | | | | | | | | | | | | | | | * Rewrite imghdr inlining for clarity and completeness * Move MIMEImage class back closer to the top of the file since it's the important thing. * Use a decorate to mark a given rule function and simplify the rule function names for clarity. * Copy over all the imghdr test data files into the email package's test data directory. This way when imghdr is actually removed, it won't affect the MIMEImage guessing tests. * Rewrite and extend the MIMEImage tests to test for all supported auto-detected MIME image subtypes. * Remove the now redundant PyBanner048.gif data file. * See https://github.com/python/cpython/pull/91461#discussion_r850313336 Co-authored-by: Oleg Iarygin <dralife@yandex.ru> Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
* gh-91217: deprecate imghdr (#91461)Brett Cannon2022-04-13
| | | | | | | | | | | | | | * Deprecate imghdr Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> * Update Doc/whatsnew/3.11.rst Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> * Inline `imghdr` into `email.mime.image` Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Barry Warsaw <barry@python.org>
* bpo-40280: Detect missing threading on WASM platforms (GH-32352)Christian Heimes2022-04-07
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-19460: Add test for MIMENonMultipart (GH-29817)1809092021-11-28
|
* bpo-45239: Fix parsedate_tz when time has more than 2 dots in it (GH-28452)Ben Hoyt2021-10-13
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-45001: Make email date parsing more robust against malformed input ↵wouter bolsterlee2021-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-27946) 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. >>> import email.utils >>> email.utils.parsedate('foo') >>> email.utils.parsedate(' ') Traceback (most recent call last): File "<stdin>", line 1, in <module> 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.
* bpo-27513: email.utils.getaddresses() now handles Header objects (#13797)Zackery Spytz2021-07-19
| | | | | | getaddresses() should be able to handle a Header object if passed one. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-43651: PEP 597: Fix test_email (GH-25158)Inada Naoki2021-04-05
|
* bpo-43125: Fix: return expected type (str), not original value (bytes) in ↵Grégory Starck2021-03-30
| | | | email/base64mime.py::body_encode (GH-24476)
* bpo-27321 Fix email.generator.py to not replace a non-existent header. ↵Mark Sapiro2020-10-19
| | | | | | | | | | | (GH-18074) 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
* bpo-40275: Use new test.support helper submodules in tests (GH-21452)Hai Shi2020-08-04
|
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-28
|
* bpo-39793: use the same domain on make_msgid tests (#18698)Batuhan Taşkaya2020-04-16
| | | | | * bpo-39793: use same domain on make_msgid tests * apply suggestions
* bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239)Ashwin Ramaswami2019-08-31
| | | | | | | | | | | | 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
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-30
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-34155: Dont parse domains containing @ (GH-13079)jpic2019-07-17
| | | | | | | | | | | | | | | | | | | | | | Before: >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses (Address(display_name='', username='a', domain='malicious.org'),) >>> parseaddr('a@malicious.org@important.com') ('', 'a@malicious.org') After: >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses (Address(display_name='', username='', domain=''),) >>> parseaddr('a@malicious.org@important.com') ('', 'a@') https://bugs.python.org/issue34155
* bpo-30835: email: Fix AttributeError when parsing invalid CTE (GH-13598)Abhilash Raj2019-06-04
| | | | | | | | | | | | | | | | | | | | * bpo-30835: email: Fix AttributeError when parsing invalid Content-Transfer-Encoding Parsing an email containing a multipart Content-Type, along with a Content-Transfer-Encoding containing an invalid (non-ASCII-decodable) byte will fail. email.feedparser.FeedParser._parsegen() gets the header and attempts to convert it to lowercase before comparing it with the accepted encodings, but as the header contains an invalid byte, it's returned as a Header object rather than a str. Cast the Content-Transfer-Encoding header to a str to avoid this. Found using the AFL fuzzer. Reported-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Andrew Donnellan <andrew@donnellan.id.au> * Add email and NEWS entry for the bugfix.
* bpo-27737: Allow whitespace only headers encoding (#13478)Batuhan Taşkaya2019-05-22
|
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-07
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Merge #28407 Improve test coverage of make_msgid.R David Murray2016-12-17
|\
| * #28407 Improve test coverage of make_msgid.R David Murray2016-12-17
| | | | | | | | Patch by Dillon Brock.
| * #19003: Only replace \r and/or \n line endings in email.generator.R David Murray2016-09-11
| | | | | | | | | | This is a further restoration of backward compatibility, as well as being correct per the RFCs.
* | Merge: #19003: Only replace \r and/or \n line endings in email.generator.R David Murray2016-09-11
| |
* | #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-08
| | | | | | | | | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* | Issue #27445: Merge from 3.5Berker Peksag2016-09-08
|\|
| * Issue #27445: Don't pass str(_charset) to MIMEText.set_payload()Berker Peksag2016-09-08
| | | | | | | | Patch by Claude Paroz.
| * Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Martin Panter2016-09-07
| |
* | Merge: #22233: Only split headers on \r and/or \n, per email RFCs.R David Murray2016-09-07
|\|
| * #22233: Only split headers on \r and/or \n, per email RFCs.R David Murray2016-09-07
| | | | | | | | Original patch by Martin Panter, new policy fixes by me.
* | #27331: add policy keyword argument to all MIME subclasses.R David Murray2016-09-07
| | | | | | | | Patch by Berker Peksag.
* | Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-30
| |
* | Merge ISO-8859 fixes from 3.5Martin Panter2016-08-10
|\|
| * Correct misspellings of ISO-8859Martin Panter2016-08-10
| |
* | Issue #23277: Remove unused imports in tests.Serhiy Storchaka2016-04-24
|/
* Issue #6598: Avoid clock wrapping around in test_make_msgid_collisions.Serhiy Storchaka2015-11-10
|\ | | | | | | Use time.monotonic instead of time.clock.
| * Issue #6598: Avoid clock wrapping around in test_make_msgid_collisions.Serhiy Storchaka2015-11-10
| | | | | | | | Use time.monotonic or time.time instead of time.clock.
* | Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5Martin Panter2015-11-02
|\|
| * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-02
| | | | | | | | | | | | This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
* | Issue #6598: Increased time precision and random number range inSerhiy Storchaka2015-05-19
|\| | | | | | | email.utils.make_msgid() to strengthen the uniqueness of the message ID.
| * Issue #6598: Increased time precision and random number range inSerhiy Storchaka2015-05-19
| | | | | | | | email.utils.make_msgid() to strengthen the uniqueness of the message ID.
* | #21083: add get_content_disposition method to email.message.R David Murray2015-05-16
| | | | | | | | Patch by Abhilash Raj.
* | merge 3.4 (#19996)Benjamin Peterson2015-01-25
|\|
| * handle headers with no key (closes #19996)Benjamin Peterson2015-01-25
| | | | | | | | Patch by Cory Benfield.
* | Issue #16324: _charset parameter of MIMEText now also accepts ↵Berker Peksag2014-09-27
|/ | | | | | email.charset.Charset instances. Initial patch by Claude Paroz.
* Decreased memory requirements of new tests added in issue21448.Serhiy Storchaka2014-08-12
|