summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* bpo-30039: Don't run signal handlers while resuming a yield from stack (#1081)Nathaniel J. Smith2017-05-171-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have a chain of generators/coroutines that are 'yield from'ing each other, then resuming the stack works like: - call send() on the outermost generator - this enters _PyEval_EvalFrameDefault, which re-executes the YIELD_FROM opcode - which calls send() on the next generator - which enters _PyEval_EvalFrameDefault, which re-executes the YIELD_FROM opcode - ...etc. However, every time we enter _PyEval_EvalFrameDefault, the first thing we do is to check for pending signals, and if there are any then we run the signal handler. And if it raises an exception, then we immediately propagate that exception *instead* of starting to execute bytecode. This means that e.g. a SIGINT at the wrong moment can "break the chain" – it can be raised in the middle of our yield from chain, with the bottom part of the stack abandoned for the garbage collector. The fix is pretty simple: there's already a special case in _PyEval_EvalFrameEx where it skips running signal handlers if the next opcode is SETUP_FINALLY. (I don't see how this accomplishes anything useful, but that's another story.) If we extend this check to also skip running signal handlers when the next opcode is YIELD_FROM, then that closes the hole – now the exception can only be raised at the innermost stack frame. This shouldn't have any performance implications, because the opcode check happens inside the "slow path" after we've already determined that there's a pending signal or something similar for us to process; the vast majority of the time this isn't true and the new check doesn't run at all.
* bpo-30149: Fix partialmethod without explicit self parameter (#1308)Dong-hee Na2017-05-171-0/+35
|
* bpo-30387: Fix warning in test_threading (#1634)Victor Stinner2017-05-171-3/+5
| | | | | | | | | test_is_alive_after_fork() now joins directly the thread to avoid the following warning added by bpo-30357: Warning -- threading_cleanup() failed to cleanup 0 threads after 2 sec (count: 0, dangling: 21) Use also a different exit code to catch generic exit code 1.
* bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601)Xiang Zhang2017-05-171-0/+36
| | | | | Under *spawn* and *forkserver* start methods, SimpleQueue.empty() could raise AttributeError due to not setting _poll in __setstate__.
* bpo-30375: Correct the stacklevel of regex compiling warnings. (#1595)Serhiy Storchaka2017-05-161-3/+14
| | | | | | Warnings emitted when compile a regular expression now always point to the line in the user code. Previously they could point into inners of the re module if emitted from inside of groups or conditionals.
* Remove unused variable in test_urllibnet. (#1598)Senthil Kumaran2017-05-161-1/+3
|
* bpo-30339: test_multiprocessing_main_handling timeout (#1593)Victor Stinner2017-05-151-1/+1
| | | | | test_multiprocessing_main_handling: increase the test_source timeout from 10 seconds to 60 seconds, since the test fails randomly on busy buildbots.
* bpo-30357: test_thread now uses threading_cleanup() (#1592)Victor Stinner2017-05-151-0/+4
| | | | | | | 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: Grzegorz Grzywacz <grzegorz.grzywacz@nazwa.pl>
* bpo-29196: Removed old-deprecated classes Plist, Dict and _InternalDict (#488)Serhiy Storchaka2017-05-151-8/+7
| | | | | in the plistlib module. Dict values in the result of functions readPlist() and readPlistFromBytes() are now exact dicts.
* bpo-9850: Deprecate the macpath module (#1540)Victor Stinner2017-05-151-1/+7
| | | Co-Authored-By: Chi Hsuan Yen <yan12125@gmail.com>.
* bpo-30110: fix resource leak in test_asyncio.test_events (#1413)Xiang Zhang2017-05-151-1/+3
|
* bpo-29763: Clean up _pth tests (GH-954)Zachary Ware2017-05-141-46/+31
|
* bpo-30299: Display a bytecode when compile a regex in debug mode. (#1491)Serhiy Storchaka2017-05-141-0/+27
| | | | | `re.compile(..., re.DEBUG)` now displays the compiled bytecode in human readable form.
* bpo-30340: Enhanced regular expressions optimization. (#1542)Serhiy Storchaka2017-05-141-14/+12
| | | | This increased the performance of matching some patterns up to 25 times.
* bpo-30308: Code coverage for argument in random.shuffle (#1504)csabella2017-05-111-1/+11
| | | | | | | | * bpo-30308: Code coverage for argument in random.shuffle * bpo-30308: Code coverage for argument in random.shuffle * bpo-30308: Code coverage for argument in random.shuffle
* bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1097)INADA Naoki2017-05-111-0/+18
| | | | | | | | | | | | when there are no more `await` or `yield (from)` before return in coroutine, cancel was ignored. example: async def coro(): asyncio.Task.current_task().cancel() return 42 ... res = await coro() # should raise CancelledError
* bpo-30298: Weaken the condition of deprecation warnings for inline ↵Serhiy Storchaka2017-05-101-14/+45
| | | | | | | | modifiers. (#1490) Now allowed several subsequential inline modifiers at the start of the pattern (e.g. '(?i)(?s)...'). In verbose mode whitespaces and comments now are allowed before and between inline modifiers (e.g. '(?x) (?i) (?s)...').
* bpo-30320: test_eintr now uses pthread_sigmask() (#1523)Victor Stinner2017-05-101-35/+26
| | | | | | | | | | | | Rewrite sigwaitinfo() and sigtimedwait() unit tests for EINTR using pthread_sigmask() to fix a race condition between the child and the parent process. Remove the pipe which was used as a weak workaround against the race condition. sigtimedwait() is now tested with a child process sending a signal instead of testing the timeout feature which is more unstable (especially regarding to clock resolution depending on the platform).
* bpo-30285: Optimize case-insensitive matching and searching (#1482)Serhiy Storchaka2017-05-091-0/+9
| | | | of regular expressions.
* bpo-30024: Circular imports involving absolute imports with binding (#1264)Serhiy Storchaka2017-05-093-0/+8
| | | a submodule to a name are now supported.
* bpo-30258: regrtest: Fix run_tests_multiprocess() (#1479)Victor Stinner2017-05-092-1/+3
| | | | | | If the child process exited with a non-zero code, don't strip the last line of stdout anymore. Add also a sanity check in accumulate_result().
* bpo-29990: Fix range checking in GB18030 decoder (#1495)Xiang Zhang2017-05-091-0/+6
| | | When decoding a 4-byte GB18030 sequence, the first and third byte cannot exceed 0xFE.
* bpo-29979: Rewrite cgi.parse_multipart to make it consistent with ↵Pierre Quentel2017-05-081-2/+2
| | | | FieldStorage (#991)
* bpo-30218: support path-like objects in shutil.unpack_archive() (GH-1367)Jelle Zijlstra2017-05-051-4/+17
| | | Thanks to Jelle Zijlstra for the patch.
* bpo-30264: ExpatParser closes the source on error (#1451)Victor Stinner2017-05-051-6/+18
| | | | | | | | ExpatParser.parse() of xml.sax.xmlreader now always closes the source: close the file object or the urllib object if source is a string (not an open file-like object). The change fixes a ResourceWarning on parsing error. Add test_parse_close_source() unit test.
* bpo-30277: Replace _sre.getlower() with _sre.ascii_tolower() and ↵Serhiy Storchaka2017-05-051-10/+16
| | | | _sre.unicode_tolower(). (#1468)
* bpo-30215: Make re.compile() locale agnostic. (#1361)Serhiy Storchaka2017-05-051-0/+32
| | | | | | Compiled regular expression objects with the re.LOCALE flag no longer depend on the locale at compile time. Only the locale at matching time affects the result of matching.
* bpo-30263: regrtest: log system load (#1452)Victor Stinner2017-05-043-25/+39
| | | | | | | | * bpo-30263: regrtest: log system load * regrtest: log the number of CPUs Log the number of CPUs in the header. --verbose now imply --header.
* bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. (#1316)Serhiy Storchaka2017-05-031-18/+41
|
* bpo-30103: Allow Uuencode in Python using backtick as zero instead of space ↵Xiang Zhang2017-05-032-46/+73
| | | | | | (#1326)
* Fix tests: getsockname() can return None on OS X on unbound sockets (#1400)Antoine Pitrou2017-05-021-2/+2
|
* Remove outdated tests in test_isinstance (GH-1393)Jim Fasarakis-Hilliard2017-05-021-17/+1
| | | There is no need to test for new-style classes versus classic classes in Python 3.
* bpo-28556: Routine updates to typing (#1366)Ivan Levkivskyi2017-05-021-5/+46
| | | | | - Add NoReturn type - Use WrapperDescriptorType (original PR by Jim Fasarakis-Hilliard) - Minor bug-fixes
* bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux (#1370)Antoine Pitrou2017-05-021-0/+4
| | | | | | * bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux * Add NEWS entry
* bpo-30199: test_ssl closes all asyncore channels (#1381)Victor Stinner2017-05-021-1/+3
| | | | | | | | | | | | 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>}
* bpo-29679: Implement @contextlib.asynccontextmanager (#360)Jelle Zijlstra2017-05-011-0/+212
|
* bpo-30158: Fix deprecation warnings in test_importlib introduced by ↵Serhiy Storchaka2017-04-291-13/+16
| | | | bpo-29576. (#1285)
* bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. ↵Serhiy Storchaka2017-04-283-13/+37
| | | | | | | | | | | | | (#1341) * bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. They now work when delete replaced attribute or item inside the with statement. The old value of the attribute or item (or None if it doesn't exist) now will be assigned to the target of the "as" clause, if there is one. * Update docstrings.
* bpo-30175: Skip client cert tests of test_imaplib (#1320)Victor Stinner2017-04-272-1/+12
| | | | | | | | | | | | | * bpo-30175: Skip client cert tests of test_imaplib The IMAP server cyrus.andrew.cmu.edu doesn't accept our randomly generated client x509 certificate anymore. * bpo-30188: Catch EOFError in NetworkedNNTPTests test_nntplib fails randomly with EOFError in NetworkedNNTPTests.setUpClass(). Catch EOFError to skip tests in that case.
* bpo-30131: test_logging now joins queue threads (#1298)Victor Stinner2017-04-261-0/+8
| | | | | | | | QueueListenerTest of test_logging now closes the multiprocessing Queue and joins its thread to prevent leaking dangling threads to following tests. Add also @support.reap_threads to detect earlier if a test leaks threads (and try to "cleanup" these threads).
* bpo-30107: Make SuppressCrashReport quiet on macOS (#1279)Victor Stinner2017-04-251-4/+9
| | | | | | | | | On macOS, SuppressCrashReport now redirects /usr/bin/defaults command stderr into a pipe to not pollute stderr. It fixes a test_io.test_daemon_threads_shutdown_stderr_deadlock() failure when the CrashReporter domain doesn't exists. Message logged into stderr: 2017-04-24 16:57:21.432 defaults[41046:2462851] The domain/default pair of (com.apple.CrashReporter, DialogType) does not exist
* bpo:29950: Rename SlotWrapperType to WrapperDescriptorType (GH-926)Jim Fasarakis-Hilliard2017-04-251-4/+4
|
* bpo-30131: Cleanup threads in test_logging (#1275)Victor Stinner2017-04-241-0/+15
| | | | * Use @support.reap_threads on unit tests creating threads * Call TestCase.fail() on thread.join(timeout) failure
* bpo-29822: Make inspect.isabstract() work during __init_subclass__. (#678)Nate2017-04-241-0/+24
| | | | | | | At the time when an abstract base class' __init_subclass__ runs, ABCMeta.__new__ has not yet finished running, so in the presence of __init_subclass__, inspect.isabstract() can no longer depend only on TPFLAGS_IS_ABSTRACT.
* bpo-30144: Import collections ABC from collections.abc rather than ↵Serhiy Storchaka2017-04-246-59/+61
| | | | collections. (#1263)
* bpo-29960 _random.Random corrupted on exception in setstate(). (#1019)bladebryan2017-04-221-0/+5
|
* bpo-30125: disable faulthandler in ctypes test_SEH (#1237)Victor Stinner2017-04-211-0/+16
| | | | | | | | Disable faulthandler to run test_SEH() of test_ctypes to prevent the following log with a traceback: Windows fatal exception: access violation Add support.disable_faulthandler() context manager.
* bpo-30125: Fix faulthandler.disable() on Windows (#1240)Victor Stinner2017-04-211-0/+12
| | | | | | | | | | | | * 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().
* bpo-30107: don't dump core on expected test_io crash (#1235)Victor Stinner2017-04-211-0/+5
| | | | | | | | | | | | | | 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']
* bpo-30106: Fix test_asyncore.test_quick_connect() (#1234)Victor Stinner2017-04-211-1/+2
| | | | | | | | | | 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.