summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* bpo-32972: Async test case (GH-13386)Andrew Svetlov2019-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add explicit `asyncSetUp` and `asyncTearDown` methods. The rest is the same as for #13228 `AsyncTestCase` create a loop instance for every test for the sake of test isolation. Sometimes a loop shared between all tests can speed up tests execution time a lot but it requires control of closed resources after every test finish. Basically, it requires nested supervisors support that was discussed with @1st1 many times. Sorry, asyncio supervisors have no chance to land on Python 3.8. The PR intentionally does not provide API for changing the used event loop or getting the test loop: use `asyncio.set_event_loop_policy()` and `asyncio.get_event_loop()` instead. The PR adds four overridable methods to base `unittest.TestCase` class: ``` def _callSetUp(self): self.setUp() def _callTestMethod(self, method): method() def _callTearDown(self): self.tearDown() def _callCleanup(self, function, /, *args, **kwargs): function(*args, **kwargs) ``` It allows using asyncio facilities with minimal influence on the unittest code. The last but not least: the PR respects contextvars. The context variable installed by `asyncSetUp` is available on test, `tearDown` and a coroutine scheduled by `addCleanup`. https://bugs.python.org/issue32972
* bpo-22454: Add shlex.join() (the opposite of shlex.split()) (GH-7605)Bo Bayles2019-05-291-0/+20
|
* bpo-37070: Cleanup fstring debug handling (GH-13607)Eric V. Smith2019-05-291-0/+1
| | | | * Clean up some comments, fix potential memory leaks, clarify literal and expr_text.
* bpo-35246: fix support for path-like args in asyncio subprocess (GH-13628)依云2019-05-291-0/+11
| | | | | | | | | Drop isinstance checks from create_subprocess_exec function and let subprocess module do them. https://bugs.python.org/issue35246 https://bugs.python.org/issue35246
* bpo-37076: _thread.start_new_thread() calls _PyErr_WriteUnraisableMsg() ↵Victor Stinner2019-05-291-0/+18
| | | | | | | (GH-13617) _thread.start_new_thread() now logs uncaught exception raised by the function using sys.unraisablehook(), rather than sys.excepthook(), so the hook gets access to the function which raised the exception.
* bpo-37001: Makes symtable.symtable have parity with compile for input (#13483)Dino Viehland2019-05-281-0/+9
| | | | | | | * Makes symtable.symtable have parity for accepted datatypes for source code as compile() * Add NEWS blurb
* bpo-31961: Fix support of path-like executables in subprocess. (GH-5914)Serhiy Storchaka2019-05-281-0/+55
|
* bpo-22640: Add silent mode to py_compile.compile() (GH-12976)Joannah Nanjekye2019-05-281-0/+9
|
* bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606)Zackery Spytz2019-05-281-0/+4
| | | | Fix possible overflow in wrap_lenfunc() when sizeof(long) < sizeof(Py_ssize_t) (e.g., 64-bit Windows).
* bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)Jeroen Demeyer2019-05-281-0/+24
| | | Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-35279: reduce default max_workers of ThreadPoolExecutor (GH-13618)Inada Naoki2019-05-281-2/+2
|
* bpo-29883: Asyncio proactor udp (GH-13440)Andrew Svetlov2019-05-282-9/+278
| | | | | | Follow-up for #1067 https://bugs.python.org/issue29883
* bpo-37058: PEP 544: Add Protocol to typing module (GH-13585)Ivan Levkivskyi2019-05-281-7/+724
| | | | | I tried to get rid of the `_ProtocolMeta`, but unfortunately it didn'y work. My idea to return a generic alias from `@runtime_checkable` made runtime protocols unpickleable. I am not sure what is worse (a custom metaclass or having some classes unpickleable), so I decided to stick with the status quo (since there were no complains so far). So essentially this is a copy of the implementation in `typing_extensions` with two modifications: * Rename `@runtime` to `@runtime_checkable` (plus corresponding updates). * Allow protocols that extend `collections.abc.Iterable` etc.
* bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) ↵Matthias Bussonnier2019-05-281-93/+0
| | | | | | | | | | (GH-13577) It has been documented as deprecated and to be removed in 3.8; From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`. https://bugs.python.org/issue36933
* bpo-36686: Improve the documentation of the std* params in ↵sbstp2019-05-271-0/+90
| | | | | loop.subprocess_exec (GH-13586) https://bugs.python.org/issue36686
* bpo-1230540: Add threading.excepthook() (GH-13515)Victor Stinner2019-05-271-0/+92
| | | | | | | | | | | | | | | | | | | Add a new threading.excepthook() function which handles uncaught Thread.run() exception. It can be overridden to control how uncaught exceptions are handled. threading.ExceptHookArgs is not documented on purpose: it should not be used directly. * threading.excepthook() and threading.ExceptHookArgs. * Add _PyErr_Display(): similar to PyErr_Display(), but accept a 'file' parameter. * Add _thread._excepthook(): C implementation of the exception hook calling _PyErr_Display(). * Add _thread._ExceptHookArgs: structseq type. * Add threading._invoke_excepthook_wrapper() which handles the gory details to ensure that everything remains alive during Python shutdown. * Add unit tests.
* bpo-36889: Merge asyncio streams (GH-13251)Andrew Svetlov2019-05-278-228/+893
| | | https://bugs.python.org/issue36889
* bpo-37050: Remove expr_text from FormattedValue ast node, use Constant node ↵Eric V. Smith2019-05-272-6/+27
| | | | | instead (GH-13597) When using the "=" debug functionality of f-strings, use another Constant node (or a merged constant node) instead of adding expr_text to the FormattedValue node.
* bpo-32941: Fix test_madvise failure when page size >= 8kiB (GH-13596)Antoine Pitrou2019-05-271-1/+2
| | | https://bugs.python.org/issue32941
* bpo-32941: Add madvise() for mmap objects (GH-6172)Zackery Spytz2019-05-271-0/+19
| | | | Allow mmap objects to access the madvise() system call.
* bpo-36763: Implement the PEP 587 (GH-13592)Victor Stinner2019-05-271-78/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a whole new documentation page: "Python Initialization Configuration" * PyWideStringList_Append() return type is now PyStatus, instead of int * PyInterpreterState_New() now calls PyConfig_Clear() if PyConfig_InitPythonConfig() fails. * Rename files: * Python/coreconfig.c => Python/initconfig.c * Include/cpython/coreconfig.h => Include/cpython/initconfig.h * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h * Rename structures * _PyCoreConfig => PyConfig * _PyPreConfig => PyPreConfig * _PyInitError => PyStatus * _PyWstrList => PyWideStringList * Rename PyConfig fields: * use_module_search_paths => module_search_paths_set * module_search_path_env => pythonpath_env * Rename PyStatus field: _func => func * PyInterpreterState: rename core_config field to config * Rename macros and functions: * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv() * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv() * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString() * _PyInitError_Failed() => PyStatus_Exception() * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx * _Py_UnixMain() => Py_BytesMain() * _Py_ExitInitError() => Py_ExitStatusException() * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs() * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs() * _Py_PreInitialize() => Py_PreInitialize() * _Py_RunMain() => Py_RunMain() * _Py_InitializeFromConfig() => Py_InitializeFromConfig() * _Py_INIT_XXX() => _PyStatus_XXX() * _Py_INIT_FAILED() => _PyStatus_EXCEPTION() * Rename 'err' PyStatus variables to 'status' * Convert RUN_CODE() macro to config_run_code() static inline function * Remove functions: * _Py_InitializeFromArgs() * _Py_InitializeFromWideArgs() * _PyInterpreterState_GetCoreConfig()
* bpo-37027: Return a proxy socket object from transp.get_extra_info('socket') ↵Yury Selivanov2019-05-272-3/+3
| | | | | | | | | | (GH-13530) Return a safe to use proxy socket object from `transport.get_extra_info('socket')` https://bugs.python.org/issue37027
* bpo-35397: Remove deprecation and document urllib.parse.unwrap (GH-11481)Rémi Lapeyre2019-05-271-8/+4
|
* bpo-37035: Don't log OSError (GH-13548)Andrew Svetlov2019-05-272-7/+26
| | | https://bugs.python.org/issue37035
* bpo-32528: Make asyncio.CancelledError a BaseException. (GH-13528)Yury Selivanov2019-05-272-6/+4
| | | | | | | | | | | | | | | This will address the common mistake many asyncio users make: an "except Exception" clause breaking Tasks cancellation. In addition to this change, we stop inheriting asyncio.TimeoutError and asyncio.InvalidStateError from their concurrent.futures.* counterparts. There's no point for these exceptions to share the inheritance chain. In 3.9 we'll focus on implementing supervisors and cancel scopes, which should allow better handling of all exceptions, including SystemExit and KeyboardInterrupt
* bpo-36829: Add _PyErr_WriteUnraisableMsg() (GH-13488)Victor Stinner2019-05-271-17/+27
| | | | | * sys.unraisablehook: add 'err_msg' field to UnraisableHookArgs. * Use _PyErr_WriteUnraisableMsg() in _ctypes _DictRemover_call() and gc delete_garbage().
* Add one more test for typing.Final (GH-13588)Ivan Levkivskyi2019-05-261-0/+8
|
* bpo-36772 Allow lru_cache to be used as decorator without making a function ↵Raymond Hettinger2019-05-261-7/+12
| | | | call (GH-13048)
* bpo-37053: handle strings like u"bar" correctly in Tools/parser/unparse.py ↵Chih-Hsuan Yen2019-05-261-0/+5
| | | | | | | | | | | | (GH-13583) Constant.kind is added in https://bugs.python.org/issue36280. Current possible values for Constant.kind are "u" or None. For r'bar' and b'bar', Constant.kind value is None, so there's no need for special handling. https://bugs.python.org/issue37053
* bpo-36785: PEP 574 implementation (GH-7076)Antoine Pitrou2019-05-266-33/+586
|
* bpo-37049: PEP 589: Add TypedDict to typing module (GH-13573)Ivan Levkivskyi2019-05-261-1/+104
| | | | The implementation is straightforward and essentially is just copied from `typing_extensions`.
* bpo-37046: PEP 586: Add Literal to typing module (#13572)Ivan Levkivskyi2019-05-261-1/+63
| | | | The implementation is straightforward and essentially is just copied from `typing_extensions`.
* bpo-37045: PEP 591: Add final qualifiers to typing module (GH-13571)Ivan Levkivskyi2019-05-261-1/+48
| | | | The implementation is straightforward, it just mimics `ClassVar` (since the latter is also a name/access qualifier, not really a type). Also it is essentially copied from `typing_extensions`.
* bpo-34632: Add importlib.metadata (GH-12547)Jason R. Coombs2019-05-247-0/+564
| | | Add importlib.metadata module as forward port of the standalone importlib_metadata.
* bpo-36829: Document test.support.catch_unraisable_exception() (GH-13554)Victor Stinner2019-05-242-17/+11
| | | | catch_unraisable_exception() now also removes its 'unraisable' attribute at the context manager exit.
* bpo-37032: Add CodeType.replace() method (GH-13542)Victor Stinner2019-05-242-13/+61
|
* bpo-36969: Make PDB args command display positional only arguments (GH-13459)Rémi Lapeyre2019-05-241-5/+28
|
* bpo-37023: Skip test_gdb under PGO (GH-13555)Steve Dower2019-05-241-1/+5
|
* bpo-36045: builtins.help() now prefixes `async` for async functions (GH-12010)Dan Rose2019-05-241-0/+23
| | | | | | Previously, it was hard to tell whether a function should be awaited. It was also incorrect (per PEP 484) to put this in the type hint for coroutine functions. Added this info to the output of builtins.help and pydoc. https://bugs.python.org/issue36045
* bpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not ↵Matěj Cepl2019-05-231-0/+35
| | | | | handled (GH-7778) ``_thread.interrupt_main()`` now avoids setting the Python error status if the ``SIGINT`` signal is ignored or not handled by Python.
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-235-1/+301
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36763: Fix _PyPreConfig_InitCompatConfig() utf8_mode (GH-13518)Victor Stinner2019-05-231-4/+34
| | | | | | | | | | * _PyPreConfig_InitCompatConfig() sets utf8_mode to 0. * Change Py_UTF8Mode default value to 0. * Fix _PyPreConfig_Copy(): copy also _config_init attrbibute. * _PyPreConfig_AsDict() exports _config_init * Fix _PyPreConfig_GetGlobalConfig(): use Py_UTF8Mode if it's greater than 0, even if utf8_mode >= 0. * Add unit tests on environment variables using Python API.
* bpo-18748: _pyio.IOBase emits unraisable exception (GH-13512)Victor Stinner2019-05-231-37/+27
| | | | | | | | In development (-X dev) mode and in a debug build, IOBase finalizer of the _pyio module now logs the exception if the close() method fails. The exception is ignored silently by default in release build. test_io: test_error_through_destructor() now uses support.catch_unraisable_exception() rather than capturing stderr.
* bpo-27737: Allow whitespace only headers encoding (#13478)Batuhan Taşkaya2019-05-231-0/+3
|
* bpo-36829: PyErr_WriteUnraisable() normalizes exception (GH-13507)Victor Stinner2019-05-221-10/+5
| | | | | | PyErr_WriteUnraisable() now creates a traceback object if there is no current traceback. Moreover, call PyErr_NormalizeException() and PyException_SetTraceback() to normalize the exception value. Ignore silently any error.
* bpo-36763: Rename private Python initialization functions (GH-13511)Victor Stinner2019-05-221-31/+34
| | | | | | | | | | | * Rename private C functions: * _Py_Initialize_ReconfigureCore => pyinit_core_reconfigure * _Py_InitializeCore_impl => pyinit_core_config * _Py_InitializeCore = > pyinit_core * _Py_InitializeMainInterpreter => pyinit_main * init_python => pyinit_python * Rename _testembed.c commands: add "test_" prefix.
* bpo-36763: Add _PyPreConfig._config_init (GH-13481)Victor Stinner2019-05-221-49/+64
| | | | | | | | | | | | | | | | | | | * _PyPreConfig_GetGlobalConfig() and _PyCoreConfig_GetGlobalConfig() now do nothing if the configuration was not initialized with _PyPreConfig_InitCompatConfig() and _PyCoreConfig_InitCompatConfig() * Remove utf8_mode=-2 special case: use utf8_mode=-1 instead. * Fix _PyPreConfig_InitPythonConfig(): * isolated = 0 instead of -1 * use_environment = 1 instead of -1 * Rename _PyConfig_INIT to _PyConfig_INIT_COMPAT * Rename _PyPreConfig_Init() to _PyPreConfig_InitCompatConfig() * Rename _PyCoreConfig_Init() to _PyCoreConfig_InitCompatConfig() * PyInterpreterState_New() now uses _PyCoreConfig_InitPythonConfig() as default configuration, but it's very quickly overriden anyway. * _freeze_importlib.c uses _PyCoreConfig_SetString() to set program_name. * Cleanup preconfig_init_utf8_mode(): cmdline is always non-NULL.
* bpo-36829: Add test.support.catch_unraisable_exception() (GH-13490)Victor Stinner2019-05-225-43/+106
| | | | | | * Copy test_exceptions.test_unraisable() to test_sys.UnraisableHookTest(). * Use catch_unraisable_exception() in test_coroutines, test_exceptions, test_generators.
* bpo-24882: Let ThreadPoolExecutor reuse idle threads before creating new ↵Sean2019-05-221-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | thread (#6375) * Fixes issue 24882 * Add news file entry for change. * Change test_concurrent_futures.ThreadPoolShutdownTest Adjust the shutdown test so that, after submitting three jobs to the executor, the test checks for less than three threads, instead of looking for exactly three threads. If idle threads are being recycled properly, then we should have less than three threads. * Switched idle count to semaphor, Updated tests As suggested by reviewer tomMoral, swapped lock-protected counter with a semaphore to track the number of unused threads. Adjusted test_threads_terminate to wait for completiton of the previous future before submitting a new one (and checking the number of threads used). Also added a new test to confirm the thread pool can be saturated. * Updates tests as requested by pitrou. * Correct minor whitespace error. * Make test_saturation faster
* bpo-33110: Catch errors raised when running add_done_callback on already ↵Sam Martin2019-05-221-0/+16
| | | | | | completed futures (GH-13141) Wrap the callback call within the `add_done_callback` function within concurrent.futures, in order to behave in an identical manner to callbacks added to a running future are triggered once it has completed.