summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-38858: Fix reference leak in pycore_init_types() (GH-17286)Victor Stinner2019-11-201-20/+26
| | | | Only call _PyGC_Init(), _PyExc_Init() and _PyErr_Init() in new_interpreter().
* bpo-36854: gcmodule.c gets its state from tstate (GH-17285)Victor Stinner2019-11-201-1/+1
| | | | | | | | | * Add GCState type for readability * gcmodule.c now gets its gcstate from tstate * _PyGC_DumpShutdownStats() now expects tstate rather than runtime * Rename "state" to "gcstate" for readability: to avoid confusion between "state" and "tstate" for example. * collect() now only expects tstate: it gets gcstate from tstate. * Pass tstate to _PyErr_xxx() functions
* bpo-36854: Clear the current thread later (GH-17279)Victor Stinner2019-11-202-27/+35
| | | | | | | | | | Clear the current thread later in the Python finalization. * The PyInterpreterState_Delete() function is now responsible to call PyThreadState_Swap(NULL). * The tstate_delete_common() function is now responsible to clear the "autoTSSKey" thread local storage and it only clears it once the thread state is fully cleared. It allows to still get the current thread from TSS in tstate_delete_common().
* bpo-38858: Factorize Py_EndInterpreter() code (GH-17273)Victor Stinner2019-11-202-54/+78
| | | | | | * Factorize code in common between Py_FinalizeEx() and Py_EndInterpreter(). * Py_EndInterpreter() now also calls _PyWarnings_Fini(). * Call _PyExc_Fini() and _PyGC_Fini() later in the finalization.
* bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)Victor Stinner2019-11-202-6/+0
| | | | | The PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros are empty: they have been doing nothing for the last year (since commit 735ae8d139a673b30b321dc10acfd3d14f0d633b), so stop using them.
* bpo-36710: Add PyInterpreterState.runtime field (GH-17270)Victor Stinner2019-11-204-82/+70
| | | | | | | | | | | Add PyInterpreterState.runtime field: reference to the _PyRuntime global variable. This field exists to not have to pass runtime in addition to tstate to a function. Get runtime from tstate: tstate->interp->runtime. Remove "_PyRuntimeState *runtime" parameter from functions already taking a "PyThreadState *tstate" parameter. _PyGC_Init() first parameter becomes "PyThreadState *tstate".
* bpo-38823: Fix refleak in marshal init error path (GH-17260)Brandt Bucher2019-11-201-1/+4
|
* bpo-38631: Avoid Py_FatalError() in handle_legacy_finalizers() (GH-17266)Victor Stinner2019-11-202-5/+12
| | | | | * Rename _PyGC_Initialize() to _PyGC_InitializeRuntime() * Add _PyGC_Init(): initialize _PyRuntime.gc.garbage list * Call _PyGC_Init() before _PyTypes_Init()
* bpo-38858: Reorganize pycore_init_types() (GH-17265)Victor Stinner2019-11-191-20/+11
| | | | * Call _PyLong_Init() and _PyExc_Init() earlier * new_interpreter() reuses pycore_init_types()
* bpo-38644: Add _PyEval_EvalCode() (GH-17183)Victor Stinner2019-11-161-4/+24
| | | _PyFunction_Vectorcall() now pass tstate to function calls.
* bpo-38644: Add _PyObject_Call() (GH-17089)Victor Stinner2019-11-143-15/+19
| | | | | | | | | | * Add pycore_call.h internal header file. * Add _PyObject_Call(): PyObject_Call() with tstate * Add _PyObject_CallNoArgTstate(): _PyObject_CallNoArg() with tstate * Add _PyObject_FastCallDictTstate(): _PyObject_FastCallDict() with tstate * _PyObject_Call_Prepend() now takes tstate * Replace _PyObject_FastCall() calls with _PyObject_VectorcallTstate() calls
* bpo-38644: Add _PyEval_EvalFrame() with tstate (GH-17131)Victor Stinner2019-11-141-5/+7
| | | | Add _PyEval_EvalFrame() static inline function to get eval_frame from tstate->interp.
* bpo-38644: Add _PyObject_VectorcallTstate() (GH-17052)Victor Stinner2019-11-081-17/+31
| | | | | * Add _PyObject_VectorcallTstate() function: similar to _PyObject_Vectorcall(), but with tstate parameter * Add tstate parameter to _PyObject_MakeTpCall()
* bpo-38733: PyErr_Occurred() caller must hold the GIL (GH-17080)Victor Stinner2019-11-071-0/+3
| | | | | | | | | | | bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate == NULL" test. Py_FatalError() no longer calls PyErr_Occurred() if called without holding the GIL. So PyErr_Occurred() no longer has to support tstate==NULL case. _Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid explicit "!= NULL" test.
* bpo-37645: add new function _PyObject_FunctionStr() (GH-14890)Jeroen Demeyer2019-11-051-19/+30
| | | | | | | | | | | | Additional note: the `method_check_args` function in `Objects/descrobject.c` is written in such a way that it applies to all kinds of descriptors. In particular, a future re-implementation of `wrapper_descriptor` could use that code. CC @vstinner @encukou https://bugs.python.org/issue37645 Automerge-Triggered-By: @encukou
* closes bpo-37633: Reëxport some function compatibility wrappers for macros ↵Benjamin Peterson2019-11-051-16/+16
| | | | in ``pythonrun.h``. (GH-17056)
* bpo-38644: Pass tstate to _Py_CheckFunctionResult() (GH-17050)Victor Stinner2019-11-052-1/+16
| | | | | * Add tstate parameter to _Py_CheckFunctionResult() * Add _PyErr_FormatFromCauseTstate() * Replace PyErr_XXX(...) with _PyErr_XXX(state, ...)
* bpo-38644: Pass tstate to Py_EnterRecursiveCall() (GH-16997)Victor Stinner2019-11-041-7/+7
| | | | | | | | | | | | | * Add _Py_EnterRecursiveCall() and _Py_LeaveRecursiveCall() which require a tstate argument. * Pass tstate to _Py_MakeRecCheck() and _Py_CheckRecursiveCall(). * Convert Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() macros to static inline functions. _PyThreadState_GET() is the most efficient way to get the tstate, and so using it with _Py_EnterRecursiveCall() and _Py_LeaveRecursiveCall() should be a little bit more efficient than using Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() which use the "slower" PyThreadState_GET().
* bpo-38644: Add Py_EnterRecursiveCall() to the limited API (GH-17046)Victor Stinner2019-11-041-0/+18
| | | | | | | | | | Provide Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() as regular functions for the limited API. Previously, there were defined as macros, but these macros didn't work with the limited API which cannot access PyThreadState.recursion_depth field. Remove _Py_CheckRecursionLimit from the stable ABI. Add Include/cpython/ceval.h header file.
* closes bpo-38648: Remove double tp_free slot in Python-ast.c. (GH-17002)Max Bernstein2019-10-311-1/+0
| | | This looks like a typo due to copy-paste.
* bpo-38640: Allow break and continue in always false while loops (GH-16992)Pablo Galindo2019-10-301-0/+8
|
* bpo-38535: Fix positions for AST nodes for calls without arguments in ↵Serhiy Storchaka2019-10-261-2/+4
| | | | decorators. (GH-16861)
* Fix typo in formatter_unicode (GH-16831)Hansraj Das2019-10-251-1/+1
| | | numbers's -> number's
* bpo-38540: Fix possible leak in PyArg_Parse for "es#" and "et#". (GH-16869)Serhiy Storchaka2019-10-211-2/+26
|
* Typo fix - implemention should be implementation (GH-16806)Hansraj Das2019-10-151-1/+1
|
* bpo-11410: Standardize and use symbol visibility attributes across POSIX and ↵Vinay Sajip2019-10-153-15/+16
| | | | Windows. (GH-16347)
* bpo-38469: Handle named expression scope with global/nonlocal keywords ↵Pablo Galindo2019-10-141-3/+9
| | | | | (GH-16755) The symbol table handing of PEP572's assignment expressions is not resolving correctly the scope of some variables in presence of global/nonlocal keywords in conjunction with comprehensions.
* Correct signature of __build_class__ (GH-16735)Pablo Galindo2019-10-131-1/+1
|
* Typo fix: "throuhgh" should be "through". (GH-16704)Hansraj Das2019-10-111-1/+1
|
* bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)Dong-hee Na2019-10-101-1/+2
|
* Typo fix: "empy" should be "empty". (GH-16666)Hansraj Das2019-10-091-1/+1
|
* Fix typo in _warnings.warn_explicit() docstring (GH-16625)Hansraj Das2019-10-081-1/+1
|
* bpo-38353: getpath.c: allocates strings on the heap (GH-16585)Victor Stinner2019-10-041-9/+20
| | | | | | | | | | | * _Py_FindEnvConfigValue() now returns a string allocated by PyMem_RawMalloc(). * calculate_init() now decodes VPATH macro. * Add calculate_open_pyenv() function. * Add substring() and joinpath2() functions. * Fix add_exe_suffix() And a few cleanup changes.
* bpo-38266: Revert bpo-37878: Make PyThreadState_DeleteCurrent() Internal ↵Joannah Nanjekye2019-10-041-2/+8
| | | | | (GH-16558) Revert the removal of PyThreadState_DeleteCurrent() with documentation.
* bpo-38353: Add subfunctions to getpath.c (GH-16572)Victor Stinner2019-10-041-4/+6
| | | | | | | | | | | | | | Following symbolic links is now limited to 40 attempts, just to prevent loops. Add subfunctions: * Add resolve_symlinks() * Add calculate_argv0_path_framework() * Add calculate_which() * Add calculate_program_macos() Fix also _Py_wreadlink(): readlink() result type is Py_ssize_t, not int.
* bpo-38353: Cleanup includes in the internal C API (GH-16548)Victor Stinner2019-10-021-0/+1
| | | | Use forward declaration of types to avoid includes in the internal C API. Add also comment to justify other includes.
* bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)Victor Stinner2019-10-015-54/+13
| | | | PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no longer return PyStatus: they cannot fail anymore.
* bpo-38304: Remove PyConfig.struct_size (GH-16500) (GH-16508)Victor Stinner2019-10-016-114/+12
| | | | | | | For now, we'll rely on the fact that the config structures aren't covered by the stable ABI. We may revisit this in the future if we further explore the idea of offering a stable embedding API. (cherry picked from commit bdace21b769998396d0ccc8da99a8ca9b507bfdf)
* bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)Victor Stinner2019-09-293-45/+85
| | | | | | | | | Fix warnings options priority: PyConfig.warnoptions has the highest priority, as stated in the PEP 587. * Document options order in PyConfig.warnoptions documentation. * Make PyWideStringList_INIT macro private: replace "Py" prefix with "_Py". * test_embed: add test_init_warnoptions().
* bpo-38310: Predict BUILD_MAP_UNPACK_WITH_CALL -> CALL_FUNCTION_EX. (GH-16467)Brandt Bucher2019-09-291-0/+2
|
* bpo-38304: Add PyConfig.struct_size (GH-16451)Victor Stinner2019-09-286-28/+175
| | | | | | | | | | | | | | | | | Add a new struct_size field to PyPreConfig and PyConfig structures to allow to modify these structures in the future without breaking the backward compatibility. * Replace private _config_version field with public struct_size field in PyPreConfig and PyConfig. * Public PyPreConfig_InitIsolatedConfig() and PyPreConfig_InitPythonConfig() return type becomes PyStatus, instead of void. * Internal _PyConfig_InitCompatConfig(), _PyPreConfig_InitCompatConfig(), _PyPreConfig_InitFromConfig(), _PyPreConfig_InitFromPreConfig() return type becomes PyStatus, instead of void. * Remove _Py_CONFIG_VERSION * Update the Initialization Configuration documentation.
* bpo-38234: Py_Initialize() sets global path configuration (GH-16421)Victor Stinner2019-09-262-9/+24
| | | | | | * Py_InitializeFromConfig() now writes PyConfig path configuration to the global path configuration (_Py_path_config). * Add test_embed.test_get_pathconfig(). * Fix typo in _PyWideStringList_Join().
* bpo-38234: Add test_init_setpath_config() to test_embed (GH-16402)Victor Stinner2019-09-261-5/+28
| | | | | | | | | | | | * Add test_embed.test_init_setpath_config(): test Py_SetPath() with PyConfig. * test_init_setpath() and test_init_setpythonhome() no longer call Py_SetProgramName(), but use the default program name. * _PyPathConfig: isolated, site_import and base_executable fields are now only available on Windows. * If executable is set explicitly in the configuration, ignore calculated base_executable: _PyConfig_InitPathConfig() copies executable to base_executable. * Complete path config documentation.
* bpo-38234: Py_SetPath() uses the program full path (GH-16357)Victor Stinner2019-09-241-4/+7
| | | | | | | Py_SetPath() now sets sys.executable to the program full path (Py_GetProgramFullPath()), rather than to the program name (Py_GetProgramName()). Fix also memory leaks in pathconfig_set_from_config().
* bpo-38234: Fix _PyConfig_InitPathConfig() (GH-16335)Victor Stinner2019-09-231-149/+166
| | | | | | | | | | | | | | | | * _PyConfig_InitPathConfig() now starts by copying the global path configuration, and then override values set in PyConfig. * _PyPathConfig_Calculate() implementations no longer override _PyPathConfig fields which are already computed. For example, if _PyPathConfig.prefix is not NULL, leave it unchanged. * If Py_SetPath() has been called, _PyConfig_InitPathConfig() doesn't call _PyPathConfig_Calculate() anymore. * _PyPathConfig_Calculate() no longer uses PyConfig, except to initialize PyCalculatePath structure. * pathconfig_calculate(): remove useless temporary "_PyPathConfig new_config" variable. * calculate_module_search_path(): remove hack to workaround memory allocation failure, call Py_FatalError() instead. * Fix get_program_full_path(): handle memory allocation failure.
* bpo-38236: Fix init_dump_ascii_wstr() (GH-16333)Victor Stinner2019-09-231-0/+1
| | | Add missing "return;" (to not dereference NULL pointer).
* bpo-38236: Dump path config at first import error (GH-16300)Victor Stinner2019-09-231-2/+97
| | | | Python now dumps path configuration if it fails to import the Python codecs of the filesystem and stdio encodings.
* Shorter docstring (GH-16322)Raymond Hettinger2019-09-212-4/+4
|
* bpo-38237: Make pow's arguments have more descriptive names and be keyword ↵Ammar Askar2019-09-212-26/+32
| | | | | | | | | | | | passable (GH-16302) Edit: `math.pow` changes removed on Mark's request. https://bugs.python.org/issue38237 Automerge-Triggered-By: @rhettinger
* bpo-38234: Fix PyConfig_Read() when Py_SetPath() was called (GH-16298)Victor Stinner2019-09-201-0/+7
| | | | | | * If Py_SetPath() has been called, _PyConfig_InitPathConfig() now uses its value. * Py_Initialize() now longer copies path configuration from PyConfig to the global path configuration (_Py_path_config).