Commit Graph

24502 Commits

Author SHA1 Message Date
Serhiy Storchaka 20a8392cec
[3.7] bpo-26544: Get rid of dependence from distutils in platform. (GH-8356). (GH-8970)
(cherry picked from commit 7d81e8f599)
2018-09-04 17:31:18 +03:00
Miss Islington (bot) 1e921236d7 bpo-26901: Fix the Argument Clinic test suite (GH-8879) (GH-9048)
* Fix Tools/clinic/clinic_test.py: add missing
  FakeClinic.destination_buffers attribute and pass a file argument
  to Clinic().
* Rename Tools/clinic/clinic_test.py to Lib/test/test_clinic.py:
  add temporary Tools/clinic/ to sys.path to import the clinic
  module.

Co-Authored-By: Pablo Galindo <pablogsal@gmail.com>
(cherry picked from commit 65fc98e7b1)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-09-04 00:24:17 +02:00
Miss Islington (bot) 4da71814b3
bpo-34007: Skip traceback tests if the Program Counter is not available. (GH-9018)
Sometimes some versions of the shared libraries that are part of the
traceback are compiled in optimised mode and the Program Counter (PC)
is not present, not allowing gdb to walk the frames back. When this
happens, the Python bindings of gdb raise an exception, making the
test impossible to succeed.
(cherry picked from commit f2ef51f8be)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2018-08-31 18:47:20 -04:00
Victor Stinner 0b9ea4b211
[3.7] bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986) (GH-8987)
* bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986)

Standard streams like sys.stdout now use the "surrogateescape" error
handler, instead of "strict", on the POSIX locale (when the C locale is not
coerced and the UTF-8 Mode is disabled).

Add tests on sys.stdout.errors with LC_ALL=POSIX.

Fix the error handler of standard streams like sys.stdout:
PYTHONIOENCODING=":" is now ignored instead of setting the error handler to
"strict".

(cherry picked from commit 315877dc36)
2018-08-29 11:01:33 +02:00
Victor Stinner 65ef7425a3
bpo-34527: POSIX locale enables the UTF-8 Mode (GH-8972) (GH-8974)
* The UTF-8 Mode is now also enabled by the "POSIX" locale, not only
  by the "C" locale.
* On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces
  the ASCII encoding if the LC_CTYPE locale is "POSIX", not only if
  the LC_CTYPE locale is "C".
* test_utf8_mode.test_cmd_line() checks also that the command line
  arguments are decoded from UTF-8 when the the UTF-8 Mode is enabled
  with POSIX locale or C locale.

(cherry picked from commit 5cb258950c)
2018-08-28 13:51:20 +02:00
Miss Islington (bot) e3f20828f6 bpo-34171: Fix test_trace. (GH-8940) (GH-8951)
Remove "trace.cover" left from previous test runs before testing
that it is no longer created.
(cherry picked from commit b44a1d4f71)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-08-28 11:41:43 +03:00
Miss Islington (bot) 2cf33161f7
bpo-33635: Handling Bad file descriptor in Path.is_file and related. (GH-8542)
(cherry picked from commit 216b745eaf)

Co-authored-by: Przemysław Spodymek <przemyslaw@spodymek.com>
2018-08-27 18:37:18 -04:00
Miss Islington (bot) 55b8c4bff8
Remove AIX workaround test_subprocess (GH-8939)
An old apparent AIX behavior workaround in test_subprocess's
test_undecodable_env is no longer needed.
(cherry picked from commit 89d79b1449)

Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
2018-08-26 20:32:48 -04:00
Miss Islington (bot) 80e9fedcf5
bpo-34171: Prevent creating Lib/trace.cover when run the trace module. (GH-8841)
(cherry picked from commit c406d5cd74)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-08-25 03:47:22 -04:00
Miss Islington (bot) d5f017bbd6
bpo-13312: Avoid int underflow in time year. (GH-8912)
Avoids an integer underflow in the time module's year handling code.
(cherry picked from commit 76be0fffff)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2018-08-25 01:53:00 -04:00
Miss Islington (bot) 3e6020c4dd
bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks (GH-8864)
(cherry picked from commit 91cb298f81)

Co-authored-by: Vladimir Matveev <v2matveev@outlook.com>
2018-08-24 10:44:47 -04:00
Miss Islington (bot) 89b1654e0b
bpo-34454: fix .fromisoformat() methods crashing on inputs with surrogate code points (GH-8862)
The current C implementations **crash** if the input includes a surrogate
Unicode code point, which is not possible to encode in UTF-8.

Important notes:

1.  It is possible to pass a non-UTF-8 string as a separator to the
    `.isoformat()` methods.
2.  The pure-Python `datetime.fromisoformat()` implementation accepts
    strings with a surrogate as the separator.

In `datetime.fromisoformat()`, in the special case of non-UTF-8 separators,
this implementation will take a performance hit by making a copy of the
input string and replacing the separator with 'T'.

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Co-authored-by: Paul Ganssle <paul@ganssle.io>
(cherry picked from commit 096329f0b2)

Co-authored-by: Paul Ganssle <pganssle@users.noreply.github.com>
2018-08-23 11:54:33 -04:00
Miss Islington (bot) d1f0ccc7e6
bpo-34441: Fix ABC.__subclasscheck__ crash on classes with invalid __subclasses__ (GH-8835)
The missing NULL check was reported by Svace static analyzer.
(cherry picked from commit cdbf50cba1)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2018-08-20 16:42:18 -04:00
Miss Islington (bot) 870247a57e [3.7] bpo-34391: Fix ftplib test for TLS 1.3 (GH-8787) (GH-8789)
Read from data socket to avoid "[SSL] shutdown while in init" exception
during shutdown of the dummy server.

Signed-off-by: Christian Heimes <christian@python.org>

<!-- issue-number: [bpo-34391](https://www.bugs.python.org/issue34391) -->
https://bugs.python.org/issue34391
<!-- /issue-number -->
(cherry picked from commit 1590c39336)


Co-authored-by: Christian Heimes <christian@python.org>
2018-08-16 21:37:20 +02:00
Miss Islington (bot) e3228a3f44 bpo-34399: 2048 bits RSA keys and DH params (GH-8762) (GH-8763)
Downstream vendors have started to deprecate weak keys. Update all RSA keys
and DH params to use at least 2048 bits.

Finite field DH param file use RFC 7919 values, generated with

    certtool --get-dh-params --sec-param=high

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 88bfd0bce0)

Co-authored-by: Christian Heimes <christian@python.org>
2018-08-14 16:52:27 +02:00
Miss Islington (bot) 32e58fc321
bpo-34213: Allow dataclasses to work with a field named 'object'. (GH-8452)
(cherry picked from commit 4d12e4dc28)

Co-authored-by: Vadim Pushtaev <pushtaev.vm@gmail.com>
2018-08-12 20:32:44 -07:00
Miss Islington (bot) 8fc21c80af bpo-26818: Add a test to make sure the bug is fixed (GH-8664)
The main cause of this bug was fixed as part of bpo-31908.
(cherry picked from commit c8b0dbc492)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2018-08-11 09:28:34 +03:00
Miss Islington (bot) c614121224 bpo-34333: Fix %-formatting in Path.with_suffix() (GH-8663)
(cherry picked from commit 423d05f6f5)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2018-08-11 09:00:11 +03:00
Miss Islington (bot) 5799e5a84c bpo-18540: Fix EAI_NONAME in imaplib.IMAP4*() (GH-8634)
(cherry picked from commit e4dcbbd7f4)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2018-08-07 05:37:38 +03:00
Miss Islington (bot) a1ff5f9031
bpo-34272: Move argument parsing tests from test_capi to test_getargs2. (GH-8567)
(cherry picked from commit 8f7bb100d0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-08-06 07:11:04 -07:00
Victor Stinner 0c90d6f759
[3.7] bpo-34247: Fix Python 3.7 initialization (#8659)
* -X dev: it is now possible to override the memory allocator using
  PYTHONMALLOC even if the developer mode is enabled.
* Add _Py_InitializeFromConfig()
* Add _Py_Initialize_ReadEnvVars() to set global configuration
  variables from environment variables
* Fix the code to initialize Python: Py_Initialize() now also reads
  environment variables
* _Py_InitializeCore() can now be called twice: the second call
  only replaces the configuration.
* Write unit tests on Py_Initialize() and the different ways to
  configure Python
* The isolated mode now always sets Py_IgnoreEnvironmentFlag and
  Py_NoUserSiteDirectory to 1.
* pymain_read_conf() now saves/restores the configuration
  if the encoding changed
2018-08-05 12:31:59 +02:00
Miss Islington (bot) 50d7867789
bpo-30317: Fix multiprocessing test_timeout() (GH-8621)
Multiprocessing test_timeout() now accepts a delta of 100 ms instead
of just 50 ms, since the test failed with 135.8 ms instead of the
expected 200 ms.
(cherry picked from commit 5640d030e1)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-08-02 17:26:57 -07:00
Miss Islington (bot) 3e4b688759
bpo-33871: Fix os.sendfile(), os.writev(), os.readv(), etc. (GH-7931)
* Fix integer overflow in os.readv(), os.writev(), os.preadv()
  and os.pwritev() and in os.sendfile() with headers or trailers
  arguments (on BSD-based OSes and MacOS).

* Fix sending the part of the file in os.sendfile() on MacOS.
  Using the trailers argument could cause sending more bytes from
  the input file than was specified.

Thanks Ned Deily for testing on 32-bit MacOS.
(cherry picked from commit 9d5727326a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-31 02:20:06 -07:00
Serhiy Storchaka 47957dab94
[3.7] bpo-33729: Fix issues with arguments parsing in hashlib. (GH-8346) (GH-8581)
* help(hashlib) didn't work because of incorrect module name in blake2b and
  blake2s classes.
* Constructors blake2*(), sha3_*(), shake_*() and keccak_*() incorrectly
  accepted keyword argument "string" for binary data, but documented as
  accepting the "data" keyword argument. Now this parameter is positional-only.
* Keyword-only parameters in blake2b() and blake2s() were not documented as
  keyword-only.
* Default value for some parameters of blake2b() and blake2s() was None,
  which is not acceptable value.
* The length argument for shake_*.digest() was wrapped out to 32 bits.
* The argument for shake_128.digest() and shake_128.hexdigest() was not
  positional-only as intended.
* TypeError messages for incorrect arguments in all constructors sha3_*(),
  shake_*() and keccak_*() incorrectly referred to sha3_224.

Also made the following enhancements:

* More accurately specified input and result types for strings, bytes and
  bytes-like objects.
* Unified positional parameter names for update() and constructors.
* Improved formatting.
(cherry picked from commit f1d36d8efa)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-31 10:22:44 +03:00
Miss Islington (bot) d5c75be555
bpo-33833: Fix ProactorSocketTransport AssertionError (GH-7893)
(cherry picked from commit 9045199c5a)

Co-authored-by: twisteroid ambassador <twisteroidambassador@users.noreply.github.com>
2018-07-30 13:04:30 -07:00
Miss Islington (bot) ad4f64d58c
bpo-34035: Fix several AttributeError in zipfile seek() methods. (GH-8527)
(cherry picked from commit 3f8c6913b8)

Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
2018-07-29 12:57:21 -07:00
Miss Islington (bot) 990de2f4ca
bpo-34182: Fix test_pydoc running as a script. (GH-8389)
(cherry picked from commit 4e11c461ed)

Co-authored-by: Bo Bayles <bbayles@gmail.com>
2018-07-29 12:50:33 -07:00
Miss Islington (bot) 5753b13cb9
bpo-31047: Fix ntpath.abspath for invalid paths (GH-8544)
(cherry picked from commit d2e902e4fb)

Co-authored-by: Franz Wöllert <franz.woellert@gmail.com>
2018-07-29 08:42:18 -07:00
Miss Islington (bot) 2be0124b82
bpo-33476: Fix _header_value_parser when address group is missing final ';' (GH-7484)
(cherry picked from commit 8fe9eed937)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2018-07-28 08:41:26 -07:00
Miss Islington (bot) 89352b08aa bpo-32663 Make SMTPUTF8SimTests run (GH-5314) (#8471)
Enable and fix SMTPUTF8SimTests in test_smtplib.

The tests for SMTPUTF8SimTests in test_smtplib.py were not actually
being run because test_smtplib was still using the 'test_main' pattern,
and the class was never added to test_main.

Additionally, one of the tests needed to be moved to the non-UTF8 server
class because it relies on the server not being UTF-8 compatible (and it
had a bug in in).
(cherry picked from commit 48ed88a93b)

Co-authored-by: chason <chason@gmail.com>
2018-07-26 09:58:16 -04:00
Miss Islington (bot) 973649342c bpo-29097: Forego fold detection on windows for low timestamp values (GH-2385) (GH-8466)
On Windows, passing a negative value to local results in an OSError because localtime_s on Windows does not support negative timestamps. Unfortunately this means that fold detection for timestamps between 0 and max_fold_seconds will result in this OSError since we subtract max_fold_seconds from the timestamp to detect a fold. However, since we know there haven't been any folds in the interval [0, max_fold_seconds) in any timezone, we can hackily just forego fold detection for this time range on Windows.
(cherry picked from commit 96d1e69a12)

Co-authored-by: Ammar Askar <ammar_askar@hotmail.com>
2018-07-25 16:34:09 -04:00
Miss Islington (bot) 23a3297ff1 [3.7] bpo-34136: Make test_do_not_recreate_annotations more reliable. (GH-8364) (GH-8365)
(cherry picked from commit 06ca3f0c09)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-24 15:05:57 +03:00
Miss Islington (bot) 0b27169183 bpo-34164: Fix handling of incorrect padding in base64.b32decode(). (GH-8351) (GH-8435)
Now base64.Error is always raised instead of UnboundLocalError or
OverflowError.
(cherry picked from commit ac0b3c2f4d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-24 13:53:39 +03:00
Miss Islington (bot) 220afffb68 bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. (GH-8262) (GH-8423)
(cherry picked from commit aba24ff360)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-24 01:41:26 +03:00
Miss Islington (bot) 519fc551d7 bpo-34183: Fix running Lib/test/test_contextlib_async.py as a script. (GH-8381) (GH-8422)
(cherry picked from commit db8e3a1e44)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-24 01:02:00 +03:00
Miss Islington (bot) 635338248f bpo-34184: Fix running Lib/test/test_dataclasses.py as a script. (GH-8382) (GH-8421)
(cherry picked from commit 3fe5cccb08)
2018-07-24 00:25:11 +03:00
Miss Islington (bot) ba1810e1ec bpo-25094: Fix test_tools.test_sundry() on Windows (GH-8406) (GH-8407)
When Python is installed on Windows, python -m test test_tools failed
because it tried to run Tools\scripts\2to3.py which requires an
argument. Skip this script. On other platforms or on Windows but when
run from source code (not installed), the script is called "2to3"
instead of "2to.py" and so was already skipped.

Modify also the unit test to unload all modules which have been
loaded by the test.
(cherry picked from commit 752d4b7531)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-07-23 14:39:11 +02:00
Miss Islington (bot) 81f85d09f4 bpo-34181: Fix running Lib/test/test_typing.py as a script. (GH-8380) (GH-8385)
(cherry picked from commit 961360923e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2018-07-22 13:41:41 +03:00
Miss Islington (bot) 92ce6a64af bpo-34179: Make sure decimal context doesn't affect other tests. (GH-8376) (#8383)
(cherry picked from commit 938045f335)

Co-authored-by: Bo Bayles <bbayles@gmail.com>
2018-07-21 20:38:19 +02:00
Miss Islington (bot) 7638eb892a bpo-34126: Fix crashes while profiling invalid calls. (GH-8300) (GH-8371)
(cherry picked from commit 56868f940e)

Co-authored-by: jdemeyer <jdemeyer@cage.ugent.be>
2018-07-21 19:58:35 +03:00
Miss Islington (bot) a7a6eac966 bpo-33723: Fix test_time.test_process_time() (GH-8358) (GH-8362)
The test failed on my laptop because the busy loop took 15.9 ms
whereas the test expects at least 20 ms. Modify test_process_time()
as test_thread_time() has been modified recently: only require 15 ms
instead of 20 ms.
(cherry picked from commit e78dace8dc)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-07-21 03:52:44 +02:00
Miss Islington (bot) 03ec4df67d bpo-34008: Allow to call Py_Main() after Py_Initialize() (GH-8043) (GH-8352)
Py_Main() can again be called after Py_Initialize(), as in Python
3.6. The new configuration is ignored, except of
_PyMainInterpreterConfig.argv which is used to update sys.argv.
(cherry picked from commit fb47bca9ee)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-07-21 02:16:22 +02:00
Miss Islington (bot) 339e0c1296
bpo-32692: Fix test_threading.test_set_and_clear() (GH-8331)
Increase the timeout: give timeout x 4 instead of timeout x 2 to
threads to wait until the Event is set, but reduce the sleep from 500
ms to 250 ms. So the test should be more reliable and faster!
(cherry picked from commit 81950495ba)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-07-19 02:27:42 -07:00
Victor Stinner 296e572092
[3.7] bpo-34130: Fix 2 race conditions in test_signal (GH-8329)
* bpo-34130: Fix test_signal.test_socket() (GH-8326)

test_signal.test_socket(): On Windows, sometimes even if the C signal handler
succeed to write the signal number into the write end of the socketpair, the
test fails with a BlockingIOError on the non-blocking read.recv(1) because the
read end of the socketpair didn't receive the byte yet.

Fix the race condition on Windows by setting the read end as blocking.

(cherry picked from commit 99bb6df66a)

* bpo-34130: Fix test_signal.test_warn_on_full_buffer() (GH-8327)

On Windows, sometimes test_signal.test_warn_on_full_buffer() fails to
fill the socketpair buffer. In that case, the C signal handler
succeed to write into the socket, it doesn't log the expected send
error, and so the test fail.

On Windows, the test now uses a timeout of 50 ms to fill the
socketpair buffer to fix this race condition.

Other changes:

* Begin with large chunk size to fill the buffer to speed up the
  test.
* Add error messages to assertion errors to more easily identify
  which assertion failed.
* Don't set the read end of the socketpair as non-blocking.

(cherry picked from commit 686b4b5ff2)
2018-07-18 18:49:27 +02:00
Miss Islington (bot) 6020d98bea
bpo-34068: _io__IOBase_close_impl could call _PyObject_SetAttrId with an exception set (GH-8282)
(cherry picked from commit 28f07364f0)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-07-17 00:09:32 -07:00
Miss Islington (bot) 892df9d15a
bpo-33967: Fix wrong use of assertRaises (GH-8306)
(cherry picked from commit 56d8f57b83)

Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
2018-07-16 22:18:56 -07:00
Miss Islington (bot) 0a820a2030 bpo-33967: Remove use of deprecated assertRaisesRegexp() (GH-8261) (GH-8296)
It was added in test_functools at 445f1b3.
(cherry picked from commit 9e9b2c32a3)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-07-16 11:40:11 +02:00
Miss Islington (bot) c721472fb8
bpo-34087: Fix buffer overflow in int(s) and similar functions (GH-8274)
`_PyUnicode_TransformDecimalAndSpaceToASCII()` missed trailing NUL char.
It caused buffer overflow in `_Py_string_to_number_with_underscores()`.

This bug is introduced in 9b6c60cb.
(cherry picked from commit 16dfca4d82)

Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
2018-07-13 20:58:12 -07:00
Miss Islington (bot) 4ada0cff53
bpo-33723: Fix test_time.test_thread_time() (GH-8267)
The test failed on AMD64 Debian root 3.x buildbot because the busy
loop of 100 ms only increased time.thread_time() by 19.9 ms which is
smaller than 20 ms. Modify the test to tolerate a delta of at least
15 ms instead of 20 ms.
(cherry picked from commit d6345def68)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-07-12 07:05:43 -07:00
Miss Islington (bot) b89776fb1b
bpo-33716, test_concurrent_futures: increase timeout (GH-7828)
Increase the timeout from 1 min to 5 min.

Replace also time.time() with time.monotonic() for timeouts.
(cherry picked from commit 3ad8decd76)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2018-07-12 02:05:49 -07:00