95588 Commits

Author SHA1 Message Date
Victor Stinner
de1850bb03 [3.5] bpo-30523, bpo-30764, bpo-30776: Sync regrtest from master (#2442)
* bpo-30523: regrtest --list-cases --match (#2401)

* regrtest --list-cases now supports --match and --match-file options.
  Example: ./python -m test --list-cases -m FileTests test_os
* --list-cases now also sets support.verbose to False to prevent
  messages to stdout when loading test modules.
* Add support._match_test() private function.
(cherry picked from commit ace56d5836)

* bpo-30764: regrtest: add --fail-env-changed option (#2402)

* bpo-30764: regrtest: change exit code on failure

* Exit code 2 if failed tests ("bad")
* Exit code 3 if interrupted

* bpo-30764: regrtest: add --fail-env-changed option

If the option is set, mark a test as failed if it alters the
environment, for example if it creates a file without removing it.

(cherry picked from commit 63f54c6893)

* bpo-30776: reduce regrtest -R false positives (#2422)

* Change the regrtest --huntrleaks checker to decide if a test file
  leaks or not. Require that each run leaks at least 1 reference.
* Warmup runs are now completely ignored: ignored in the checker test
  and not used anymore to compute the sum.
* Add an unit test for a reference leak.

Example of reference differences previously considered a failure
(leak) and now considered as success (success, no leak):

    [3, 0, 0]
    [0, 1, 0]
    [8, -8, 1]
(cherry picked from commit 48b5c422ff)
2017-06-27 16:35:18 +02:00
Victor Stinner
eef254d6c6 bpo-30383: Add NEWS entry for backported regrtest (#2438) 2017-06-27 14:03:12 +02:00
Antoine Pitrou
85b34edd8b [3.5] bpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to (GH-2403) (#2419)
* bpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to lock

This is especially important if PyThread_acquire_lock() is called reentrantly
(for example from a signal handler).

* Update 2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst

* Avoid core logic when taking the mutex failed.
(cherry picked from commit f84ac420c2)
2017-06-26 22:07:20 +02:00
Victor Stinner
849b062a82 bpo-30764: test_subprocess uses SuppressCrashReport (#2405) (#2411)
bpo-30764, bpo-29335: test_child_terminated_in_stopped_state() of
test_subprocess now uses support.SuppressCrashReport() to prevent the
creation of a core dump on FreeBSD.
(cherry picked from commit cdee3f14f7)
2017-06-26 18:05:21 +02:00
Serhiy Storchaka
99e9eb6111 [3.5] bpo-30746: Prohibited the '=' character in environment variable names (GH-2382) (#2392)
in `os.putenv()` and `os.spawn*()`..
(cherry picked from commit 77703942c5)
2017-06-25 09:49:40 +03:00
Brett Cannon
4b1468f723 [3.5] Check the whitespace of pull requests on Travis (GH-2367) (GH-2387)
(cherry picked from commit 70cb1875bb)
2017-06-24 18:00:08 -07:00
Serhiy Storchaka
e0d446e9ca [3.5] bpo-30745: Fix compiler warnings introduced in bpo-30730. (GH-2376) (#2379)
(cherry picked from commit 0ee32c1)
2017-06-24 16:42:44 +03:00
Mariatta
3e8d6f5643 [3.5] Fix a typo in a comment in coroutines.py (GH-2267) (GH-2371)
defiend -> defined
(cherry picked from commit cab469245d)
2017-06-23 22:50:31 -07:00
Brett Cannon
599ff020b3 [3.5] bpo-30645: don't append to an inner loop path in imp.load_package() (GH-2268) (GH-2365)
Bug didn't manifest itself when importing a module with source as .py files are always the first on the search path. The issue only showed up in bytecode-only packages where the calculated file path would be ``__init__.py/__init__.pyc``.

Patch by Alexandru Ardelean.
(cherry picked from commit c38e32a100)
2017-06-23 11:39:53 -07:00
Serhiy Storchaka
a7c0264735 [3.5] bpo-30730: Prevent environment variables injection in subprocess on Windows. (GH-2325) (#2361)
Prevent passing other invalid environment variables and command arguments..
(cherry picked from commit d174d24a5d)
2017-06-23 20:27:02 +03:00
Victor Stinner
f42ce179c8 [3.5] bpo-30726: PCbuild _elementtree: remove duplicate defines (#2348) (#2350)
* bpo-30726: PCbuild _elementtree: remove duplicate defines (#2348)

bpo-30726, bpo-29591: libexpat 2.2.1 of Modules/expat/ now uses
a winconfig.h configuration file which already defines:

* XML_NS
* XML_DTD
* BYTEORDER=1234
* XML_CONTEXT_BYTES=1024
* HAVE_MEMMOVE

Remove these defines from PCbuild/_elementtree.vcxproj to prevent
compiler warnings.

Co-Authored-By: Jeremy Kloth <jeremy.kloth@gmail.com>
(cherry picked from commit c8fb58bd79)

* bpo-30726: Fix elementtree warnings on Windows due to expat upgrade (#2319)

* bpo-30726: Fix elementtree warnings on Windows

Caused by usage of `getenv` which should be safe. And a few integer
truncations which should also be ok.

* bpo-30726: Don't ignore libexpat warnings which haypo intends to fix upstream

(cherry picked from commit 87c6555073)
2017-06-23 15:14:18 +02:00
Serhiy Storchaka
e2aec8e691 [3.5] bpo-30727: Fix a race condition in test_threading. (GH-2334) (#2352)
(cherry picked from commit 32cb968)
2017-06-23 13:52:22 +03:00
Mariatta
8aa15ba884 [3.5] bpo-30709: Improve code example in Descriptor HowTo doc (GH-2339) (GH-2341)
(cherry picked from commit b066edfb1b)
2017-06-22 21:24:33 -07:00
Mariatta
ce1bd6ac7f [3.5] bpo-30619: Clarify typing.Union documentation (GH-2326) (GH-2338)
When a class and its subclass are present, the latter is skipped.
(cherry picked from commit 6580c19bbb)
2017-06-22 19:18:05 -07:00
larryhastings
491afb533e Add "Misc/NEWS.d" directory tree for "blurb". GH-2330
CPython workflow is changing!  We're going to start using "blurb"
to manage Misc/NEWS entries:
    https://github.com/python/core-workflow
(This will be a big win for release managers, honest.)

This checkin simply populates the "Misc/NEWS.d" subdirectory tree
so that people can start putting their news entries in there.
No other changes (yet).
2017-06-22 16:01:00 -07:00
Victor Stinner
91d171be45 bpo-30694: Upgrade Modules/expat/ to libexpat 2.2.1 (#2300) (#2314)
New file: Modules/expat/siphash.h.
(cherry picked from commit 5ff7132313)
2017-06-21 16:05:14 +02:00
Serhiy Storchaka
29c89d00bf [3.5] bpo-29755: Fixed the lgettext() family of functions in the gettext module. (GH-2266) (#2298)
They now always return bytes.

Updated the gettext documentation.
(cherry picked from commit 26cb465)
2017-06-20 18:06:45 +03:00
Victor Stinner
410860662f bpo-30500: Fix the NEWS entry (#2295)
splithost() expects an URL starting with "//" not with "http://".
2017-06-20 16:09:06 +02:00
Victor Stinner
4899d847ed bpo-30500: urllib: Simplify splithost by calling into urlparse. (#1849) (#2290)
The current regex based splitting produces a wrong result. For example::

  http://abc#@def

Web browsers parse that URL as ``http://abc/#@def``, that is, the host
is ``abc``, the path is ``/``, and the fragment is ``#@def``.
(cherry picked from commit 90e01e50ef)
2017-06-20 15:33:35 +02:00
Mariatta
070ba85a8f [3.5] bpo-29887: Test normalization now fails if download fails (GH-905) (#2272)
* [3.5] bpo-29887: Test normalization now fails if download fails (GH-905)

* test_normalization fails if download fails

bpo-29887. The test is still skipped if "-u urlfetch" option is not
passed to regrtest (python3 -m test -u urlfetch test_normalization).

* Fix ResourceWarning in test_normalization

bpo-29887: Fix ResourceWarning in test_normalization if tests are
interrupted by CTRL+c.
(cherry picked from commit 722a3af092)

* bpo-29887: test_normalization handles PermissionError (#1196)

Skip test_normalization.test_main() if download raises a permission
error.
(cherry picked from commit d13d54748d)

* no f-strings :(
2017-06-20 08:31:11 +02:00
Steve Dower
2c899ccffd bpo-30687: Fixes build scripts to find msbuild.exe and stop relying on vcvarsall.bat (#2252) (#2281)
* Fixes build scripts to find msbuild.exe and stop relying on vcvarsall.bat
Also fixes bdist_wininst.vcxproj to use correct version in generated name.
2017-06-19 11:32:34 -07:00
Victor Stinner
a601fcca3b [3.5] bpo-30383: Backport regrtest and test_regrtest enhancements from master to 3.5 (#2279)
* bpo-30383: regrtest: prepend testdir to sys.path

* bpo-30383: Backport test_regrtest

* regrtest: rename --slow option to --slowest

The old --slow syntax is still accepted.

* regrtest: add a single oneliner summary

Example: "Tests result: SUCCESS"

* test_regrtest: add test_coverage()

regrtest now also displays the number of successful tests when
coverage is used.

* test_regrtest: add test_crashed()

Handle correctly crashing test: account the crash has a failed test,
but continue to run other tests.

* regrtest: backport --list-tests feature

* regrtest: backport --fromfile enhancements

* regrtest: backport displaying progress enhancements

* test_regrtest: backport test_randseed()

* regrtest: Fix --coverage on Windows

Don't ignore any directory anymore. Change backported from master.
2017-06-19 18:33:21 +02:00
Xiang Zhang
04521c275e bpo-30176: Add missing curses cell attributes constants (#2277) 2017-06-19 22:06:59 +08:00
Victor Stinner
46e299c153 [3.5] bpo-30540, bpo-30523: Add --matchfile and --list-cases options to regrtest (#2250)
* bpo-30540: regrtest: add --matchfile option

* Add a new option taking a filename to get a list of test names to
  filter tests.
* support.match_tests becomes a list.
* Modify run_unittest() to accept to match the whole test identifier,
  not just a part of a test identifier.

For example, the following command only runs test_access()
of the FileTests class of test_os:

$ ./python -m test -v -m test.test_os.FileTests.test_access test_os

* bpo-30523: regrtest: Add --list-cases option

* Add --list-cases option to regrtest
* Add get_abs_module() function, use it in list_cases()
* Add ns mandatory positional argument to runtest()
  and runtest_inner()
* Add file optional parameter to printlist()

Co-Authored-By: Louie Lu <git@louie.lu>
2017-06-16 18:04:38 +02:00
Victor Stinner
f50a3b1e7a Revert "bpo-30673: test.bat: add -t option (timeout) (#2211) (#2226)" (#2247)
This reverts commit ab4ea09604.
2017-06-16 14:38:50 +02:00