Commit Graph

41708 Commits

Author SHA1 Message Date
Victor Stinner 46c2b81026 bpo-30125: Fix faulthandler.disable() on Windows (#1240)
* bpo-30125: Cleanup faulthandler.c

* Use size_t type for iterators
* Add { ... }

* bpo-30125: Fix faulthandler.disable() on Windows

On Windows, faulthandler.disable() now removes the exception handler
installed by faulthandler.enable().
2017-04-21 18:06:13 +02:00
Victor Stinner 2a1aed04b0 bpo-30107: don't dump core on expected test_io crash (#1235)
test_io has two unit tests which trigger a deadlock:

* test_daemon_threads_shutdown_stdout_deadlock()
* test_daemon_threads_shutdown_stderr_deadlock()

These tests call Py_FatalError() if the expected bug is triggered
which calls abort(). Use test.support.SuppressCrashReport to prevent
the creation on a core dump, to fix the warning:

Warning -- files was modified by test_io
  Before: []
  After:  ['python.core']
2017-04-21 17:59:23 +02:00
Victor Stinner a2c877c398 bpo-30106: Fix test_asyncore.test_quick_connect() (#1234)
test_quick_connect() runs a thread up to 50 seconds, whereas the
socket is connected in 0.2 second and then the thread is expected to
end in less than 3 second. On Linux, the thread ends quickly because
select() seems to always return quickly. On FreeBSD, sometimes
select() fails with timeout and so the thread runs much longer than
expected.

Fix the thread timeout to fix a race condition in the test.
2017-04-21 13:51:53 +02:00
Serhiy Storchaka 40db90c1ce bpo-29802: Fix reference counting in module-level struct functions (#1213)
when pass arguments of wrong type.
2017-04-20 21:19:31 +03:00
Victor Stinner d20324a7fa support.threading_cleanup() log a warning on fail (#1195)
The @reap_threads decorator and the threading_cleanup() function of
test.support now log a warning if they fail to clenaup threads.

Fix also the usage of support.threading_cleanup() in
test_urllib2_localnet.

The log may help to debug such other warning seen on the AMD64
FreeBSD CURRENT Non-Debug 3.x buildbot:

Warning -- threading._dangling was modified by test_logging
2017-04-20 13:40:08 +02:00
Victor Stinner b85c136903 bpo-30108: Restore sys.path in test_site (#1197)
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.
2017-04-20 13:39:39 +02:00
Dong-hee Na b4dc6af7a7 bpo-12414: Update code_sizeof() to take in account co_extra memory. (#1168) 2017-04-20 10:31:17 +03:00
Mariatta 58f3c9dc8f bpo-30109: Fix reindent.py (GH-1207)
Skip the file if it has bad encoding.
2017-04-19 22:59:20 -07:00
Louie Lu f7e62cf8ad bpo-30078: Add an example of passing a path to unittest (#1178) 2017-04-20 06:46:59 +03:00
Victor Stinner 11470b6dcd bpo-30106: Fix tearDown() of test_asyncore (#1194)
Call asyncore.close_all() with ignore_all=True in the tearDown()
method of the test_asyncore base test case. It should prevent keeping
alive sockets in asyncore.socket_map if close() fails with an
unexpected error.

Revert also an unwanted change of my previous commit: remove name
parameter of Thread in test_quick_connect().
2017-04-20 02:55:39 +02:00
Victor Stinner d13d54748d bpo-29887: test_normalization handles PermissionError (#1196)
Skip test_normalization.test_main() if download raises a permission
error.
2017-04-20 02:39:59 +02:00
Victor Stinner ec4b17239d regrtest: always show before/after of modified env (#1192)
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.
2017-04-20 00:57:30 +02:00
Victor Stinner 7b9619ae24 Fix/optimize test_asyncore.test_quick_connect() (#1188)
Don't use addCleanup() in test_quick_connect() because it keeps the
Thread object alive and so @reap_threads fails on its timeout of 1
second. "./python -m test -v test_asyncore -m test_quick_connect"
now takes 185 ms, instead of 11 seconds.

Other minor changes:

* Use "with sock:" to close the socket instead of
  try/finally: sock.close()
* Use self.skipTest() in test_quick_connect() to remove one
  indentation level and notice user that the test is specific to
  AF_INET and AF_INET6
2017-04-19 23:42:46 +02:00
Victor Stinner 1e62bf145b bpo-30030: Revert f50354ad (tempfile) (#1187)
Revert f50354adaaafebe95ad09d09b825804a686ea843: it introduced a
regression in test_threadedtempfile.
2017-04-19 22:59:51 +02:00
Serhiy Storchaka 66bffd1663 bpo-30065: Fixed arguments validation in _posixsubprocess.fork_exec(). (#1110) 2017-04-19 21:12:46 +03:00
Serhiy Storchaka a79f4c2195 bpo-30070: Fixed leaks and crashes in errors handling in the parser module. (#1131) 2017-04-19 21:09:21 +03:00
Serhiy Storchaka d90045f319 bpo-22352: Adjust widths in the output of dis.dis() for large line numbers and (#1153)
instruction offsets.

Add tests for widths of opcode names.
2017-04-19 20:36:31 +03:00
Serhiy Storchaka bf623ae884 bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)
raised an error.

Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +03:00
Victor Stinner c209b70d61 bpo-29925: Skip test_uuid1_safe() on OS X Tiger (#971) 2017-04-19 13:01:03 +02:00
cocoatomo 992ae6444c Fix minor typos (GH-1173) 2017-04-18 17:38:26 -07:00
Eric Appelt d6d344d833 bpo-29514: Check magic number for bugfix release (#54)
* bpo-29514: Check magic number for micro release

Add a dict importlib.util.EXPECTED_MAGIC_NUMBERS which
details the initial and expected pyc magic number for
each minor release. This gives a mechanism for users to
check if the magic number has changed within a release and
for a test to ensure procedure is followed if a change is
necessary.

Add a test to check the current MAGIC_NUMBER against the
expected number for the release if the current release is
at candidate or final level. On test failure, describe to
the developer the procedure for changing the magic number.

* Simplify magic number release test

Simplify the magic number release test by removing
EXPECTED_MAGIC_NUMBERS table and making the expected
magic number self-contained within the test.

BPO: 29514

* Improve magic number test execution and message

Improve the execution of the magic number test by
using skipUnless for alpha and beta releases, and
directly inheriting from unittest.TestCase rather than
using the machinery for the other tests. Also improve
the error message to explain the reason for caution in
changing the magic number.

BPO: 29514
2017-04-17 11:35:43 -07:00
Serhiy Storchaka 55fe1ae970 bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051) 2017-04-16 10:46:38 +03:00
Serhiy Storchaka fdbd01151d bpo-10076: Compiled regular expression and match objects now are copyable. (#1000) 2017-04-16 10:16:03 +03:00
Serhiy Storchaka baf9f29811 bpo-29839: Raise ValueError rather than OverflowError in len() for negative values. (#701) 2017-04-16 09:37:18 +03:00
Xiang Zhang 026435ce49 bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (#1130) 2017-04-15 12:47:28 +08:00
Jack McCracken ce040f6c1e Fix misplaced positional argument in OS X support library (#1134) 2017-04-14 15:28:55 +03:00
Antoine Pitrou 685cdb9acc Relax test timing (bpo-29861) to avoid sporadic failures (#1120) 2017-04-14 13:10:00 +02:00
Ryan Gonzalez f9f87f0934 bpo-11913: Add README.rst to the distutils standard READMEs list (#563) 2017-04-14 11:00:25 +02:00
Armin Rigo 22a594a004 bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089) 2017-04-13 11:08:15 -07:00
Serhiy Storchaka 5908300e4b bpo-29995: re.escape() now escapes only special characters. (#1007) 2017-04-13 21:06:43 +03:00
Nevada Sanchez a6e395dffa bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-1119)
* Allow underscores in numeric literals in lib2to3.
* Stricter literal parsing for Python 3.6 in lib2to3.pgen2.tokenize.
* Add test case for underscores in literals in Python 3.
2017-04-13 10:32:54 -07:00
Xiang Zhang a6902e662c bpo-26985: Add missing info of code object in inspect documentation (GH-1090) 2017-04-13 10:38:28 +08:00
Serhiy Storchaka 4c0d9ea995 bpo-30017: Allowed calling the close() method of the zip entry writer object (#1041)
multiple times.  Writing to closed zip entry writer object now always produce
a ValueError.
2017-04-12 16:03:23 +03:00
Alex Gaynor c7cc14a825 Remove two legacy constants which hopefully have no consumers (#1087)
The data contained in them is nonsensical
2017-04-11 22:41:42 -04:00
Serhiy Storchaka f50354adaa Reimplement tempfile._RandomNameSequence using a generator function. (#1075) 2017-04-11 22:45:59 +03:00
svelankar 00c75e9a45 bpo-29692: contextlib.contextmanager may incorrectly unchain RuntimeError (GH-949)
contextlib._GeneratorContextManager.__exit__ includes a special case to deal with
PEP 479 RuntimeErrors created when `StopIteration` is thrown into the context
manager body.

Previously this check was too permissive, and undid one level of chaining on *all*
RuntimeError instances, not just those that wrapped a StopIteration instance.
2017-04-11 19:11:13 +10:00
Senthil Kumaran 6fab78e902 Remove superfluous comment in urllib.error. (#1076) 2017-04-10 21:08:35 -07:00
Senthil Kumaran 6dfcc81f6b Remove OSError related comment in urllib.request. (#1070) 2017-04-09 19:49:34 -07:00
Aviv Palivoda 0e6cb2ea62 bpo-26187: Test that set_trace_callback() is not called multiple times (GH-461)
conn.set_trace_callback() shouldn't be called multiple times when the
schema is changing.

This has indirectly been fixed by using sqlite3_prepare_v2() in bpo-9303.
2017-04-09 12:11:59 +03:00
Michael Seifert 64c8f705c0 bpo-29951: Include function name for some error messages in `PyArg_ParseTuple*` (#916)
Also changed format specifier for function name from "%s" to "%.200s"
and exception messages should start with lowercase letter.
2017-04-09 10:47:12 +03:00
Senthil Kumaran a2a9ddd923 Remove invalid comment in urllib.request. (#1054) 2017-04-08 23:27:25 -07:00
Serhiy Storchaka b785396ab4 bpo-29998: Pickling and copying ImportError now preserves name and path (#1010)
attributes.
2017-04-08 09:55:07 +03:00
Serhiy Storchaka 205e00c5cf bpo-29914: Fix default implementations of __reduce__ and __reduce_ex__(). (#843)
object.__reduce__() no longer takes arguments, object.__reduce_ex__() now
requires one argument.
2017-04-08 09:52:59 +03:00
Serhiy Storchaka 150cd1916a bpo-29958: Minor improvements to zipfile and tarfile CLI. (#944) 2017-04-07 18:56:12 +03:00
Senthil Kumaran fd0cd07a5a Remove Invalid comment in test_urllib2.py (#1020) 2017-04-07 00:19:08 -07:00
Stuart Berg 93b4b47e3a bpo-28837: Fix lib2to3 handling of map/zip/filter calls when followed with a 'trailer', e.g. zip()[x] (#24) 2017-04-05 22:19:40 -07:00
Mark Dickinson a0ce375e10 bpo-29962: add math.remainder (#950)
* Implement math.remainder.

* Fix markup for arguments; use double spaces after period.

* Mark up function reference in what's new entry.

* Add comment explaining the calculation in the final branch.

* Fix out-of-order entry in whatsnew.

* Add comment explaining why it's good enough to compare m with c, in spite of possible rounding error.
2017-04-05 18:34:27 +01:00
Serhiy Storchaka 5affd23e6f bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
2017-04-05 09:37:24 +03:00
Senthil Kumaran 257b980b31 correct parse_qs and parse_qsl test case descriptions. (#968)
* correct parse_qs and parse_qsl test case descriptions.
2017-04-04 21:19:43 -07:00
Andrew Nester f78b119364 bpo-29649: Improve struct.pack_into() boundary error messages (#424) 2017-04-04 13:46:25 +03:00