Currently, inspect.getfile(str) will report nonsense:
```pytb
>>> inspect.getfile(str)
TypeError: <module 'builtins' (built-in)> is a built-in class
```
This fixes that
https://bugs.python.org/issue37173
(cherry picked from commit d407d2a726)
Co-authored-by: Philipp A <flying-sheep@web.de>
Fix an unintended ValueError from :func:`subprocess.run` when checking for
conflicting `input` and `stdin` or `capture_output` and `stdout` or `stderr` args
when they were explicitly provided but with `None` values within a passed in
`**kwargs` dict rather than as passed directly by name.
(cherry picked from commit 8cc605acdd)
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
This avoids the search dialogs being hidden behind the editor window.
(cherry picked from commit 554450fb4e)
Co-authored-by: Tal Einat <taleinat@gmail.com>
* bpo-21315: Fix parsing of encoded words with missing leading ws.
Because of missing leading whitespace, encoded word would get parsed as
unstructured token. This patch fixes that by looking for encoded words when
splitting tokens with whitespace.
Missing trailing whitespace around encoded word now register a defect
instead.
Original patch suggestion by David R. Murray on bpo-21315.
(cherry picked from commit 66c4f3f38b)
Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
When an attribute is deleted from a Mock, a sentinel is added rather
than just deleting the attribute. This commit checks for such sentinels
when returning the child mocks in the __dir__ method as users won't
expect deleted attributes to appear when performing dir(mock).
(cherry picked from commit 0df635c7f8)
Co-authored-by: Mario Corchero <mariocj89@gmail.com>
* 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.
(cherry picked from commit aa79707262)
Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
Add it to the end of the first line if there is room. Tests were reworked.
(cherry picked from commit 949fe976d5)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
test_venv.test_mutiprocessing() now explicitly calls pool.terminate()
to wait until the pool completes.
(cherry picked from commit bc6469f79c)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
What's new now mentions SSLContext.hostname_checks_common_name instead of SSLContext.host_flags.
https://bugs.python.org/issue36868
(cherry picked from commit 47eb223406)
Co-authored-by: Christian Heimes <christian@python.org>
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 06651ee418)
Co-authored-by: Christian Heimes <christian@python.org>
https://bugs.python.org/issue37081
Changes in bpo- 31858 made the less informative 'context_use_ps1' redundant.
(cherry picked from commit 6bdc4dee01)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Insertion in line order makes sorting keys by line order unneeded.
(cherry picked from commit 1a4d9ffa1a)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Fixed QueueListener in order to avoid random deadlocks.
Unable to add regression tests atm due to time constraints, will add it in a bit.
Regarding implementation, although it's nested, it does not cause performance issues whatsoever, and does not call task_done() in case of an exception (which is the right thing to do IMHO).
https://bugs.python.org/issue36813
(cherry picked from commit 6b282e1887)
Co-authored-by: Bar Harel <bzvi7919@gmail.com>
msilib.Directory.start_component() was passing an extra argument to CAB.gen_id().
(cherry picked from commit c8d5bf6c3f)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Fix destructor _pyio.BytesIO and _pyio.TextIOWrapper: initialize
their _buffer attribute as soon as possible (in the class body),
because it's used by __del__() which calls close().
(cherry picked from commit a3568417c4)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
* No type cache for types with specialized mro, invalidation is hard.
* FIX: Don't disable method cache custom types that do not implement mro().
* fixing implem.
* Avoid storing error flags, also decref.
* news entry
* Clear as soon as we're getting an error.
* FIX: Reference leak.
(cherry picked from commit 180dc1b0f4)
Co-authored-by: Julien Palard <julien@palard.fr>
https://bugs.python.org/issue28866
``_thread.interrupt_main()`` now avoids setting the Python error status if the ``SIGINT`` signal is ignored or not handled by Python.
(cherry picked from commit 608876b6b1)
Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
I've reported the issue on https://bugs.python.org/issue37008 and now I'm trying to bring a solution to this minor issue.
I think it could be trivially backported to 3.7 branch.
https://bugs.python.org/issue37008
(cherry picked from commit 394119afc6)
Co-authored-by: Damien Nadé <Anvil@users.noreply.github.com>
Wrap the callback call within the `add_done_callback` function within concurrent.futures, in order to behave in an identical manner to callbacks added to a running future are triggered once it has completed.
(cherry picked from commit 2a3a2ece50)
Co-authored-by: Sam Martin <ABitMoreDepth@users.noreply.github.com>
CVE-2019-9948: Avoid file reading as disallowing the unnecessary URL
scheme in URLopener().open() and URLopener().retrieve()
of urllib.request.
Co-Authored-By: SH <push0ebp@gmail.com>
(cherry picked from commit 0c2b6a3943)
PyErr_WriteUnraisable() now displays the exception even if displaying
the traceback failed. Moreover, hold a strong reference to sys.stderr
while using it.
Document that an exception must be set when calling
PyErr_WriteUnraisable(), but don't add an assertion to check it at
runtime.
Cleanup: use longer names for variables and create
write_unraisable_exc_file() subfunction.
Include windows.h rather than crtdbg.h to get STATUS_CONTROL_C_EXIT constant.
Moreover, include windows.h on Windows, not only when MSC is used.
(cherry picked from commit 925af1d99b)
Links creating an infinite symlink loop would raise an exception.
(cherry picked from commit d5c120f7eb)
Co-authored-by: Jörg Stucke <joerg.stucke@fkie.fraunhofer.de>
https://bugs.python.org/issue36035
The script needs to be updated to support win 10/ 1803 chcp.com command (output has trailing dot)
https://bugs.python.org/issue34144
(cherry picked from commit 6955d44b41)
Co-authored-by: Lorenz Mende <Lorenz.mende@gmail.com>
This slightly expands an existing test case `test_popen_error` to trigger a `ResourceWarning` and fixes it.
https://bugs.python.org/issue35721
(cherry picked from commit 9932fd91e8)
Co-authored-by: Niklas Fiekas <niklas.fiekas@backscattering.de>
Print any argument other than None or int passed to SystemExit
or sys.exit().
(cherry picked from commit 6d965b39b7)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>