summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-36763: _PyInitError always use int for exitcode (GH-13360)Victor Stinner2019-05-162-14/+15
| | | | | | | | | | | | | | | | | 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-36900: Replace global conf vars with config (GH-13299)Victor Stinner2019-05-144-24/+28
| | | | | | Replace global configuration variables with core_config read from the current interpreter. Cleanup dynload_hpux.c.
* bpo-36900: import.c uses PyInterpreterState.core_config (GH-13278)Victor Stinner2019-05-132-27/+46
| | | | Move _PyImportZip_Init() to the internal C API and add an 'interp' parameter.
* bpo-36728: Remove PyEval_ReInitThreads() from C API (GH-13241)Victor Stinner2019-05-131-2/+1
| | | | | | | | 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-36084: Add native thread ID to threading.Thread objects (GH-11993)Jake Tesler2019-05-122-0/+43
|
* bpo-36817: Do not decrement reference for expr_text on fstring = parsing ↵Pablo Galindo2019-05-121-1/+0
| | | | failure (GH-13256)
* bpo-36817: Fix reference leak for expr_text in f-string = parsing (GH-13249)Pablo Galindo2019-05-111-2/+7
|
* bpo-36710: Add 'ceval' local variable to ceval.c (GH-12934)Victor Stinner2019-05-104-260/+292
| | | | | | | | | | | | | | | | | | | | | | | | | 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-36737: Use the module state C-API for warnings. (gh-13159)Eric Snow2019-05-103-120/+203
|
* bpo-35983: skip trashcan for subclasses (GH-11841)Jeroen Demeyer2019-05-102-8/+8
| | | | | 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-36851: Clean the frame stack if the execution ends with a return and the ↵Pablo Galindo2019-05-091-7/+9
| | | | stack is not empty (GH-13191)
* bpo-36817: Add f-string debugging using '='. (GH-13123)Eric V. Smith2019-05-085-45/+142
| | | If a "=" is specified a the end of an f-string expression, the f-string will evaluate to the text of the expression, followed by '=', followed by the repr of the value of the expression.
* bpo-24048: Save the live exception during import.c's remove_module() (GH-13005)Zackery Spytz2019-05-081-3/+7
| | | Save the live exception during the course of remove_module().
* bpo-36594: Fix incorrect use of %p in format strings (GH-12769)Zackery Spytz2019-05-062-6/+6
| | | In addition, fix some other minor violations of C99.
* bpo-36791: Safer detection of integer overflow in sum(). (GH-13080)Serhiy Storchaka2019-05-051-3/+5
|
* bpo-36475: Make PyThread_exit_thread with _Py_NO_RETURN (GH-13068)Victor Stinner2019-05-043-3/+2
|
* bpo-36763: Remove _PyCoreConfig._init_main (GH-13066)Victor Stinner2019-05-022-3/+1
|
* bpo-36763: _PyCoreConfig_SetPyArgv() preinitializes Python (GH-13037)Victor Stinner2019-05-022-17/+42
| | | | | | | | _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-36775: _PyCoreConfig only uses wchar_t* (GH-13062)Victor Stinner2019-05-024-133/+93
| | | | | | | | | | | | | | | | | _PyCoreConfig: Change filesystem_encoding, filesystem_errors, stdio_encoding and stdio_errors fields type from char* to wchar_t*. Changes: * PyInterpreterState: replace fscodec_initialized (int) with fs_codec structure. * Add get_error_handler_wide() and unicode_encode_utf8() helper functions. * Add error_handler parameter to unicode_encode_locale() and unicode_decode_locale(). * Remove _PyCoreConfig_SetString(). * Rename _PyCoreConfig_SetWideString() to _PyCoreConfig_SetString(). * Rename _PyCoreConfig_SetWideStringFromString() to _PyCoreConfig_DecodeLocale().
* bpo-36775: Add _PyUnicode_InitEncodings() (GH-13057)Victor Stinner2019-05-021-90/+15
| | | | | | Move get_codec_name() and initfsencoding() from pylifecycle.c to unicodeobject.c. Rename also "init" functions in pylifecycle.c.
* bpo-36775: Add _Py_FORCE_UTF8_FS_ENCODING macro (GH-13056)Victor Stinner2019-05-023-55/+36
| | | | | | | Add _Py_FORCE_UTF8_LOCALE and _Py_FORCE_UTF8_FS_ENCODING macros to avoid factorize "#if defined(__ANDROID__) || defined(__VXWORKS__)" and "#if defined(__APPLE__)". Cleanup also config_init_fs_encoding().
* bpo-36763: Make _PyCoreConfig.check_hash_pycs_mode public (GH-13052)Victor Stinner2019-05-022-10/+22
| | | | | _PyCoreConfig: Rename _check_hash_pycs_mode field to check_hash_pycs_mode (make it public) and change its type from "const char*" to "wchar_t*".
* bpo-36763: Add _PyCoreConfig_SetString() (GH-13035)Victor Stinner2019-05-012-166/+241
| | | | | | | | | | | | Add 3 new config methods: * _PyCoreConfig_SetString() * _PyCoreConfig_SetWideString() * _PyCoreConfig_SetWideStringFromString() Changes: * _PyCoreConfig_Copy() returns _PyInitError. * Add CONFIG_GET_ENV_DUP().
* bpo-36763: Rework _PyInitError API (GH-13031)Victor Stinner2019-05-015-27/+26
| | | | | | | | | * Remove _PyInitError.user_err field and _Py_INIT_USER_ERR() macro: use _Py_INIT_ERR() instead. _Py_ExitInitError() now longer calls abort() on error: exit with exit code 1 instead. * Add _PyInitError._type private field. * exitcode field type is now unsigned int on Windows. * Rename prefix field to _func. * Rename msg field to err_msg.
* bpo-36763: Add _PyCoreConfig_SetArgv() (GH-13030)Victor Stinner2019-05-013-13/+45
| | | | | | | | | * Add 2 new config methods: * _PyCoreConfig_SetArgv() * _PyCoreConfig_SetWideArgv() * Add also an internal _PyCoreConfig_SetPyArgv() method. * Remove 'args' parameter from _PyCoreConfig_Read().
* bpo-36763: Fix Py_SetStandardStreamEncoding() (GH-13028)Victor Stinner2019-04-301-3/+4
| | | | Fix memory leak in Py_SetStandardStreamEncoding(): release memory if the function is called twice.
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-2911-4548/+5023
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* Revert "bpo-36356: Destroy the GIL at exit (GH-12453)" (GH613006)Victor Stinner2019-04-292-17/+10
| | | This reverts commit b36e5d627d4232a01850707eb78a5067f3fd77f4.
* bpo-36356: Destroy the GIL at exit (GH-12453)Victor Stinner2019-04-292-10/+17
| | | | | | * Add _PyEval_FiniThreads2(). _PyEval_FiniThreads() now only clears the pending lock, whereas _PyEval_FiniThreads2() destroys the GIL. * pymain_free() now calls _PyEval_FiniThreads2(). * Py_FinalizeEx() now calls _PyEval_FiniThreads().
* bpo-36475: Finalize PyEval_AcquireLock() and PyEval_AcquireThread() properly ↵Joannah Nanjekye2019-04-291-12/+16
| | | | | | | | (GH-12667) PyEval_AcquireLock() and PyEval_AcquireThread() now terminate the current thread if called while the interpreter is finalizing, making them consistent with PyEval_RestoreThread(), Py_END_ALLOW_THREADS, and PyGILState_Ensure().
* Fix typo in 'tandem' word (GH-12998) (GH-12998)Andrey2019-04-291-1/+1
|
* bpo-36356: pymain_exit_error() only call pymain_free() for exit (GH-12968)Victor Stinner2019-04-261-1/+1
| | | Add _Py_INIT_HAS_EXITCODE() macro.
* bpo-36724: Add _PyWarnings_Fini() (#12963)Victor Stinner2019-04-262-17/+34
| | | | | | | | | | Py_FinalizeEx() now clears _PyRuntime.warnings variables and _PyRuntime.exitfuncs. Changes: * Add _PyWarnings_Fini(): called by Py_FinalizeEx() * call_ll_exitfuncs() now clears _PyRuntime.exitfuncs while iterating on it (on backward order).
* bpo-36710: Fix compiler warning on PyThreadState_Delete() (GH-12962)Victor Stinner2019-04-261-1/+1
| | | _PyThreadState_Delete() has no return value.
* bpo-36710: Add runtime parameter in gcmodule.c (GH-12958)Victor Stinner2019-04-261-1/+1
| | | | Add 'state' or 'runtime' parameter to functions in gcmodule.c to avoid to rely directly on the global variable _PyRuntime.
* bpo-36710: Add runtime variable in pystate.c (GH-12956)Victor Stinner2019-04-251-142/+219
| | | | Add 'gilstate', 'runtime' or 'xidregistry' parameter to many functions on pystate.c to avoid lying on _PyRuntime global.
* bpo-36722: Debug build loads libraries built in release mode (GH-12952)Victor Stinner2019-04-251-2/+3
| | | | In debug build, import now also looks for C extensions compiled in release mode and for C extensions compiled in the stable ABI.
* bpo-36710: Add runtime variable to Py_InitializeEx() (GH-12939)Victor Stinner2019-04-244-68/+92
| | | | | | | | Py_InitializeEx() now uses a runtime variable passed to subfunctions, rather than working directly on the global variable _PyRuntime. Add 'runtime' parameter to _PyCoreConfig_Write(), _PySys_Create(), _PySys_InitMain(), _PyGILState_Init(), emit_stderr_warning_for_legacy_locale() and other subfunctions.
* bpo-36710: Add runtime variable to Py_FinalizeEx() (GH-12937)Victor Stinner2019-04-242-20/+22
| | | | | | * Add a 'runtime' variable to Py_FinalizeEx() rather than working directly on the global variable _PyRuntime * Add a 'runtime' parameter to _PyGC_Fini(), _PyGILState_Fini() and call_ll_exitfuncs()
* bpo-36710: PyOS_AfterFork_Child() pass runtime parameter (GH-12936)Victor Stinner2019-04-241-33/+32
| | | | | | | | | The PyOS_AfterFork_Child() function now pass a 'runtime' parameter to subfunctions. * Fix _PyRuntimeState_ReInitThreads(): use the correct memory allocator * Add runtime parameter to _PyRuntimeState_ReInitThreads(), _PyGILState_Reinit() and _PyInterpreterState_DeleteExceptMain() * Move _PyGILState_Reinit() to the internal C API.
* bpo-36710: Add runtime parameter to _PyThreadState_Init() (GH-12935)Victor Stinner2019-04-241-64/+74
| | | | | | * Add 'runtime' parameter to _PyThreadState_Init() * Add 'gilstate' parameter to _PyGILState_NoteThreadState() * Move _PyThreadState_Init() and _PyThreadState_DeleteExcept() to the internal C API.
* use `const` in graminit.c (GH-12713)tyomitch2019-04-231-410/+410
|
* bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853)Victor Stinner2019-04-171-0/+4
| | | | | | | | | | | | | | | | | | | | Change PyAPI_FUNC(type), PyAPI_DATA(type) and PyMODINIT_FUNC macros of pyport.h when Py_BUILD_CORE_MODULE is defined. The Py_BUILD_CORE_MODULE define must be now be used to build a C extension as a dynamic library accessing Python internals: export the PyInit_xxx() function in DLL exports on Windows. Changes: * Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE now imply Py_BUILD_CORE directy in pyport.h. * ceval.c compilation now fails with an error if Py_BUILD_CORE is not defined, just to ensure that Python is build with the correct defines. * setup.py now compiles _pickle.c with Py_BUILD_CORE_MODULE define. * setup.py compiles _json.c with Py_BUILD_CORE_MODULE define, rather than Py_BUILD_CORE_BUILTIN define * PCbuild/pythoncore.vcxproj: Add Py_BUILD_CORE_BUILTIN define.
* bpo-32849: Fix is_valid_fd() on FreeBSD (GH-12852)Victor Stinner2019-04-171-15/+23
| | | | | | | Fix Python Initialization code on FreeBSD to detect properly when stdin file descriptor (fd 0) is invalid. On FreeBSD, fstat() must be used to check if stdin (fd 0) is valid. dup(0) doesn't fail if stdin is invalid in some cases.
* bpo-36623: Clean parser headers and include files (GH-12253)Pablo Galindo2019-04-132-3/+0
| | | After the removal of pgen, multiple header and function prototypes that lack implementation or are unused are still lying around.
* bpo-33608: Revert "Factor out a private, per-interpreter ↵Eric Snow2019-04-124-118/+97
| | | | | _Py_AddPendingCall()." (gh-12806) This reverts commit f13c5c8b9401a9dc19e95d8b420ee100ac022208 (gh-12360).
* bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). ↵Eric Snow2019-04-124-97/+118
| | | | | (gh-12360) This is effectively an un-revert of #11617 and #12024 (reverted in #12159). Portions of those were merged in other PRs (with lower risk) and this represents the remainder. Note that I found 3 different bugs in the original PRs and have fixed them here.
* Fix typos in compile.c comments (GH-12752)Simeon2019-04-091-2/+2
|
* bpo-34373: Fix time.mktime() on AIX (GH-12726)Victor Stinner2019-04-091-10/+7
| | | | | | | | | | | | | | | Fix time.mktime() error handling on AIX for year before 1970. Other changes: * mktime(): rename variable 'buf' to 'tm'. * _PyTime_localtime(): * Use "localtime" rather than "ctime" in the error message (specific to AIX). * Always initialize errno to 0 just in case if localtime_r() doesn't set errno on error. * On AIX, avoid abs() which is limited to int type. * EINVAL constant is now always available.
* bpo-36301: Fix _PyPreConfig_Read() compiler warning (GH-12695)Victor Stinner2019-04-051-4/+5
| | | Initialize init_utf8_mode earlier to fix a compiler warning.