Commit Graph

80146 Commits

Author SHA1 Message Date
Serhiy Storchaka 09b52471f3 bpo-30365: Backport warnings and fix bugs in ElementTree. (#1581)
Running Python with the -3 option now emits deprecation warnings for
getchildren() and getiterator() methods of the Element class in the
xml.etree.cElementTree module and when pass the html argument to
xml.etree.ElementTree.XMLParser().

Fixed a deprecation warning about the doctype() method of the
xml.etree.ElementTree.XMLParser class.  Now it is emitted only when
define the doctype() method in the subclass of XMLParser.

Fixed a bug in the test_bug_200708_close test method.  An EchoTarget
instance was incorrectly passed to XMLParser() as the html argument and
silently ignored.

Tests no longer failed when use the -m option for running only selected
test methods. Checking warnings now is more specific, warnings are
expected only when use deprecated features.
2017-05-17 10:08:11 +03:00
Victor Stinner 800e4b7ad6 bpo-30329: Catch Windows error 10022 on shutdown() (#1538) (#1624)
Catch the Windows socket WSAEINVAL error (code 10022) in imaplib
on shutdown(SHUT_RDWR): An invalid operation was attempted

This error occurs sometimes on SSL connections.
(cherry picked from commit 83a2c28798)
2017-05-16 17:38:30 -07:00
Serhiy Storchaka b8b9f95f66 [2.7] bpo-30380: Fix Sphinx 1.6.1 warnings. (GH-1613) (#1616)
* Use explicit numbering for footnotes referred by explicit number.
* Fix literal strings formatting in howto/urllib2.rst.
* Add `:noindex:` to duplicated definition of list.
* Update susp-ignored.csv for reference/expressions.rst.
(cherry picked from commit d97b7dc94b)
2017-05-17 01:26:48 +03:00
Brett Cannon 97eb2a7d77 [2.7] bpo-30380: Pin the version of Sphinx used to build the docs (GH-1612) (GH-1619) 2017-05-16 14:41:00 -07:00
grzgrzgrz3 6924ed55c9 bpo-30357 each test in test_thread waits until all spawned threads finish (#1583)
* bpo-30357 each test in test_thread waits until all spawn threads finish

* bpo-30357 each test in test_thread waits until all spawn threads finish

* bpo-30357: test_thread now uses threading_cleanup() (#1592)

test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By: Victor Stinner <victor.stinner@gmail.com>

* bpo-30357: test_thread now uses threading_cleanup() (#1592)

test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By: Victor Stinner <victor.stinner@gmail.com>
2017-05-15 21:01:07 +02:00
Victor Stinner 9d1983be50 bpo-11790: Fix sporadic failures in test_multiprocessing.WithProcessesTestCondition. (#1591)
(cherry picked from commit f25a8de845)
2017-05-15 17:32:14 +02:00
Serhiy Storchaka eb66897e87 [2.7] bpo-30366: Backport tests for test.support. (#1582)
Also backport new functions temp_dir() and python_is_optimized().
temp_cwd() now accepts None as a name (means using tempfile.mkdtemp).
check_syntax_error() now accepts arguments lineno and offset.
Use more specific error messages in get_attribute().
2017-05-15 11:59:35 +03:00
Xiang Zhang 982a17e02d bpo-30242: resolve some undefined behaviours in struct (#1418) (#1588) 2017-05-15 13:17:54 +08:00
Zachary Ware bd82a070cd Update Travis Doc build config (GH-1565)
Build the 'suspicious' doc target, turn on warnings-as-errors on the
docs, and always build the docs.  This better matches master's doc build
setup.
2017-05-13 10:05:53 -05:00
Zachary Ware f6c6d1e230 bpo-11681: Document the `-b` and `-bb` options (GH-1562) 2017-05-13 09:30:20 -05:00
Zachary Ware 4be66b6cd1 Fix warnings due to deprecated latex options (GH-1563) 2017-05-13 09:16:44 -05:00
Zachary Ware c7362b4b08 Update susp-ignored.csv (GH-1564) 2017-05-13 09:16:25 -05:00
Victor Stinner 94a3694c3d bpo-6393: Fix locale.getprerredencoding() on macOS (#1555)
Fix for bpo-6393: Python crashes on OSX when $LANG is set to some (but
not all) invalid values due to an invalid result from nl_langinfo

(cherry picked from commit 6d77e07196)
2017-05-12 11:51:38 +02:00
Victor Stinner f2e894cfd9 bpo-30342: Fix sysconfig.is_python_build() on VS9.0 (#1544)
Fix sysconfig.is_python_build() if Python is built with Visual Studio
2008 (VS 9.0).
2017-05-12 11:31:08 +02:00
Victor Stinner a5bb62436e [2.7] bpo-30283: regrtest: backport test_slow_interrupted() and test_coverage() (#1541)
* bpo-30283: regrtest: backport test_coverage()

* Add --coverage option, the option was already described in the doc
* When coverage is used, regrtest now pass all options to runtest()
  and calls also accumulate_result() (as done when coverage is not
  used).
* bpo-25260: Fix coverage on Windows: remove the list of ignored
  directories.

* bpo-30283: regrtest: backport test_slow_interrupted()

* Fix regrtest to report interrupted tests as omitted rather than
  failed.
* bpo-25260: Fix coverage on Windows: remove the list of ignored
  directories.

* bpo-30283: Fix test_regrtest on Visual Studio 2008

Skip Tools\buildbot\test.bat and PCbuild\rt.bat if Python was not
compiled in PCbuild (but compiled in PC\VS9.0\ for example).
2017-05-11 11:30:23 +02:00
Victor Stinner 3837d9797c bpo-15526: test_startfile changes the cwd (#1537)
Try to fix test_startfile's inability to clean up after itself in
time. Patch by Jeremy Kloth.

Fix the following support.rmtree() error while trying to remove the
temporary working directory used by Python tests:

WindowsError: [Error 32] The process cannot access the file because
it is being used by another process: ...

Original commit: 8a53dbeb7a
2017-05-11 01:23:19 +02:00
Xiang Zhang 05469fa1c0 bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1531) (#1480) 2017-05-10 19:20:28 +08:00
Victor Stinner 88321413a7 gitignore: add rules for the PC/ directory (#1514)
[2.7] gitignore: add rules for the PC/ directory
2017-05-10 02:38:28 +02:00
torsava a473a73d0c [2.7] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-1478) (#1522)
* bpo-29243: Fix Makefile with respect to --enable-optimizations

When using the Profile Guided Optimization (./configure --enable-optimizations)
Python is built not only during `make` but rebuilt again during `make test`,
`make install` and others. This patch fixes the issue.

Note that this fix produces no change at all in the Makefile if configure is
run witout --enable-optimizations.

* !squash.
(cherry picked from commit a1054c3b00)
2017-05-09 18:04:29 +02:00
Victor Stinner 453a685702 bpo-30283: Backport regrtest features from master to 2.7 (#1516)
* regrtest: add --slowest alias to --slow

* make buildbottest: add --slowest option

* regrtest: add "- " prefix to --slowest output

* regrtest: Fix an outdated comment

* regrtest: replace PermissionError

Replace PermissionError with OSError and check on exc.errno.
PermissionError was added to Python 3.3.

* regrtest: add -3 -tt options to run Python scripts

* regrtest: backport --list-tests option

* regrtest: backport "Tests result: xxx" summary

* regrtest: backport total duration

* regrtest: add timestamp to the progress

* regrtest: describe previous test state

* Add the state of the test: passed, failed, etc.
* If a test took longer than 30 seconds, log its execution time

* regrtest: -jN logs running workers

* regrtest: mention if tests are run in parallel

* regrtest: parallel mode is more verbose during wait

Display running tests every 30 seconds if no test completed in the
meanwhile.

* test_regrtest: fix typo in SubprocessRun
2017-05-09 17:06:34 +02:00
Victor Stinner d2aff60719 [2.7] bpo-30283: Backport test_regrtest from master to 2.7 (#1513)
* bpo-30283: regrtest: add --testdir option

* bpo-30283: Backport _testcapi.raise_signal()

Function used by test_regrtest to simulate an interrupted unit test.

* bpo-30283: Backport test_regrtest from master
2017-05-09 13:57:20 +02:00
Victor Stinner c8a77d3394 Fix SyntaxWarning on importing test_inspect (#1512)
Fix the following warning when test_inspect.py is compiled to
test_inspect.pyc:

test_inspect.py:505: SyntaxWarning: tuple parameter unpacking has been removed in 3.x
  def spam_deref(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h):

Replace also test.test_support import with test.support.
2017-05-09 11:53:16 +02:00
Xiang Zhang 4e7457b853 bpo-29990: Fix range checking in GB18030 decoder (#1509) 2017-05-09 12:18:56 +08:00
Victor Stinner 228da42961 bpo-30258: Fix handling of child error in regrtest (#1477)
Don't stop the worker thread if a child failed.
2017-05-05 10:28:35 +02:00
Victor Stinner 03b278895f bpo-30265: support.unlink() don't catch any OSError (#1456)
support.unlink() now only ignores ENOENT and ENOTDIR, instead of
ignoring any OSError exception.
2017-05-05 10:27:34 +02:00
Serhiy Storchaka 5d7a18f3b6 [2.7] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1471)
It was possible to get a core dump by using uninitialized
_json objects. Now __new__ methods create initialized objects.
__init__ methods are removed..
(cherry picked from commit 76a3e51a40)
2017-05-05 11:21:45 +03:00
Victor Stinner d81f9e24ea bpo-30264: ExpatParser now closes the source (#1476)
ExpatParser.parse() of xml.sax.xmlreader now closes the source: close
the file object or the urllib object if source is a string (not an
open file-like object).

Add test_parse_close_source() unit test.
2017-05-05 10:11:55 +02:00
Victor Stinner fd6094cdeb Relax test timing (bpo-29861) to avoid sporadic failures (#1120) (#1472)
(cherry picked from commit 685cdb9acc)
2017-05-05 09:47:11 +02:00
Benjamin Peterson ef4c6ba169 Revert "Issue #29094: Offsets in a ZIP file created with extern file object and modes" (#1467)
This reverts commit 0f4ed2cdc6 (though, the tests are retained) and the followup 58ab4b57da.

See discussion on bpo-29094.
2017-05-04 23:54:43 -07:00
Victor Stinner 8a19eb24c9 bpo-23404: make touch becomes make regen-all (#1466)
Don't rebuild generated files based on file modification time
anymore, the action is now explicit. Replace "make touch"
with "make regen-all".

Changes:

* Remove "make touch", Tools/hg/hgtouch.py and .hgtouch
* Add a new "make regen-all" command to rebuild all generated files
* Add subcommands to only generate specific files:

  - regen-ast: Include/Python-ast.h and Python/Python-ast.c
  - regen-grammar: Include/graminit.h and Python/graminit.c
  - regen-opcode-targets: Python/opcode_targets.h

* Add PYTHON_FOR_REGEN variable
* pgen is now only built by by "make regen-grammar"
* Add $(srcdir)/ prefix to paths to source files to handle correctly
  compilation outside the source directory
2017-05-05 03:14:23 +02:00
Victor Stinner e81e355a8e bpo-30108: Fix test_site setUpModule() (#1460)
Oops, I forgot that PermissionError was introduced in Python 3.3!
Replace PermissionError with OSError and check on errno.
2017-05-04 18:52:26 +02:00
Victor Stinner 78064387e5 bpo-30108: Restore sys.path in test_site (#1197) (#1459)
Add setUpModule() and tearDownModule() functions to test_site to
save/restore sys.path at the module level to prevent warning if the
user site directory is created, since site.addsitedir() modifies
sys.path.
(cherry picked from commit b85c136903)
2017-05-04 18:21:52 +02:00
Victor Stinner 9fb061ba9c Fix test_ftplib warning if IPv6 is not available (#1457)
DummyFTPServer now calls del_channel() on bind() error to prevent the
following warning in TestIPv6Environment.setUpClass():

Warning -- asyncore.socket_map was modified by test_ftplib
  Before: {}
  After:  {3: <test.test_ftplib.DummyFTPServer 127.0.0.1:0 at ...>}
2017-05-04 18:10:30 +02:00
Victor Stinner 0f7f676606 test_distutils: test_build_ext uses EnvironGuard (#1458)
Use EnvironGuard on BuildExtTestCase to save/restore os.environ, to fix the
following warning:

Warning -- os.environ was modified by test_distutils

MSVCCompiler.initialize() of distutils.msvc9compiler modifies
os.environ.
2017-05-04 18:10:09 +02:00
Mariatta e1b02ff588 [2.7] bpo-28315: Improve code examples in docs (GH-1372) (#1447)
Replace
   File "<stdin>", line 1, in ?
with
   File "<stdin>", line 1, in <module>.
(cherry picked from commit 8856940cf2)
2017-05-03 18:54:28 -07:00
Serhiy Storchaka 74f0db885f [2.7] bpo-30236: Backported regrtest options -m and -G. (#1394) 2017-05-04 00:23:50 +03:00
Victor Stinner 8cf7ea22fc Add Appveyor to Python 2.7 branch (#1434)
* Add Appveyor to Python 2.7 branch

* Adapt AppVeyor config for Python 2

* Replace -j0 with -j2: -j0 is ignored on Python 2
* Replace --slowest with --slow
* Remove --timeout option (it was introduced in Python 3)
2017-05-03 18:42:42 +02:00
Victor Stinner 2c27731901 bpo-30257: _bsddb: Fix newDBObject() (#1428)
Don't set cursorSetReturnsNone to DEFAULT_CURSOR_SET_RETURNS_NONE
anymore if self->myenvobj is set.

Fix a GCC warning on the strange indentation.
2017-05-03 18:04:18 +02:00
Victor Stinner c991eb280e bpo-30258: regrtest handles child process crash (#1431)
Backport the CHILD_ERROR status from master: a test is considered as
failed if a worker process running a test exited with a code
different than zero.

Change also the output: write stdout and stderr of the child process
after the test name, instead of writing it before.

accumulate_result(): don't use time of CHILD_ERROR or INTERRUPTED
results.
2017-05-03 17:28:28 +02:00
Victor Stinner 15f8d0d360 test_distutils: use EnvironGuard (#1433)
Use EnvironGuard on InstallTestCase and UtilTestCase.

Backport fixes from master to prevent the following warning:

Warning -- os.environ was modified by test_distutils
2017-05-03 17:28:10 +02:00
Victor Stinner 2b183b87d2 Update .gitignore (#1435)
Ignore more generated files and test data downloaded by tests.
2017-05-03 17:27:17 +02:00
Victor Stinner f6a3133972 bpo-30255: Clip step in _PySlice_Unpack() (#1429)
In PySlice_IndicesEx, clip the step to [-PY_SSIZE_T_MAX,
PY_SSIZE_T_MAX] rather than [PY_SSIZE_T_MIN, PY_SSIZE_T_MAX].

(cherry picked from commit e6fc7401a9)
2017-05-03 16:00:12 +02:00
Victor Stinner 0d493795c8 regrtest: always show before/after of modified env (#1407) (#1409)
Buildbots don't run tests with -vv and so only log "xxx was modified
by test_xxx" which is not enough to debug such random issue. In many
cases, I'm unable to reproduce the warning and so unable to fix it.

Always logging the value before and value after should help to debug
such warning on buildbots.
(cherry picked from commit ec4b17239d)
(cherry picked from commit 2298235023)
2017-05-03 03:47:44 +02:00
Victor Stinner d1c862ffa7 bpo-30199: test_ssl closes all asyncore channels (#1381) (#1408)
AsyncoreEchoServer of test_ssl now calls
asyncore.close_all(ignore_all=True) to ensure that
asyncore.socket_map is cleared once the test completes, even if
ConnectionHandler was not correctly unregistered.

Fix the following warning:

Warning -- asyncore.socket_map was modified by test_ssl
  Before: {}
  After:  {6: <test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler>}
(cherry picked from commit 1dae7450c6)
2017-05-03 03:47:34 +02:00
Victor Stinner df5692549a bpo-30232: Support Git worktree in configure.ac (#1402)
Don't test if .git/HEAD file exists, but only if the .git file (or
directory) exists.
2017-05-03 00:05:45 +02:00
Victor Stinner 8105dd7f75 bpo-30223: Add global in regrtest main_in_temp_cwd (#1399) 2017-05-02 23:43:25 +02:00
Victor Stinner fd6c8bb89e bpo-27593: Revise git SCM build info. (#744) (#746) (#1392)
Use --short form of git hash.  Use output from "git describe" for tag.

Expected outputs:
1. previous hg
2. previous git
3. updated git

Release (tagged) build:
1. Python 3.7.0a0 (v3.7.0a0:4def2a2901a5, ...
2. Python 3.7.0a0 (v3.7.0a0^0:05f53735c8912f8df1077e897f052571e13c3496, ...
3. Python 3.7.0a0 (v3.7.0a0:05f53735c8, ...

Development build:
1. Python 3.7.0a0 (default:41df79263a11, ...
2. Python 3.7.0a0 (master:05f53735c8912f8df1077e897f052571e13c3496, ...
3. Python 3.7.0a0 (heads/master-dirty:05f53735c8, ...

"dirty" means the working tree has uncommitted changes.
See "git help describe" for more info.
(cherry picked from commit 554626ada7)
(cherry picked from commit ed512cba78)
2017-05-02 21:50:09 +02:00
Serhiy Storchaka 8e158b2316 [2.7] bpo-30223: Fix test_xpickle for Python 2.4. (#1395) 2017-05-02 21:56:52 +03:00
Serhiy Storchaka 43566aee12 [2.7] bpo-30223: Add Lib/test/__main__.py. (#1373)
To unify running tests in Python 2.7 and Python 3, the test
package can be run as a script.  This is equivalent to running the
test.regrtest module as a script.
2017-05-02 18:26:25 +03:00
Victor Stinner 2c7085fd7b bpo-27593: Get SCM build info from git instead of hg (#1327)
Based on commit 5c4b0d063a by Ned
Deily, which is based on original patches by Brett Cannon and Steve
Dower.

Remove also the private _Py_svnversion() function and SVNVERSION
variable.

Note: Py_SubversionRevision() and Py_SubversionShortBranch() are
unchanged, they are part of the public API.
2017-05-02 16:55:50 +02:00