summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-94673: Add Per-Interpreter tp_weaklist for Static Builtin Types (#95302)Eric Snow2022-07-292-0/+25
| | | | | | | | | | | | | | | * Store tp_weaklist on the interpreter state for static builtin types. * Factor out _PyStaticType_GET_WEAKREFS_LISTPTR(). * Add _PyStaticType_ClearWeakRefs(). * Add a comment about how _PyStaticType_ClearWeakRefs() loops. * Document the change. * Update Doc/whatsnew/3.12.rst * Fix a typo.
* Fix Unicode doc and replace use of macro with PyMem_New function (GH-94088)Pamela Fox2022-07-281-1/+1
|
* gh-95369: add missing decref in error case of exception group's split (GH-95370)Irit Katriel2022-07-281-0/+1
|
* gh-95324: Emit a warning if an object doesn't call PyObject_GC_UnTrack ↵Pablo Galindo Salgado2022-07-272-2/+4
| | | | during deallocation in debug mode (#95325)
* gh-95005: Replace PyAccu with PyUnicodeWriter (gh-95006)Aivars Kalvāns2022-07-271-115/+0
|
* gh-94673: Add Per-Interpreter Storage for Static Builtin Types (#95255)Eric Snow2022-07-261-5/+106
| | | | | | | | | | | | | | This is the last precursor to storing tp_subclasses (and tp_weaklist) on the interpreter state for static builtin types. Here we add per-type storage on PyInterpreterState, but only for the static builtin types. This involves the following: * add PyInterpreterState.types * move PyInterpreterState.type_cache to it * add a "num_builtins_initialized" field * add a "builtins" field (a static array big enough for all the static builtin types) * add _PyStaticType_GetState() to look up a static builtin type's state * (temporarily) add PyTypeObject.tp_static_builtin_index (to hold the type's index into PyInterpreterState.types.builtins) We will be eliminating tp_static_builtin_index in a later change.
* gh-91247: Use memcpy for list and tuple repeat (#91482)Pieter Eendebak2022-07-262-65/+49
| | | | | | | * Add _Py_memory_repeat function to pycore_list * Add _Py_RefcntAdd function to pycore_object * Use the new functions in tuplerepeat, list_repeat, and list_inplace_repeat
* GH-92678: Expose managed dict clear and visit functions (#95246)Mark Shannon2022-07-251-0/+29
|
* gh-94673: Always Finalize Static Builtin Types (#95153)Eric Snow2022-07-251-23/+80
| | | | | | | | | | | | | Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that. For context, there's an old comment (from e9e3eab0b86) that says the following: // If a type still has subtypes, it cannot be deallocated. // A subtype can inherit attributes and methods of its parent type, // and a type must no longer be used once it's deallocated. However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem. Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
* gh-94673: Add _PyStaticType_InitBuiltin() (#95152)Eric Snow2022-07-257-49/+99
| | | | | | | | | | | | This is the first of several precursors to storing tp_subclasses (and tp_weaklist) on the interpreter state for static builtin types. We do the following: * add `_PyStaticType_InitBuiltin()` * add `_Py_TPFLAGS_STATIC_BUILTIN` * set it on all static builtin types in `_PyStaticType_InitBuiltin()` * shuffle some code around to be able to use _PyStaticType_InitBuiltin() * rename `_PyStructSequence_InitType()` to `_PyStructSequence_InitBuiltinWithFlags()` * add `_PyStructSequence_InitBuiltin()`.
* gh-95173: Revert commit 51ed2c56a1852cd6b09c85ba81312dc9782772ce (#95176)Pablo Galindo Salgado2022-07-241-64/+13
|
* GH-94438: Handle extended arguments and conditional pops in mark_stacks ↵Brandt Bucher2022-07-221-4/+9
| | | | (GH-95110)
* GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121)Brandt Bucher2022-07-221-1/+1
|
* Fix PyCode_Addr2Location when addrq < 0 (GH-95091)Ken Jin2022-07-211-0/+1
|
* GH-90699: fix ref counting of static immortal strings (gh-94850)Kumar Aditya2022-07-201-1/+2
|
* GH-91153: Handle mutating __index__ methods in bytearray item assignment ↵Brandt Bucher2022-07-191-11/+25
| | | | (GH-94891)
* GH-94979: Pop the exception stack when jumping out of exception handlers. ↵Mark Shannon2022-07-191-9/+52
| | | | (#95003)
* gh-94673: [c-analyzer] Add a Script to Identify Static Types (#94989)Eric Snow2022-07-191-11/+3
| | | issue: https://github.com/python/cpython/issues/94673
* GH-94893: Ignore caches when adding LOAD_FAST_CHECKs (GH-94894)Brandt Bucher2022-07-181-1/+3
|
* GH-94739: Mark stacks of exception handling blocks for setting ↵Mark Shannon2022-07-181-11/+121
| | | | frame.f_lineno in the debugger. (GH-94958)
* gh-94841: Ensure arena_map_get() is inlined in PyObject_Free() (#94842)neonene2022-07-141-1/+1
|
* gh-94607: Fix subclassing generics (GH-94610)Ken Jin2022-07-091-0/+4
| | | Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
* GH-90699: Intern statically allocated strings (GH-93597)Kumar Aditya2022-07-081-0/+9
| | | This is similar to how strings are interned for deepfreeze.
* gh-94438: in frameobject's mark_stacks switch, the PUSH_EXC_INFO and ↵Irit Katriel2022-07-061-8/+10
| | | | POP_EXCEPT cases are no longer reachable (GH-94582)
* GH-94438: Account for NULLs on evaluation stack when jumping lines. (GH-94444)Mark Shannon2022-07-011-13/+43
|
* GH-94262: Don't create frame objects for frames that aren't yet complete. ↵Mark Shannon2022-07-012-8/+13
| | | | (GH-94371)
* gh-88116: Avoid undefined behavior when decoding varints in code objects ↵Pablo Galindo Salgado2022-06-281-8/+8
| | | | (#94375)
* gh-87995: Make MappingProxyType hashable (GH-94252)Serhiy Storchaka2022-06-281-1/+7
|
* GH-94163: Add BINARY_SLICE and STORE_SLICE instructions. (GH-94168)Mark Shannon2022-06-271-17/+34
|
* gh-93382: Sync up `co_code` changes with 3.11 (GH-94227)Ken Jin2022-06-241-1/+1
| | | Sync up co_code changes with 3.11 commit 852b4d4bcd12b0b6839a015a262ce976b134f6f3.
* GH-91742: Fix pdb crash after jump (GH-94171)Kumar Aditya2022-06-231-1/+1
|
* gh-93021: Fix __text_signature__ for __get__ (GH-93023)Jelle Zijlstra2022-06-211-2/+2
| | | | | Because of the way wrap_descr_get is written, the second argument to __get__ methods implemented through the wrapper is always optional.
* GH-91432: Specialize FOR_ITER (GH-91713)Dennis Sweeney2022-06-214-39/+58
| | | | | * Adds FOR_ITER_LIST and FOR_ITER_RANGE specializations. * Adds _PyLong_AssignValue() internal function to avoid temporary boxing of ints.
* GH-93249: relax overly strict assertion on bounds->ar_start (GH-93961)Irit Katriel2022-06-201-1/+6
|
* GH-93516: Speedup line number checks when tracing. (GH-93763)Mark Shannon2022-06-201-0/+56
| | | | * Use a lookup table to reduce overhead of getting line numbers during tracing.
* GH-93897: Store frame size in code object and de-opt if insufficient space ↵Mark Shannon2022-06-202-1/+4
| | | | on thread frame stack. (GH-93908)
* gh-84461: Silence some compiler warnings on WASM (GH-93978)Christian Heimes2022-06-201-1/+1
|
* gh-93937, C API: Move PyFrame_GetBack() to Python.h (#93938)Victor Stinner2022-06-192-2/+0
| | | | | | | | | | | | | | | | Move the follow functions and type from frameobject.h to pyframe.h, so the standard <Python.h> provide frame getter functions: * PyFrame_Check() * PyFrame_GetBack() * PyFrame_GetBuiltins() * PyFrame_GetGenerator() * PyFrame_GetGlobals() * PyFrame_GetLasti() * PyFrame_GetLocals() * PyFrame_Type Remove #include "frameobject.h" from many C files. It's no longer needed.
* GH-93990: fix refcounting bug in `add_subclass` in `typeobject.c` (GH-93989)Kumar Aditya2022-06-191-1/+4
|
* gh-93955: Use unbound methods for slot `__getattr__` and `__getattribute__` ↵Ken Jin2022-06-181-1/+8
| | | | (GH-93956)
* gh-89828: Do not relay the __class__ attribute in GenericAlias (#93754)Serhiy Storchaka2022-06-181-0/+1
| | | | | list[int].__class__ returned type, and isinstance(list[int], type) returned True. It caused numerous problems in code that checks isinstance(x, type).
* gh-92888: Fix memoryview bad `__index__` use after free (GH-92946)Ken Jin2022-06-171-19/+36
| | | | Co-authored-by: chilaxan <35645806+chilaxan@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
* gh-93911: Specialize `LOAD_ATTR_PROPERTY` (GH-93912)Ken Jin2022-06-171-10/+1
|
* Update includes in call.c (GH-93786)Pamela Fox2022-06-151-3/+2
|
* GH-93516: Store offset of first traceable instruction in code object (GH-93769)Mark Shannon2022-06-141-0/+6
|
* gh-89546: Clean up PyType_FromMetaclass (GH-93686)Petr Viktorin2022-06-141-90/+186
| | | | | | | | When changing PyType_FromMetaclass recently (GH-93012, GH-93466, GH-28748) I found a bunch of opportunities to improve the code. Here they are. Fixes: #89546 Automerge-Triggered-By: GH:encukou
* gh-79512: Fixed names and __module__ value of weakref classes (GH-93719)Serhiy Storchaka2022-06-141-3/+3
| | | | | Classes ReferenceType, ProxyType and CallableProxyType have now correct atrtributes __module__, __name__ and __qualname__. It makes them (types, not instances) pickleable.
* gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742)Serhiy Storchaka2022-06-143-26/+13
| | | | | | It combines PyImport_ImportModule() and PyObject_GetAttrString() and saves 4-6 lines of code on every use. Add also _PyImport_GetModuleAttr() which takes Python strings as arguments.
* GH-90699: use statically allocated strings in typeobject.c (gh-93751)Kumar Aditya2022-06-121-2/+2
|
* gh-93747: Fix Refleak when handling multiple Py_tp_doc slots (gh-93749)Dong-hee Na2022-06-121-1/+1
|