``_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>
…nctions with asserts
The actual overflow can never happen because of the following:
* The size of a list can't be greater than PY_SSIZE_T_MAX / sizeof(PyObject*).
* The size of a pointer on all supported plaftorms is at least 4 bytes.
* ofs is positive and less than the list size at the beginning of each iteration.
https://bugs.python.org/issue35091
(cherry picked from commit 6bc5917903)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
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
* bpo-36929: Modify io/re tests to allow for missing mod name
For a vanishingly small number of internal types, CPython sets the
tp_name slot to mod_name.type_name, either in the PyTypeObject or the
PyType_Spec. There are a few minor places where this surfaces:
* Custom repr functions for those types (some of which ignore the
tp_name in favor of using a string literal, such as _io.TextIOWrapper)
* Pickling error messages
The test suite only tests the former. This commit modifies the test
suite to allow Python implementations to omit the module prefix.
https://bugs.python.org/issue36929
(cherry picked from commit ccb7ca728e)
Co-authored-by: Max Bernstein <tekknolagi@users.noreply.github.com>
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>
The sqlite3.Connection object doesn't call its close() method when it's used
as a context manager.
(cherry picked from commit 287b84de93)
Co-authored-by: Xtreak <tir.karthi@gmail.com>
Given example does not run, loop variable is missing.
Secondly, this is bad example how to handle shutdown signal, because it would cause `RuntimeError: Event loop stopped before Future completed.`
Perhaps it would be better to cancel all tasks instead of closing loop directly?
Did not create issue, because question is quite simple.
(cherry picked from commit ceb842e155)
Co-authored-by: Alexander Vasin <hi@alvass.in>
Makes the documentation of math and cmath module
more helpful for the beginners.
(cherry picked from commit 6faad355db)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
and there are non-ascii characters in the header.
(cherry picked from commit feac6cd775)
Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
Instead of maintaining the same docstring two times, let's copy common
docstrings from SSLObject methods and properties to SSLSocket.
(cherry picked from commit 80ed353329)
Co-authored-by: Christian Heimes <christian@python.org>
Move the check for dead conditionals (if 0) to the peephole optimizer
and make sure that the code block is still compiled to report any
existing syntax errors within.
(cherry picked from commit af8646c805)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This PR proposes a solution to [bpo-35545](https://bugs.python.org/issue35545) by adding an optional `flowinfo` and `scopeid` to `asyncio.base_events._ipaddr_info` to carry the full address information into `_ipaddr_info` and avoid discarding IPv6 specific information.
Changelog entry & regression tests to come.
https://bugs.python.org/issue35545
(cherry picked from commit ac8eb8f36b)
Co-authored-by: Erwan Le Pape <lepaperwan@users.noreply.github.com>
The final addition (cur += step) may overflow, so use size_t for "cur".
"cur" is always positive (even for negative steps), so it is safe to use
size_t here.
Co-Authored-By: Martin Panter <vadmium+py@gmail.com>
(cherry picked from commit 14514d9084)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Clarify how to capture stdout and stderr combined into one stream.
(cherry picked from commit e883091abf)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
When using multiprocessing (-jN option), worker processes now create
their temporary directory inside the temporary directory of the
main process. So the main process is able to remove temporary
directories of worker processes even if they crash or when they are
killed by regrtest on KeyboardInterrupt (CTRL+c).
Rework also how multiprocessing arguments are parsed in main.py.
(cherry picked from commit 3c93153f7d)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
MultiprocessThread.kill() now closes stdout and stderr to prevent
popen.communicate() to hang.
(cherry picked from commit c923c3449f)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Extended attributes can only be set on user-writeable files, but shutil previously
first chmod()ed the destination file to the source's permissions and then tried to
copy xattrs. This will cause failures if attempting to copy read-only files with
xattrs, as occurs with Git clones on Lustre FS.
(cherry picked from commit 79efbb7193)
Co-authored-by: Olexa Bilaniuk <obilaniu@users.noreply.github.com>