summaryrefslogtreecommitdiffstats
path: root/Objects/genobject.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-126491: Revert "GH-126491: Lower heap size limit with faster marking ↵Petr Viktorin2024-12-101-3/+66
| | | | | | | | (GH-127519)" (GH-127770) Revert "GH-126491: Lower heap size limit with faster marking (GH-127519)" This reverts commit 023b7d2141467017abc27de864f3f44677768cb3, which introduced a refleak.
* GH-126491: Lower heap size limit with faster marking (GH-127519)Mark Shannon2024-12-061-66/+3
| | | | | | | * Faster marking of reachable objects * Changes calculation of work to do and work done. * Merges transitive closure calculations
* gh-126091: Always link generator frames when propagating a thrown-in ↵Jacob Bower2024-11-211-6/+12
| | | | | exception through a yield-from chain (#126092) Always link generator frames when propagating a thrown-in exception through a yield-from chain.
* gh-111178: Fix function signatures in genobject.c (#124970)Victor Stinner2024-10-051-206/+271
| | | | | * Add "CAST" macros. * Rename parameters/variables "o" to "ag", "ags", "agw" or "agt" in some functions.
* gh-123923: Defer refcounting for `f_funcobj` in `_PyInterpreterFrame` (#124026)Sam Gross2024-09-241-4/+1
| | | | | | Use a `_PyStackRef` and defer the reference to `f_funcobj` when possible. This avoids some reference count contention in the common case of executing the same code object from multiple threads concurrently in the free-threaded build.
* gh-123923: Defer refcounting for `f_executable` in `_PyInterpreterFrame` ↵Sam Gross2024-09-121-4/+12
| | | | | | | | (#123924) Use a `_PyStackRef` and defer the reference to `f_executable` when possible. This avoids some reference count contention in the common case of executing the same code object from multiple threads concurrently in the free-threaded build.
* GH-118093: Improve handling of short and mid-loop traces (GH-122252)Brandt Bucher2024-07-291-2/+3
|
* gh-100240: Use a consistent implementation for freelists (#121934)Sam Gross2024-07-221-96/+12
| | | | | | | | This combines and updates our freelist handling to use a consistent implementation. Objects in the freelist are linked together using the first word of memory block. If configured with freelists disabled, these operations are essentially no-ops.
* gh-117139: Convert the evaluation stack to stack refs (#118450)Ken Jin2024-06-261-2/+2
| | | | | | | | | | | | | | | | | This PR sets up tagged pointers for CPython. The general idea is to create a separate struct _PyStackRef for everything on the evaluation stack to store the bits. This forces the C compiler to warn us if we try to cast things or pull things out of the struct directly. Only for free threading: We tag the low bit if something is deferred - that means we skip incref and decref operations on it. This behavior may change in the future if Mark's plans to defer all objects in the interpreter loop pans out. This implies a strict stack reference discipline is required. ALL incref and decref operations on stackrefs must use the stackref variants. It is unsafe to untag something then do normal incref/decref ops on it. The new incref and decref variants are called dup and close. They mimic a "handle" API operating on these stackrefs. Please read Include/internal/pycore_stackref.h for more information! --------- Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com>
* gh-120834: fix over-allocation in PyGenObject, PyCoroObject, ↵Irit Katriel2024-06-241-3/+3
| | | | PyAsyncGenObject. (#120941)
* gh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration (#120835)Irit Katriel2024-06-241-18/+14
|
* gh-114091: Reword error message for unawaitable types (#114090)Steele Farnsworth2024-06-171-1/+1
| | | | | Reword error message for unawaitable types.
* gh-110209: Add __class_getitem__ for generator and coroutine (#110212)James Hilton-Balfe2024-05-071-0/+2
|
* GH-117714: implement athrow().close() and asend().close() using throw ↵Thomas Grainger2024-05-061-4/+38
| | | | | | | | | | | | | | | | | | (GH-117906) * GH-117714: replace athrow().close() and asend().close() stubs with implimentations * test athrow().close() and asend().close() raises RuntimeError * 📜🤖 Added by blurb_it. * Update Objects/genobject.c Co-authored-by: Petr Viktorin <encukou@gmail.com> --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* GH-117881: fix athrow().throw()/asend().throw() concurrent access (GH-117882)Thomas Grainger2024-05-011-0/+37
|
* gh-117657: Fix small issues with instrumentation and TSAN (#118064)Dino Viehland2024-04-301-3/+5
| | | Small TSAN fixups for instrumentation
* gh-118272: Clear generator frame's locals when the generator is closed (#118277)Irit Katriel2024-04-301-0/+1
| | | Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* GH-117536: GH-117894: fix athrow().throw(...) unawaited warning (GH-117851)Thomas Grainger2024-04-241-1/+8
|
* gh-111968: Split _Py_async_gen_asend_freelist out of _Py_async_gen_fr… ↵Donghee Na2024-02-171-21/+30
| | | | (gh-115546)
* gh-111968: Rename freelist related struct names to Eric's suggestion (gh-115329)Donghee Na2024-02-141-21/+21
|
* gh-111968: Refactor _PyXXX_Fini to integrate with _PyObject_ClearFreeLists ↵Donghee Na2024-02-101-11/+0
| | | | (gh-114899)
* gh-111968: Use per-thread freelists for dict in free-threading (gh-114323)Donghee Na2024-02-011-0/+4
|
* gh-111968: Unify freelist naming schema to Eric's suggestion (gh-114581)Donghee Na2024-01-261-2/+2
|
* gh-111968: Use per-thread freelists for generator in free-threading (gh-114189)Donghee Na2024-01-181-40/+24
|
* gh-113753: Clear finalized bit when putting PyAsyncGenASend back into free ↵Sam Gross2024-01-101-0/+2
| | | | list (#113754)
* gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed ↵Irit Katriel2023-12-011-1/+1
| | | | coroutine/generator. (#112428)
* gh-111354: remove comparisons with enum values, variable reuse, unused ↵Irit Katriel2023-11-091-22/+14
| | | | imports in genobject.c (#111708)
* gh-111354: Simplify _PyGen_yf by moving some of its work to the compiler and ↵Irit Katriel2023-11-031-24/+9
| | | | frame state (#111648)
* gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 ↵Irit Katriel2023-11-021-18/+9
| | | | (#111459)
* gh-111354: define names for RESUME oparg values (#111365)Irit Katriel2023-10-261-1/+2
|
* gh-109094: replace frame->prev_instr by frame->instr_ptr (#109095)Irit Katriel2023-10-261-5/+8
|
* gh-100762: Fix optimization in gen_close (#111069)Irit Katriel2023-10-251-2/+3
|
* gh-110964: Remove private _PyArg functions (#110966)Victor Stinner2023-10-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the following private functions and structures to pycore_modsupport.h internal C API: * _PyArg_BadArgument() * _PyArg_CheckPositional() * _PyArg_NoKeywords() * _PyArg_NoPositional() * _PyArg_ParseStack() * _PyArg_ParseStackAndKeywords() * _PyArg_Parser structure * _PyArg_UnpackKeywords() * _PyArg_UnpackKeywordsWithVararg() * _PyArg_UnpackStack() * _Py_ANY_VARARGS() Changes: * Python/getargs.h now includes pycore_modsupport.h to export functions. * clinic.py now adds pycore_modsupport.h when one of these functions is used. * Add pycore_modsupport.h includes when a C extension uses one of these functions. * Define Py_BUILD_CORE_MODULE in C extensions which now include directly or indirectly (via code generated by Argument Clinic) pycore_modsupport.h: * _csv * _curses_panel * _dbm * _gdbm * _multiprocessing.posixshmem * _sqlite.row * _statistics * grp * resource * syslog * _testcapi: bad_get() no longer uses METH_FASTCALL calling convention but METH_VARARGS. Replace _PyArg_UnpackStack() with PyArg_ParseTuple(). * _testcapi: add PYTESTCAPI_NEED_INTERNAL_API macro which is defined by _testcapi sub-modules which need the internal C API (pycore_modsupport.h): exceptions.c, float.c, vectorcall.c, watchers.c. * Remove Include/cpython/modsupport.h header file. Include/modsupport.h no longer includes the removed header file. * Fix mypy clinic.py
* GH-108614: Add `RESUME_CHECK` instruction (GH-108630)Mark Shannon2023-09-071-1/+5
|
* GH-108035: Remove the `_PyCFrame` struct as it is no longer needed for ↵Mark Shannon2023-08-171-4/+4
| | | | performance. (GH-108036)
* GH-100964: Break cycles involving exception state when returning from ↵Mark Shannon2023-08-021-5/+4
| | | | generator (GH-107563)
* gh-106869: Use new PyMemberDef constant names (#106871)Victor Stinner2023-07-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove '#include "structmember.h"'. * If needed, add <stddef.h> to get offsetof() function. * Update Parser/asdl_c.py to regenerate Python/Python-ast.c. * Replace: * T_SHORT => Py_T_SHORT * T_INT => Py_T_INT * T_LONG => Py_T_LONG * T_FLOAT => Py_T_FLOAT * T_DOUBLE => Py_T_DOUBLE * T_STRING => Py_T_STRING * T_OBJECT => _Py_T_OBJECT * T_CHAR => Py_T_CHAR * T_BYTE => Py_T_BYTE * T_UBYTE => Py_T_UBYTE * T_USHORT => Py_T_USHORT * T_UINT => Py_T_UINT * T_ULONG => Py_T_ULONG * T_STRING_INPLACE => Py_T_STRING_INPLACE * T_BOOL => Py_T_BOOL * T_OBJECT_EX => Py_T_OBJECT_EX * T_LONGLONG => Py_T_LONGLONG * T_ULONGLONG => Py_T_ULONGLONG * T_PYSSIZET => Py_T_PYSSIZET * T_NONE => _Py_T_NONE * READONLY => Py_READONLY * PY_AUDIT_READ => Py_AUDIT_READ * READ_RESTRICTED => Py_AUDIT_READ * PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED * RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
* gh-106521: Remove _PyObject_LookupAttr() function (GH-106642)Serhiy Storchaka2023-07-121-2/+2
|
* GH-100987: Allow objects other than code objects as the "executable" of an ↵Mark Shannon2023-06-141-3/+3
| | | | | | | | | | internal frame. (GH-105727) * Add table describing possible executable classes for out-of-process debuggers. * Remove shim code object creation code as it is no longer needed. * Make lltrace a bit more robust w.r.t. non-standard frames.
* GH-105162: Account for `INSTRUMENTED_RESUME` in gen.close/throw. (GH-105187)Mark Shannon2023-06-021-3/+15
|
* gh-105140: remove unused arg of _PyErr_ChainStackItem (#105141)Irit Katriel2023-06-011-1/+1
|
* GH-89091: raise `RuntimeWarning` for unawaited async generator methods (#104611)Kumar Aditya2023-05-261-0/+26
|
* gh-104770: Let generator.close() return value (#104771)Nicolas Tessore2023-05-231-3/+8
| | | | Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* GH-102181: Improve specialization stats for SEND (GH-102182)penguin_wwy2023-05-101-3/+0
|
* GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque ↵Mark Shannon2023-05-051-1/+2
| | | | for users of PEP 523. (GH-96849)
* gh-79940: add introspection API for asynchronous generators to `inspect` ↵Thomas Krennwallner2023-03-111-0/+10
| | | | module (#11590)
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-03-081-48/+16
| | | | (in Objects/) (#102218)
* fix typo in async generator code field name `ag_code` (#102448)Kumar Aditya2023-03-081-1/+1
|
* GH-100719: Remove redundant `gi_code` field from generator object. (GH-100749)Mark Shannon2023-02-231-17/+55
|
* gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)Steve Dower2023-02-201-5/+5
| | | | | | * gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h * Make cases_generator correct on Windows