summaryrefslogtreecommitdiff
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* closes bpo-39898: Remove unused arg from append_formattedvalue. (GH-18840)Andy Lester2020-03-081-4/+4
|
* bpo-39877: Fix PyEval_RestoreThread() for daemon threads (GH-18811)Victor Stinner2020-03-083-26/+69
| | | | | | | | | | | | | | | | | | | | * exit_thread_if_finalizing() does now access directly _PyRuntime variable, rather than using tstate->interp->runtime since tstate can be a dangling pointer after Py_Finalize() has been called. * exit_thread_if_finalizing() is now called *before* calling take_gil(). _PyRuntime.finalizing is an atomic variable, we don't need to hold the GIL to access it. * Add ensure_tstate_not_null() function to check that tstate is not NULL at runtime. Check tstate earlier. take_gil() does not longer check if tstate is NULL. Cleanup: * PyEval_RestoreThread() no longer saves/restores errno: it's already done inside take_gil(). * PyEval_AcquireLock(), PyEval_AcquireThread(), PyEval_RestoreThread() and _PyEval_EvalFrameDefault() now check if tstate is valid with the new is_tstate_valid() function which uses _PyMem_IsPtrFreed().
* bpo-39890: Don't mutate the AST when compiling starred assignments (GH-18833)Brandt Bucher2020-03-081-2/+4
|
* closes bpo-39886: Remove unused arg from config_get_stdio_errors. (GH-18823)Andy Lester2020-03-071-2/+2
|
* closes bpo-39878: Remove unused arguments from static functions. (GH-18822)Andy Lester2020-03-071-10/+10
| | | | | calc_number_widths -> PyObject *number fill_number -> Py_ssize_t d_end
* bpo-39882: Py_FatalError() logs the function name (GH-18819)Victor Stinner2020-03-075-37/+44
| | | | | | | | | | | | The Py_FatalError() function is replaced with a macro which logs automatically the name of the current function, unless the Py_LIMITED_API macro is defined. Changes: * Add _Py_FatalErrorFunc() function. * Remove the function name from the message of Py_FatalError() calls which included the function name. * Update tests.
* bpo-39877: _PyRuntimeState.finalizing becomes atomic (GH-18816)Victor Stinner2020-03-074-9/+12
| | | | | | | | | | | | Convert _PyRuntimeState.finalizing field to an atomic variable: * Rename it to _finalizing * Change its type to _Py_atomic_address * Add _PyRuntimeState_GetFinalizing() and _PyRuntimeState_SetFinalizing() functions * Remove _Py_CURRENTLY_FINALIZING() function: replace it with testing directly _PyRuntimeState_GetFinalizing() value Convert _PyRuntimeState_GetThreadState() to static inline function.
* bpo-39573: Use Py_IS_TYPE() macro to check for types (GH-18809)Andy Lester2020-03-061-1/+1
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* closes bpo-39872: Remove unused args from symtable_exit_block and ↵Andy Lester2020-03-061-16/+15
| | | | symtable_visit_annotations. (GH-18800)
* closes bpo-39870: Remove unused arg from sys_displayhook_unencodable. (GH-18796)Andy Lester2020-03-051-3/+3
| | | Also move int err to its innermost scope.
* Add a comment to _Py_RestoreSignals() (GH-18792)Victor Stinner2020-03-051-0/+2
| | | subprocess _posix_spawn() should stay in sync with _Py_RestoreSignals().
* bpo-39639: Remove the AST "Suite" node and associated code (GH-18513)Batuhan Taşkaya2020-03-045-93/+0
| | | | | | | | The AST "Suite" node is no longer used and it can be removed from the ASDL definition and related structures (compiler, visitors, ...). Co-Authored-By: Victor Stinner <vstinner@python.org> Co-authored-by: Brett Cannon <54418+brettcannon@users.noreply.github.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39573: Finish converting to new Py_IS_TYPE() macro (GH-18601)Andy Lester2020-03-043-4/+4
|
* bpo-39702: Relax grammar restrictions on decorators (PEP 614) (GH-18570)Brandt Bucher2020-03-032-520/+442
|
* bpo-39831: Remove outdated comment. (GH-18764)Serhiy Storchaka2020-03-031-3/+1
|
* bpo-38091: Import deadlock detection causes deadlock (GH-17518)Armin Rigo2020-03-021-1667/+1670
| | | Automerge-Triggered-By: @brettcannon
* bpo-39776: Lock ++interp->tstate_next_unique_id. (GH-18746) (#18746)Stefan Krah2020-03-021-2/+1
| | | | - Threads created by PyGILState_Ensure() could have a duplicate tstate->id.
* bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750)Serhiy Storchaka2020-03-021-2/+3
|
* bpo-39796: Fix _warnings module initialization (GH-18739)Victor Stinner2020-03-022-15/+27
| | | | | | | | | * Add _PyWarnings_InitState() which only initializes the _warnings module state (tstate->interp->warnings) without creating a module object * Py_InitializeFromConfig() now calls _PyWarnings_InitState() instead of _PyWarnings_Init() * Rename also private functions of _warnings.c to avoid confusion between the public C API and the private C API.
* bpo-38913: Fix segfault in Py_BuildValue("(s#O)", ...) if entered with ↵Serhiy Storchaka2020-03-021-3/+3
| | | | exception raised. (GH-18656)
* closes bpo-39803: Remove unused str from _PyLong_FormatAdvancedWriter. ↵Andy Lester2020-03-011-2/+1
| | | | (GH-18709)
* bpo-39520: Fix un-parsing of ext slices with no dimensions (GH-18304)Batuhan Taşkaya2020-03-011-0/+1
|
* Reuse identifier of PREDICT macros as PREDICT_ID (GH-17155)Denis Chernikov2020-02-211-5/+7
| | | | In function `_PyEval_EvalFrameDefault`, macros PREDICT and PREDICTED use the same identifier creation scheme, which may be shared between them, reducing code repetition, and do ensure that the same identifier is generated.
* Revert "bpo-38691 Added a switch to ignore PYTHONCASEOK when -E or -I flags ↵Victor Stinner2020-02-191-2649/+2646
| | | | | passed (#18314)" (GH-18553) This reverts commit d83b6600b25487e4ebffd7949d0f478de9538875.
* bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521)Dong-hee Na2020-02-171-3/+3
|
* bpo-38691 Added a switch to ignore PYTHONCASEOK when -E or -I flags passed ↵idomic2020-02-171-2646/+2649
| | | | | | | | | | | | | | | | | | | | | (#18314) * Hard reset + cherry piciking the changes. * 📜🤖 Added by blurb_it. * Added @vstinner News * Update Misc/NEWS.d/next/Library/2020-02-11-13-01-38.bpo-38691.oND8Sk.rst Co-Authored-By: Victor Stinner <vstinner@python.org> * Hard reset to master * Hard reset to master + latest changes Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* closes bpo-39630: Update pointers to string literals to be const char *. ↵Andy Lester2020-02-132-2/+2
| | | | (GH-18510)
* bpo-35081: Move dtoa.h header to the internal C API (GH-18489)Victor Stinner2020-02-122-0/+2
| | | | | | | Move the dtoa.h header file to the internal C API as pycore_dtoa.h: it only contains private functions (prefixed by "_Py"). The math and cmath modules must now be compiled with the Py_BUILD_CORE macro defined.
* bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477)Serhiy Storchaka2020-02-121-18/+18
|
* bpo-32856: Optimize the assignment idiom in comprehensions. (GH-16814)Serhiy Storchaka2020-02-121-18/+52
| | | | | Now `for y in [expr]` in comprehensions is as fast as a simple assignment `y = expr`.
* closes bpo-39605: Fix some casts to not cast away const. (GH-18453)Andy Lester2020-02-114-6/+6
| | | | | | | | | | | | | | | gcc -Wcast-qual turns up a number of instances of casting away constness of pointers. Some of these can be safely modified, by either: Adding the const to the type cast, as in: - return _PyUnicode_FromUCS1((unsigned char*)s, size); + return _PyUnicode_FromUCS1((const unsigned char*)s, size); or, Removing the cast entirely, because it's not necessary (but probably was at one time), as in: - PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno); + PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno); These changes will not change code, but they will make it much easier to check for errors in consts
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-117-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-39579: Fix Attribute end_col_offset to point at the current node (GH-18405)Lysandros Nikolaou2020-02-071-2/+3
|
* bpo-39573: Use Py_SET_SIZE() function (GH-18402)Victor Stinner2020-02-073-4/+4
| | | | Replace direct acccess to PyVarObject.ob_size with usage of the Py_SET_SIZE() function.
* bpo-39502: Fix 64-bit Python PyTime_localtime() on AIX (GH-18285)Michael Felt2020-02-071-1/+1
| | | Fix time.localtime() on 64-bit AIX to support years before 1902 and after 2038.
* bpo-39573: Use Py_TYPE() macro in Python and Include directories (GH-18391)Victor Stinner2020-02-079-29/+29
| | | Replace direct access to PyObject.ob_type with Py_TYPE().
* bpo-39573: Use Py_REFCNT() macro (GH-18388)Victor Stinner2020-02-071-1/+1
| | | | Replace direct acccess to PyObject.ob_refcnt with usage of the Py_REFCNT() macro.
* bpo-38823: Fix refleaks in _ast initialization error path (GH-17276)Brandt Bucher2020-02-061-176/+354
|
* bpo-39127: Make _Py_HashPointer's argument be const (GH-17690)Andy Lester2020-02-051-1/+1
|
* bpo-39542: Declare _Py_AddToAllObjects() in pycore_object.h (GH-18368)Victor Stinner2020-02-051-1/+2
| | | | | | _Py_AddToAllObjects() is used in bltinmodule.c and typeobject.c when Py_TRACE_REFS is defined. Fix Py_TRACE_REFS build.
* bpo-39553: Delete HAVE_SXS protected code (GH-18356)Zackery Spytz2020-02-041-15/+0
| | | | | | | https://bugs.python.org/issue39553 Automerge-Triggered-By: @zooba
* bpo-38076 Clear the interpreter state only after clearing module globals ↵Eddie Elizondo2020-02-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-18039) Currently, during runtime destruction, `_PyImport_Cleanup` is clearing the interpreter state before clearing out the modules themselves. This leads to a segfault on modules that rely on the module state to clear themselves up. For example, let's take the small snippet added in the issue by @DinoV : ``` import _struct class C: def __init__(self): self.pack = _struct.pack def __del__(self): self.pack('I', -42) _struct.x = C() ``` The module `_struct` uses the module state to run `pack`. Therefore, the module state has to be alive until after the module has been cleared out to successfully run `C.__del__`. This happens at line 606, when `_PyImport_Cleanup` calls `_PyModule_Clear`. In fact, the loop that calls `_PyModule_Clear` has in its comments: > Now, if there are any modules left alive, clear their globals to minimize potential leaks. All C extension modules actually end up here, since they are kept alive in the interpreter state. That means that we can't clear the module state (which is used by C Extensions) before we run that loop. Moving `_PyInterpreterState_ClearModules` until after it, fixes the segfault in the code snippet. Finally, this updates a test in `io` to correctly assert the error that it now throws (since it now finds the io module state). The test that uses this is: `test_create_at_shutdown_without_encoding`. Given this test is now working is a proof that the module state now stays alive even when `__del__` is called at module destruction time. Thus, I didn't add a new tests for this. https://bugs.python.org/issue38076
* bpo-39542: Move object.h debug functions to internal C API (GH-18331)Victor Stinner2020-02-032-0/+2
| | | | | | | | Move the following functions from the public C API to the internal C API: * _PyDebug_PrintTotalRefs(), * _Py_PrintReferenceAddresses() * _Py_PrintReferences()
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-034-64/+1
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* Update sum comment. (#18240)Brandt Bucher2020-02-011-1/+5
|
* bpo-39511: PyThreadState_Clear() calls on_delete (GH-18296)Victor Stinner2020-02-011-3/+5
| | | | | | | | | | | | | | | | | | PyThreadState.on_delete is a callback used to notify Python when a thread completes. _thread._set_sentinel() function creates a lock which is released when the thread completes. It sets on_delete callback to the internal release_sentinel() function. This lock is known as Threading._tstate_lock in the threading module. The release_sentinel() function uses the Python C API. The problem is that on_delete is called late in the Python finalization, when the C API is no longer fully working. The PyThreadState_Clear() function now calls the PyThreadState.on_delete callback. Previously, that happened in PyThreadState_Delete(). The release_sentinel() function is now called when the C API is still fully working.
* bpo-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254)Hai Shi2020-01-304-12/+7
| | | Moving repetitive `_Py_IDENTIFIER` instances to a global location helps identify them more easily in regards to sub-interpreter support.
* bpo-38631: Replace Py_FatalError() with assert() in ceval.c (GH-18279)Victor Stinner2020-01-301-10/+4
| | | | | | | Replace a few Py_FatalError() calls if tstate is NULL with assert(tstate != NULL) in ceval.c. PyEval_AcquireThread(), PyEval_ReleaseThread() and PyEval_RestoreThread() must never be called with a NULL tstate.
* bpo-38960: DTrace build fix for FreeBSD. (GH-17451)David Carlier2020-01-283-6/+6
| | | | | | | | DTrace build fix for FreeBSD. - allowing passing an extra flag as it need to define the arch size. - casting some probe's arguments.
* bpo-38644: Pass tstate in ceval.c (GH-18222)Victor Stinner2020-01-281-6/+6
| | | Pass explicitly the Python thread state (tstate) in ceval.c.