summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* bpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not ↵Matěj Cepl2019-05-231-4/+9
| | | | | 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-2311-3/+257
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-33164: update blake2 implementation (GH-6286)David Carlier2019-05-2322-675/+18361
|
* bpo-36084: Add native thread ID (TID) to threading.Thread (GH-13463)Jake Tesler2019-05-221-0/+20
| | | | Add native thread ID (TID) to threading.Thread objects (supported platforms: Windows, FreeBSD, Linux, macOS).
* bpo-31862: Port binascii to PEP 489 multiphase initialization (GH-4108)Marcel Plch2019-05-221-34/+103
|
* bpo-36829: Add sys.unraisablehook() (GH-13187)Victor Stinner2019-05-221-0/+15
| | | | | | | | | | | | | | | | | | | Add new sys.unraisablehook() function which can be overridden to control how "unraisable exceptions" are handled. It is called when an exception has occurred but there is no way for Python to handle it. For example, when a destructor raises an exception or during garbage collection (gc.collect()). Changes: * Add an internal UnraisableHookArgs type used to pass arguments to sys.unraisablehook. * Add _PyErr_WriteUnraisableDefaultHook(). * The default hook now ignores exception on writing the traceback. * test_sys now uses unittest.main() to automatically discover tests: remove test_main(). * Add _PyErr_Init(). * Fix PyErr_WriteUnraisable(): hold a strong reference to sys.stderr while using it
* bpo-36648: fix mmap issue for VxWorks (GH-12394)Lihua Zhao2019-05-211-0/+7
| | | | | The mmap module set MAP_SHARED flag when map anonymous memory, however VxWorks only support MAP_PRIVATE when map anonymous memory, this commit clear MAP_SHARED and set MAP_PRIVATE.
* bpo-31904: Add posix module support for VxWorks (GH-12118)pxinwr2019-05-212-12/+70
|
* Revert "bpo-36084: Add native thread ID to threading.Thread objects ↵Victor Stinner2019-05-211-16/+0
| | | | | (GH-11993)" (GH-13458) This reverts commit 4959c33d2555b89b494c678d99be81a65ee864b0.
* bpo-36965: Fix includes in main.c on Windows with non-MSC compilers (GH-13421)Erik Janssens2019-05-211-2/+2
| | | | Include windows.h rather than crtdbg.h to get STATUS_CONTROL_C_EXIT constant. Moreover, include windows.h on Windows, not only when MSC is used.
* bpo-36888: Add multiprocessing.parent_process() (GH-13247)Thomas Moreau2019-05-201-0/+1
|
* bpo-35134: Split traceback.h header (GH-13430)Victor Stinner2019-05-192-0/+2
| | | | Add new Include/cpython/traceback.h and Include/internal/traceback.h header files.
* bpo-36957: Speed up math.isqrt (#13405)Mark Dickinson2019-05-191-8/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add math.isqrt function computing the integer square root. * Code cleanup: remove redundant comments, rename some variables. * Tighten up code a bit more; use Py_XDECREF to simplify error handling. * Update Modules/mathmodule.c Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com> * Update Modules/mathmodule.c Use real argument clinic type instead of an alias Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com> * Add proof sketch * Updates from review. * Correct and expand documentation. * Fix bad reference handling on error; make some variables block-local; other tidying. * Style and consistency fixes. * Add missing error check; don't try to DECREF a NULL a * Simplify some error returns. * Another two test cases: - clarify that floats are rejected even if they happen to be squares of small integers - TypeError beats ValueError for a negative float * Add fast path for small inputs. Needs tests. * Speed up isqrt for n >= 2**64 as well; add extra tests. * Reduce number of test-cases to avoid dominating the run-time of test_math. * Don't perform unnecessary extra iterations when computing c_bit_length. * Abstract common uint64_t code out into a separate function. * Cleanup. * Add a missing Py_DECREF in an error branch. More cleanup. * Update Modules/mathmodule.c Add missing `static` declaration to helper function. Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com> * Add missing backtick.
* bpo-36957: Add _PyLong_Rshift() and _PyLong_Lshift(). (GH-13416)Serhiy Storchaka2019-05-191-23/+7
|
* bpo-36887: add math.isqrt (GH-13244)Mark Dickinson2019-05-182-1/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add math.isqrt function computing the integer square root. * Code cleanup: remove redundant comments, rename some variables. * Tighten up code a bit more; use Py_XDECREF to simplify error handling. * Update Modules/mathmodule.c Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com> * Update Modules/mathmodule.c Use real argument clinic type instead of an alias Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com> * Add proof sketch * Updates from review. * Correct and expand documentation. * Fix bad reference handling on error; make some variables block-local; other tidying. * Style and consistency fixes. * Add missing error check; don't try to DECREF a NULL a * Simplify some error returns. * Another two test cases: - clarify that floats are rejected even if they happen to be squares of small integers - TypeError beats ValueError for a negative float * Documentation and markup improvements; thanks Serhiy for the suggestions! * Cleaner Misc/NEWS entry wording. * Clean up (with one fix) to the algorithm explanation and proof.
* bpo-36763: Add _PyInitError functions (GH-13395)Victor Stinner2019-05-172-0/+2
| | | | | | | | | | | | | | | * Add _PyInitError functions: * _PyInitError_Ok() * _PyInitError_Error() * _PyInitError_NoMemory() * _PyInitError_Exit() * _PyInitError_IsError() * _PyInitError_IsExit() * _PyInitError_Failed() * frozenmain.c and _testembed.c now use functions rather than macros. * Move _Py_INIT_xxx() macros to the internal API. * Move _PyWstrList_INIT macro to the internal API.
* bpo-36763: _Py_RunMain() doesn't call Py_Exit() anymore (GH-13390)Victor Stinner2019-05-171-46/+75
| | | | | | | | | Py_Main() and _Py_RunMain() now return the exitcode rather than calling Py_Exit(exitcode) when calling PyErr_Print() if the current exception type is SystemExit. * Add _Py_HandleSystemExit(). * Add pymain_exit_err_print(). * Add pymain_exit_print().
* bpo-36782: Created C API wrappers and added missing tests for functions in ↵Edison A2019-05-171-1/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the PyDateTimeAPI. (#13088) * created a c API wrapper for pyDate_FromDate and added the test * 📜🤖 Added by blurb_it. * fixed auto-alignment by vscode * made changes as per PEP7 * Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst * Refactored code as per requested changes * Remove Whitespace to Fix failed travis build * Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst * Add a new line at end of ACKS * Added C API function for PyDateTime_FromDateAndTime * Added a test for the C API wrapper of PyDateTime_FromDateAndTime * Added C API function for PyDateTime_FromDateAndTime * Added a test for the C API wrapper of PyDateTime_FromDateAndTimeAndFold * Remove Whitespace using patchcheck * Added a C API function for PyTime_FromTime * Added a test for the C API wrapper of PyTime_FromTime * Added a C API function for PyTime_FromTimeAndFold * Added a test for the C API wrapper of PyTime_FromTimeAndFold * Added a C API function for PyDelta_FromDSU * Added a test for the C API wrapper of PyDelta_FromDSU * Refactor code, re-edit lines longer than 80 chars * Fix Whitespace issues in DatetimeTester * List all tests that were added in this PR * Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst * Reformat code as per PEP7 guidelines * Remove unused varibles from another function * Added specific tests for the Fold Attribute * Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst * Reformat code according to requested changes * Reformat code to PEP7 Guidelines * Reformat code to PEP7 Guidelines * Re-add name to blurb * Added a backtick to blurb file * Update 2019-05-04-21-25-19.bpo-36782.h3oPIb.rst * Remove the need to initialize mandatory parameters * Make the macro parameter mandatory * Re-arrange the order of unit-test args * Removed the need to initialize macro change all the int macro = 0 to int macro; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com> * Removed the need to initialize macro change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com> * Removed the need to initialize macro change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com> * Removed the need to initialize macro change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com> * Removed the need to initialize macro change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com> * Removed the need to initialize macro change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>
* bpo-36763: Add _PyCoreConfig_InitPythonConfig() (GH-13388)Victor Stinner2019-05-171-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new functions to get the Python interpreter behavior: * _PyPreConfig_InitPythonConfig() * _PyCoreConfig_InitPythonConfig() Add new functions to get an isolated configuration: * _PyPreConfig_InitIsolatedConfig() * _PyCoreConfig_InitIsolatedConfig() Replace _PyPreConfig_INIT and _PyCoreConfig_INIT with new functions _PyPreConfig_Init() and _PyCoreConfig_Init(). _PyCoreConfig: set configure_c_stdio and parse_argv to 0 by default to behave as Python 3.6 in the default configuration. _PyCoreConfig_Read() no longer sets coerce_c_locale_warn to 1 if it's equal to 0. coerce_c_locale_warn must now be set to -1 (ex: using _PyCoreConfig_InitPythonConfig()) to enable C locale coercion warning. Add unit tests for _PyCoreConfig_InitPythonConfig() and _PyCoreConfig_InitIsolatedConfig(). Changes: * Rename _PyCoreConfig_GetCoreConfig() to _PyPreConfig_GetCoreConfig() * Fix core_read_precmdline(): handle parse_argv=0 * Fix _Py_PreInitializeFromCoreConfig(): pass coreconfig.argv to _Py_PreInitializeFromPyArgv(), except if parse_argv=0
* bpo-36763: Add PyMemAllocatorName (GH-13387)Victor Stinner2019-05-171-1/+1
| | | | | | | | | | | | | | * Add PyMemAllocatorName enum * _PyPreConfig.allocator type becomes PyMemAllocatorName, instead of char* * Remove _PyPreConfig_Clear() * Add _PyMem_GetAllocatorName() * Rename _PyMem_GetAllocatorsName() to _PyMem_GetCurrentAllocatorName() * Remove _PyPreConfig_SetAllocator(): just call _PyMem_SetupAllocators() directly, we don't have do reallocate the configuration with the new allocator anymore! * _PyPreConfig_Write() parameter becomes const, as it should be in the first place!
* bpo-36908: 'This module is always available' isn't helpful. (#13297)Ned Batchelder2019-05-172-4/+4
| | | | Makes the documentation of math and cmath module more helpful for the beginners.
* bpo-36763: Remove _PyCoreConfig.program (GH-13373)Victor Stinner2019-05-171-2/+2
| | | Use _PyCoreConfig.program_name instead.
* bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)Zackery Spytz2019-05-174-8/+16
| | | | | | | The final addition (cur += step) may overflow, so use size_t for "cur". "cur" is always positive (even for negative steps), so it is safe to use size_t here. Co-Authored-By: Martin Panter <vadmium+py@gmail.com>
* bpo-36763: Add _Py_InitializeMain() (GH-13362)Victor Stinner2019-05-161-3/+3
| | | | | | | | | * Add a private _Py_InitializeMain() function. * Add again _PyCoreConfig._init_main. * _Py_InitializeFromConfig() now uses _init_main to decide if _Py_InitializeMainInterpreter() should be called. * _PyCoreConfig: rename _frozen to pathconfig_warnings, its value is now the opposite of Py_FrozenFlag. * Add an unit test for _init_main=0 and _Py_InitializeMain().
* bpo-36763: Add _PyCoreConfig.parse_argv (GH-13361)Victor Stinner2019-05-161-1/+1
| | | | | | | * _PyCoreConfig_Read() doesn't parse nor update argv if parse_argv is 0. * Move path configuration fields in _PyCoreConfig. * Add an unit test for parse_argv=0. * Remove unused "done": label in _Py_RunMain().
* bpo-36763: _PyInitError always use int for exitcode (GH-13360)Victor Stinner2019-05-161-26/+22
| | | | | | | | | | | | | | | | | We cannot use "unsigned int" for exitcode on Windows, since Py_Main() and _Py_RunMain() always return an "int". Changes: * _PyPathConfig_ComputeSysPath0() now returns -1 if an exception is raised. * pymain_run_python() no longer uses _PyInitError but display the exception and set exitcode to 1 in case of error. * Fix _Py_RunMain(): return an exitcode rather than calling exit() on pymain_run_python() failure. * _Py_ExitInitError() no longer uses ExitProcess() on Windows, use exit() on all platforms. * _Py_ExitInitError() now fails with a fatal error if 'err' is not an error not an exit.
* bpo-36748: optimize TextIOWrapper.write() for ASCII string (GH-13002)Inada Naoki2019-05-161-21/+95
|
* bpo-35926: Add support for OpenSSL 1.1.1b on Windows (GH-11779)Paul Monson2019-05-151-1/+1
|
* bpo-36900: Replace global conf vars with config (GH-13299)Victor Stinner2019-05-142-6/+8
| | | | | | Replace global configuration variables with core_config read from the current interpreter. Cleanup dynload_hpux.c.
* Change WriterObj.writeline to WriterObj.write (GH-12344)Rémi Lapeyre2019-05-141-10/+12
| | | This cleans the csv module a bit, I don't think it requires a bpo issue or a news entry.
* bpo-36728: Remove PyEval_ReInitThreads() from C API (GH-13241)Victor Stinner2019-05-131-4/+15
| | | | | | | | Remove the PyEval_ReInitThreads() function from the Python C API. It should not be called explicitly: use PyOS_AfterFork_Child() instead. Rename PyEval_ReInitThreads() to _PyEval_ReInitThreads() and add a 'runtime' parameter.
* bpo-36895: remove time.clock() as per removal notice. (GH-13270)Matthias Bussonnier2019-05-131-50/+0
| | | | `time.clock()` was deprecated in 3.3, and marked for removal removal in 3.8; this thus remove it from the time module.
* bpo-36084: Add native thread ID to threading.Thread objects (GH-11993)Jake Tesler2019-05-121-0/+16
|
* bpo-36856: Handle possible overflow in faulthandler_stack_overflow (GH-13205)Xi Ruoyao2019-05-111-4/+17
|
* bpo-36710: Add 'ceval' local variable to ceval.c (GH-12934)Victor Stinner2019-05-101-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Add "struct _ceval_runtime_state *ceval = &_PyRuntime.ceval;" local variables to function to better highlight the dependency on the global variable _PyRuntime and to point directly to _PyRuntime.ceval field rather than on the larger _PyRuntime. Changes: * Add _PyRuntimeState_GetThreadState(runtime) macro. * Add _PyEval_AddPendingCall(ceval, ...) and _PyThreadState_Swap(gilstate, ...) functions. * _PyThreadState_GET() macro now calls _PyRuntimeState_GetThreadState() using &_PyRuntime. * Add 'ceval' parameter to COMPUTE_EVAL_BREAKER(), SIGNAL_PENDING_SIGNALS(), _PyEval_SignalAsyncExc(), _PyEval_SignalReceived() and _PyEval_FiniThreads() macros and functions. * Add 'tstate' parameter to call_function(), do_call_core() and do_raise(). * Add 'runtime' parameter to _Py_CURRENTLY_FINALIZING(), _Py_FinishPendingCalls() and _PyThreadState_DeleteExcept() macros and functions. * Declare 'runtime', 'tstate', 'ceval' and 'eval_breaker' variables as constant.
* bpo-35983: skip trashcan for subclasses (GH-11841)Jeroen Demeyer2019-05-102-2/+78
| | | | | Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism. Patch by Jeroen Demeyer.
* bpo-36814: ensure os.posix_spawn() handles None (GH-13144)Anthony Shaw2019-05-101-1/+1
| | | | Fix an issue where os.posix_spawn() would incorrectly raise a TypeError when file_actions is None.
* bpo-36601: clarify signal handler comment and remove unnecessary pid check. ↵Jeroen Demeyer2019-05-101-15/+10
| | | | | (GH-12784) https://bugs.python.org/issue36601
* bpo-30262: Don't expose private objects in sqlite3 (GH-1440)Aviv Palivoda2019-05-091-4/+0
| | | | | | The Cache and Statement objects are undocumented and implementation details of the sqlite3 module. They aren't usable from pure Python code.
* closes bpo-36861: Update Unicode database to 12.1.0. (GH-13214)Benjamin Peterson2019-05-092-15365/+15369
| | | Adds ㋿.
* bpo-35900: Enable custom reduction callback registration in _pickle (GH-12499)Pierre Glaser2019-05-081-2/+42
| | | | Enable custom reduction callback registration for functions and classes in _pickle.c, using the new Pickler's attribute ``reducer_override``.
* bpo-35900: Add a state_setter arg to save_reduce (GH-12588)Pierre Glaser2019-05-081-8/+40
| | | | | Allow reduction methods to return a 6-item tuple where the 6th item specifies a custom state-setting method that's called instead of the regular ``__setstate__`` method.
* bpo-36793: Remove unneeded __str__ definitions. (GH-13081)Serhiy Storchaka2019-05-062-3/+3
| | | | Classes that define __str__ the same as __repr__ can just inherit it from object.
* bpo-36594: Fix incorrect use of %p in format strings (GH-12769)Zackery Spytz2019-05-064-8/+8
| | | In addition, fix some other minor violations of C99.
* bpo-36811: Fix a C compiler warning in _elementtree.c. (GH-13109)Stefan Behnel2019-05-061-1/+1
|
* Suppress clang warning (GH-12384)Rémi Lapeyre2019-05-031-1/+2
|
* bpo-28238: Implement "{*}tag" and "{ns}*" wildcard tag selection support for ↵Stefan Behnel2019-05-031-1/+14
| | | | ElementPath, and extend the surrounding tests and docs. (GH-12997)
* bpo-36763: _PyCoreConfig_SetPyArgv() preinitializes Python (GH-13037)Victor Stinner2019-05-021-8/+1
| | | | | | | | _PyCoreConfig_SetPyArgv() and _PyCoreConfig_SetWideString() now pre-initialize Python if needed to ensure that the locale encoding is properly configured. * Add _Py_PreInitializeFromPyArgv() internal function. * Add 'args' parameter to _Py_PreInitializeFromCoreConfig()
* bpo-36676: Namespace prefix aware parsing support for the ET.XMLParser ↵Stefan Behnel2019-05-011-19/+121
| | | | | target (GH-12885) * bpo-36676: Implement namespace prefix aware parsing support for the XMLParser target in ElementTree.
* bpo-36673: Implement comment/PI parsing support for the TreeBuilder in ↵Stefan Behnel2019-05-012-35/+424
| | | | | | | | ElementTree. (#12883) * bpo-36673: Implement comment/PI parsing support for the TreeBuilder in ElementTree. * bpo-36673: Rewrite the comment/PI factory handling for the TreeBuilder in "_elementtree" to make it use the same factories as the ElementTree module, and to make it explicit when the comments/PIs are inserted into the tree and when they are not (which is the default).