summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [3.6] bpo-30899: Add unittests, 100% coverage, for IDLE's two ConfigParser ↵terryjreedy2017-07-121-0/+1
| | | | | | subclasses. (GH-2662) (#2685) Patch by Louie Lu. (cherry picked from commit 50c9435)
* [3.6] bpo-30879: os.listdir() and os.scandir() now emit bytes names when ↵Serhiy Storchaka2017-07-112-3/+27
| | | | | | (GH-2634) (#2656) called with bytes-like argument.. (cherry picked from commit 1180e5a51871fa53ca6892e83fd2e69dc2600447)
* [3.6] bpo-29854: Fix segfault in call_readline() (GH-728)Nir Soffer2017-07-081-3/+47
| | | | | | | | | | | | | If history-length is set in .inputrc, and the history file is double the history size (or more), history_get(N) returns NULL, and python segfaults. Fix that by checking for NULL return value. It seems that the root cause is incorrect handling of bigger history in readline, but Python should not segfault even if readline returns unexpected value. This issue affects only GNU readline. When using libedit emulation system history size option does not work.
* bpo-30532: Fix whitespace folding in certain cases (#2591)Joel Hillacre2017-07-061-0/+12
| | | Leading whitespace was incorrectly dropped during folding of certain lines in the _header_value_parser's folding algorithm. This makes the whitespace handling code consistent.
* [3.6] bpo-30814: Fixed a race condition when import a submodule from a ↵Serhiy Storchaka2017-07-063-0/+30
| | | | | package. (GH-2580). (#2598) (cherry picked from commit b4baacee1adc06edbe30ac7574d17a8cd168e2e0)
* [3.6] bpo-30828: Fix out of bounds write in ↵Yury Selivanov2017-07-051-1/+23
| | | | | `asyncio.CFuture.remove_done_callback() (GH-2569) (#2590) (cherry picked from commit 833a3b0d3707200daeaccdd218e8f18a190284aa)
* [3.6] bpo-30441: Fix bug when modifying os.environ while iterating over it ↵Serhiy Storchaka2017-07-041-0/+24
| | | | | (GH-2409). (#2556) (cherry picked from commit 8a8d28501fc8ce25926d168f1c657656c809fd4c)
* bpo-30764: Fix regrtest --fail-env-changed --forever (#2536) (#2539)Victor Stinner2017-07-031-1/+3
| | | | --forever now stops if a fail changes the environment. (cherry picked from commit 5e87592fd12e0b7c41edc11d4885ed7298d5063b)
* [3.6] bpo-30597: Show expected input in custom 'print' error message. (GH-2531)Nick Coghlan2017-07-031-0/+28
| | | (cherry picked from commit 3a7f03584ab75afbf5507970711c87042e423bb4)
* [3.6] bpo-30703: Improve signal delivery (GH-2415) (#2527)Antoine Pitrou2017-07-011-1/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [3.6] bpo-30703: Improve signal delivery (GH-2415) * Improve signal delivery Avoid using Py_AddPendingCall from signal handler, to avoid calling signal-unsafe functions. * Remove unused function * Improve comments * Add stress test * Adapt for --without-threads * Add second stress test * Add NEWS blurb * Address comments @haypo. (cherry picked from commit c08177a1ccad2ed0d50898c2731b518c631aed14) * bpo-30796: Fix failures in signal delivery stress test (#2488) * bpo-30796: Fix failures in signal delivery stress test setitimer() can have a poor minimum resolution on some machines, this would make the test reach its deadline (and a stray signal could then kill a subsequent test). * Make sure to clear the itimer after the test
* [3.6] bpo-29512, bpo-30776: Backport regrtest enhancements from master to ↵Victor Stinner2017-06-302-10/+170
| | | | | | | | | | | | | | | | | 3.6 (#2513) * bpo-29512: Add test.bisect, bisect failing tests (#2452) Add a new "python3 -m test.bisect" tool to bisect failing tests. It can be used to find which test method(s) leak references, leak files, etc. (cherry picked from commit 84d9d14a1fa395fbd21262ba195490be25a7b3bc) * bpo-30776: regrtest: reduce memleak false positive (#2484) Only report a leak if each run leaks at least one memory block. (cherry picked from commit beeca6e1e5fd01531b1db7059498b13d07dca525)
* bpo-30280: Cleanup threads in ayncio tests (#2501) (#2511)Victor Stinner2017-06-301-5/+3
| | | | | | | | | | | | | | | | | * bpo-30280: asyncio now cleans up threads asyncio base TestCase now uses threading_setup() and threading_cleanup() of test.support to cleanup threads. * asyncio: Fix TestBaseSelectorEventLoop cleanup bpo-30280: TestBaseSelectorEventLoop of test.test_asyncio.test_selector_events now correctly closes the event loop: cleanup its executor to not leak threads. Don't override the close() method of the event loop, only override the_close_self_pipe() method. (cherry picked from commit b9030674624c181d6e9047cdb14ad65bb6c84c66)
* bpo-30812: Fix test_warnings, restore _showwarnmsg (#2504) (#2507)Victor Stinner2017-06-301-4/+9
| | | | | bpo-26568, bpo-30812: Fix test_showwarnmsg_missing(): restore the attribute after removing it. (cherry picked from commit 7eebeb8fb84e2a9cb73903a08c59cf1d3b32cee0)
* [3.6] bpo-30807: signal.setitimer() may disable the timer by mistake ↵Antoine Pitrou2017-06-301-0/+9
| | | | | | | | (GH-2493) (#2497) * bpo-30807: signal.setitimer() may disable the timer by mistake * Add NEWS blurb (cherry picked from commit 729780a810bbcb12b245a1b652302a601fc9f6fd)
* [3.6] Clear potential ref cycle between Process and Process target (GH-2470) ↵Antoine Pitrou2017-06-281-0/+18
| | | | | | | | | | | (#2471) * Clear potential ref cycle between Process and Process target Besides Process.join() not being called, this was an indirect cause of bpo-30775. The threading module already does this. * Add issue reference. (cherry picked from commit 79d37ae979a65ada0b2ac820279ccc3b1cd41ba6)
* [3.6] bpo-30775: Fix refleaks in test_multiprocessing (GH-2467) (#2468)Antoine Pitrou2017-06-281-2/+17
| | | | Forgetting to call Process.join() can keep some resources alive. (cherry picked from commit a79f8faccf5e26f55e8b9496ad49d2071b5e299c)
* [3.6] bpo-13617: Reject embedded null characters in wchar* strings. ↵Serhiy Storchaka2017-06-287-1/+33
| | | | | | | | | | (GH-2302) (#2462) Based on patch by Victor Stinner. Add private C API function _PyUnicode_AsUnicode() which is similar to PyUnicode_AsUnicode(), but checks for null characters.. (cherry picked from commit f7eae0adfcd4c50034281b2c69f461b43b68db84)
* [3.6] bpo-30523, bpo-30764, bpo-30776: Sync regrtest from master (#2441)Victor Stinner2017-06-275-49/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 ace56d583664f855d89d1219ece7c21c2fddcf30) * 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 63f54c68936d648c70ca411661e4208329edcf26) * 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 48b5c422ffb03affb00c184b9a99e5537be92732)
* bpo-30764: test_subprocess uses SuppressCrashReport (#2405) (#2410)Victor Stinner2017-06-261-26/+25
| | | | | | 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 cdee3f14f7f4c995e7eedb0bf6a67e260c739f7d)
* [3.6] bpo-30746: Prohibited the '=' character in environment variable names ↵Serhiy Storchaka2017-06-252-0/+91
| | | | | | | (GH-2382) (#2391) in `os.putenv()` and `os.spawn*()`.. (cherry picked from commit 77703942c5997dff00c48f10df1b29b11645624c)
* [3.6] bpo-30616: Functional API of enum allows to create empty enums. ↵Dong-hee Na2017-06-241-0/+20
| | | | (#2304) (#2324)
* [3.6] bpo-30730: Prevent environment variables injection in subprocess on ↵Serhiy Storchaka2017-06-231-0/+40
| | | | | | Windows. (GH-2325) (#2360) Prevent passing other invalid environment variables and command arguments.. (cherry picked from commit d174d24a5d37d1516b885dc7c82f71ecd5930700)
* bpo-30604: Skip CoExtra tests if ctypes is missing (#2356) (#2358)Victor Stinner2017-06-231-3/+6
| | | (cherry picked from commit a4b091e135ccf345cfafdd8477aef897c5214f82)
* [3.6] bpo-30727: Fix a race condition in test_threading. (GH-2334) (#2351)Serhiy Storchaka2017-06-231-5/+14
| | | (cherry picked from commit 32cb968)
* [3.6] bpo-29755: Fixed the lgettext() family of functions in the gettext ↵Serhiy Storchaka2017-06-201-9/+123
| | | | | | | | module. (GH-2266) (#2297) They now always return bytes. Updated the gettext documentation.. (cherry picked from commit 26cb4657bcc9a7adffa95798ececb588dddfeadb)
* bpo-30500: urllib: Simplify splithost by calling into urlparse. (#1849) (#2289)Victor Stinner2017-06-201-12/+39
| | | | | | | | | 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 90e01e50ef8a9e6c91f30d965563c378a4ad26de)
* bpo-29887: test_normalization handles PermissionError (#1196) (#2275)Victor Stinner2017-06-191-0/+3
| | | | | Skip test_normalization.test_main() if download raises a permission error. (cherry picked from commit d13d54748d3a7db023d9db37223ea7d40bb8f8e3)
* [3.6] bpo-29887: Test normalization now fails if download fails (GH-905) (#2271)Mariatta2017-06-191-4/+9
| | | | | | | | | | | | * 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 722a3af092b94983aa26f5e591fb1b45e2c2a0ff)
* [email] bpo-29478: Fix passing max_line_length=None from Compat32 policy ↵Mariatta2017-06-161-0/+7
| | | | | | | (GH-595) (GH-2233) If max_line_length=None is specified while using the Compat32 policy, it is no longer ignored.. (cherry picked from commit b459f7482612d340b88b62edc024628595ec6337)
* [3.6] bpo-30682: Removed a too-strict assertion that failed for certain ↵Serhiy Storchaka2017-06-161-0/+6
| | | | | | f-strings. (GH-2232) (#2242) This caused a segfault on eval("f'\\\n'") and eval("f'\\\r'") in debug build.. (cherry picked from commit 11e97f2f80bf65cc828c127eafc95229df35d403)
* Synchronize libregrtest from master to 3.6 (#2244)Victor Stinner2017-06-167-58/+228
| | | | | | | * bpo-30523: regrtest: Add --list-cases option (#2238) * bpo-30284: Fix regrtest for out of tree build (#1481) * bpo-30540: regrtest: add --matchfile option (#1909) * bpo-30258: regrtest: Fix run_tests_multiprocess() (#1479) * bpo-30263: regrtest: log system load (#1452)
* bpo-30149: Fix partialmethod without explicit self parameter (#1308) (#1662)Dong-hee Na2017-06-151-0/+35
|
* [3.6] bpo-29931 fix __lt__ check in ipaddress.ip_interface for both v4 and ↵Serhiy Storchaka2017-06-151-8/+29
| | | | | | | | | | v6. (GH-879) (#2217) the original logic was just comparing the network address but this is wrong because if the network address is equal then we need to compare the ip address for breaking the tie add more ip_interface comparison tests. (cherry picked from commit 7bd8d3e794782582a4ad1c9749424fff86802c3e)
* [3.6] bpo-30605: Fix compiling binary regexs with BytesWarnings enabled. ↵Serhiy Storchaka2017-06-151-2/+14
| | | | | | (GH-2016) (#2214) Running our unit tests with `-bb` enabled triggered this failure.. (cherry picked from commit 171b9a354e816eebc6d4c3a8553303942e9c5025)
* bpo-30231: Remove skipped test_imaplib tests (#1419) (#2192)Victor Stinner2017-06-141-20/+10
| | | | | | | | | The public cyrus.andrew.cmu.edu IMAP server (port 993) doesn't accept TLS connection using our self-signed x509 certificate. Remove the two tests which are already skipped. Write a new test_certfile_arg_warn() unit test for the certfile deprecation warning. (cherry picked from commit b18563da8803433509e9a0e29718e0271014659f)
* [3.6] bpo-30649: test_os tolerates 50 ms delta for utime (#2156) (#2175)Victor Stinner2017-06-141-1/+6
| | | | | | | | | | | | | | | | | | * bpo-30649: test_os tolerates 50 ms delta for utime (#2156) On Windows, tolerate a delta of 50 ms instead of 20 ms in test_utime_current() and test_utime_current_old() of test_os. On other platforms, reduce the delta from 20 ms to 10 ms. (cherry picked from commit c94caca65cd38802243b5279cf85ee44ffb2abb8) * bpo-30649: Revert utime delta in test_os (#2176) PPC64 Fedora 3.x buildbot requires at least a delta of 14 ms: revert the utime delta to 20 ms. I tried 10 ms, but test_os failed on the PPC64 Fedora 3.x buildbot. (cherry picked from commit 3402f7268897db15053866e1e68404cfa0e02706)
* [3.6] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) ↵Antoine Pitrou2017-06-131-0/+63
| | | | | | | | | | | | | (#2166) * bpo-24484: Avoid race condition in multiprocessing cleanup The finalizer registry can be mutated while inspected by multiprocessing at process exit. * Use test.support.start_threads() * Add Misc/NEWS. (cherry picked from commit 1eb6c0074d17f4fd425cacfdda893d65f5f77f0a)
* [3.6] bpo-29514: Check magic number for bugfix releases (#2157)Nick Coghlan2017-06-131-0/+44
| | | | | | | | | | | | 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. This ensures that pre-merge CI will automatically pick up on magic number changes in maintenance releases (and explain why those are problematic), rather than relying on all core developers to be aware of the implications of such changes.
* [3.6] bpo-30604: Move co_extra_freefuncs to interpreter state to avoid ↵Dino Viehland2017-06-131-3/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | crashes in threads (#2015) * Move co_extra_freefuncs to interpreter state to avoid crashes in multi-threaded scenarios involving deletion of code objects * Don't require that extra be zero initialized * Build test list instead of defining empty test class * Ensure extra is always assigned on success * Keep the old fields in the thread state object, just don't use them Add new linked list of code extra objects on a per-interpreter basis so that interpreter state size isn't changed * Rename __PyCodeExtraState_Get and add comment about it going away in 3.7 Fix sort order of import's in test_code.py * Remove an extraneous space * Remove docstrings for comments * Touch up formatting * Fix casing of coextra local * Fix casing of another variable * Prefix PyCodeExtraState with __ to match C API for getting it * Update NEWS file for bpo-30604
* [3.6] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) ↵Serhiy Storchaka2017-06-121-0/+10
| | | | | | (#2121) The traceback no longer displayed for SystemExit raised in a callback registered by atexit.. (cherry picked from commit 3fd54d4a7e604067e2bc0f8cfd58bdbdc09fa7f4)
* Revert "[3.6] bpo-29406: asyncio SSL contexts leak sockets after calling ↵Yury Selivanov2017-06-111-34/+0
| | | | | close with certain servers (GH-409) (#2062)" (#2112) This reverts commit 6e14fd2a14cef6ea0709ad234ab41198c2195591.
* bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. ↵Yury Selivanov2017-06-112-0/+27
| | | | (#2109)
* bpo-28556: Updates to typing module (GH-2076) (GH-2087)Mariatta2017-06-101-3/+36
| | | | | | | This PR contains two updates to typing module: - Support ContextManager on all versions (original PR by Jelle Zijlstra). - Add generic AsyncContextManager.. (cherry picked from commit 29fda8db16e0edab92841277fa223f844f5a92cc)
* [3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with ↵Yury Selivanov2017-06-101-0/+34
| | | | | | | | | | | | | | | certain servers (GH-409) (#2062) * bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (#409) (cherry picked from commit a608d2d5a7f1aabe9bcbfc220135c5e126189390) * [3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409) * asyncio SSL contexts leak sockets after calling close with certain servers * cleanup _shutdown_timeout_handle on _fatal_error. (cherry picked from commit a608d2d5a7f1aabe9bcbfc220135c5e126189390)
* bpo-30266: support "= None" pattern in AbstractContextManager (GH-1448) ↵Mariatta2017-06-101-0/+10
| | | | | | | | (GH-2054) contextlib.AbstractContextManager now supports anti-registration by setting __enter__ = None or __exit__ = None, following the pattern introduced in bpo-25958.. (cherry picked from commit 57161aac5eb9bcb0b43e551a1937ff0a84c1ec52)
* Closing transport during handshake process leaks socket (#480) (#2044)Yury Selivanov2017-06-091-0/+15
|
* Fix waiter cancellation in asyncio.Lock (#1031) (#2037)Yury Selivanov2017-06-091-0/+22
| | | | | | Avoid a deadlock when the waiter who is about to take the lock is cancelled Issue #27585
* [3.6] bpo-30039: Don't run signal handlers while resuming a yield from stack ↵Yury Selivanov2017-06-091-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-1081) (#1640) 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.. (cherry picked from commit ab4413a7e9bda95b6fcd517073e2a51dafaa1624)
* bpo-30524: Write unit tests for FASTCALL (#2022) (#2030)Victor Stinner2017-06-091-0/+176
| | | | | | | | Test C functions: * _PyObject_FastCall() * _PyObject_FastCallDict() * _PyObject_FastCallKeywords() (cherry picked from commit 3b5cf85edc188345668f987c824a2acb338a7816)
* [3.6] bpo-30529: Fix errors for invalid whitespaces in f-string ↵Serhiy Storchaka2017-06-081-0/+10
| | | | | | | | subexpressions. (GH-1888) (#2013) 'invalid character in identifier' now is raised instead of 'f-string: empty expression not allowed' if a subexpression contains only whitespaces and they are not accepted by Python parser. (cherry picked from commit 2e9cd58)