summaryrefslogtreecommitdiffstats
path: root/Include/object.h
Commit message (Collapse)AuthorAgeFilesLines
* Typo fix in file Include/object.h (GH-14556)Hansraj Das2019-07-051-2/+2
| | | | * accross -> across * Extra space removed in comment
* bpo-32388: Remove cross-version binary compatibility requirement in tp_flags ↵Antoine Pitrou2019-05-291-8/+10
| | | | | | | | (GH-4944) It is now allowed to add new fields at the end of the PyTypeObject struct without having to allocate a dedicated compatibility flag in tp_flags. This will reduce the risk of running out of bits in the 32-bit tp_flags value.
* bpo-36974: implement PEP 590 (GH-13185)Jeroen Demeyer2019-05-291-0/+5
| | | | | Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be> Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)Jeroen Demeyer2019-05-281-0/+3
| | | Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-35983: skip trashcan for subclasses (GH-11841)Jeroen Demeyer2019-05-101-14/+37
| | | | | 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-36465: Make release and debug ABI compatible (GH-12615)Victor Stinner2019-04-241-7/+2
| | | | | | | | | | | | | | Release build and debug build are now ABI compatible: the Py_DEBUG define no longer implies Py_TRACE_REFS define which introduces the only ABI incompatibility. A new "./configure --with-trace-refs" build option is now required to get Py_TRACE_REFS define which adds sys.getobjects() function and PYTHONDUMPREFS environment variable. Changes: * Add ./configure --with-trace-refs * Py_DEBUG no longer implies Py_TRACE_REFS
* bpo-36527: silence -Wunused-parameter warnings in object.h (GH-12688)Dmitry Marakasov2019-04-061-0/+3
|
* bpo-35134: Don't define types twice in header files (GH-10754)Victor Stinner2018-11-271-12/+16
| | | | | | Fix the following clang warning: Include/cpython/pystate.h:217:3: warning: redefinition of typedef 'PyThreadState' is a C11 feature [-Wtypedef-redefinition]
* bpo-35134: Create Include/cpython/object.h (GH-10679)Victor Stinner2018-11-261-485/+6
| | | | | | | | * Move object.h code surrounded by "#ifndef Py_LIMITED_API" to a new Include/cpython/object.h header file. * "typedef struct _typeobject PyTypeObject;" is now always defined in object.h, but if Py_LIMITED_API is not defined, Include/cpython/object.h also defines the structure. * Complete the printfunc comment to mention Py_LIMITED_API define.
* bpo-35059: Add _PyObject_CAST() macro (GH-10645)Victor Stinner2018-11-221-11/+17
| | | | Add _PyObject_CAST() and _PyVarObject_CAST() macros to cast argument to PyObject* and PyVarObject* properly.
* bpo-35059: Convert _PyObject_GC_TRACK() to inline function (GH-10643)Victor Stinner2018-11-221-12/+15
| | | | | | | | | | | | | * Add _PyObject_ASSERT_FROM() and _PyObject_ASSERT_FAILED_MSG() macros. * PyObject_GC_Track() now calls _PyObject_ASSERT_FAILED_MSG(), instead of Py_FatalError(), if the object is already tracked, to dump more information on error. * _PyObject_GC_TRACK() no longer checks if the object is already tracked at runtime, use an assertion instead for best performances; PyObject_GC_Track() still checks at runtime. * pycore_object.h now includes pycore_pystate.h. * Convert _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() macros to inline functions.
* bpo-35059: Enhance _PyObject_AssertFailed() (GH-10642)Victor Stinner2018-11-211-3/+5
| | | | | | Enhance _PyObject_AssertFailed() * Exchange 'expr' and 'msg' parameters * 'expr' and 'func' arguments can now be NULL
* bpo-35230: dict: Remove some macros (GH-10513)INADA Naoki2018-11-141-2/+0
| | | | Remove _Py_REF_DEBUG_COMMA, DK_DEBUG_INCREF, and DK_DEBUG_DECREF. Convert DK_INCREF and DK_DECREF to static inline functions.
* bpo-35059: Convert _Py_Dealloc() to static inline function (GH-10223)Victor Stinner2018-10-301-6/+15
| | | | | Convert _Py_Dealloc() macro into a static inline function. Moreover, it is now also defined as a static inline function if Py_TRACE_REFS is defined.
* bpo-35059: Convert Py_XINCREF() to static inline function (GH-10224)Victor Stinner2018-10-291-13/+17
| | | | Convert Py_XINCREF() and Py_XDECREF() macros into static inline functions.
* bpo-35059: Convert Py_INCREF() to static inline function (GH-10079)Victor Stinner2018-10-291-29/+42
| | | | | * Convert Py_INCREF() and Py_DECREF() macros into static inline functions. * Remove _Py_CHECK_REFCNT() macro: code moved into Py_DECREF().
* bpo-35064 prefix smelly symbols that appear with COUNT_ALLOCS with _Py_ ↵Pablo Galindo2018-10-281-4/+4
| | | | | | | (GH-10152) Configuring python with ./configure --with-pydebug CFLAGS="-D COUNT_ALLOCS -O0" makes "make smelly" fail as some symbols were being exported without the "Py_" or "_Py" prefixes.
* bpo-35053: Define _PyTraceMalloc_NewReference in object.h (GH-10107)Victor Stinner2018-10-251-0/+4
| | | | | | _PyTraceMalloc_NewReference() is now called by _Py_NewReference(), so move its definition to object.h. Moreover, define it even if Py_LIMITED_API is defined, since _Py_NewReference() is also exposed even if Py_LIMITED_API is defined.
* bpo-9263: Dump Python object on GC assertion failure (GH-10062)Victor Stinner2018-10-251-0/+47
| | | | | | | | | | | | | | | | | | | | | | | Changes: * Add _PyObject_AssertFailed() function. * Add _PyObject_ASSERT() and _PyObject_ASSERT_WITH_MSG() macros. * gc_decref(): replace assert() with _PyObject_ASSERT_WITH_MSG() to dump the faulty object if the assertion fails. _PyObject_AssertFailed() calls: * _PyMem_DumpTraceback(): try to log the traceback where the object memory has been allocated if tracemalloc is enabled. * _PyObject_Dump(): log repr(obj). * Py_FatalError(): log the current Python traceback. _PyObject_AssertFailed() uses _PyObject_IsFreed() heuristic to check if the object memory has been freed by a debug hook on Python memory allocators. Initial patch written by David Malcolm. Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
* bpo-35059: Add Py_STATIC_INLINE() macro (GH-10093)Victor Stinner2018-10-251-2/+2
| | | | | | | | | * Add Py_STATIC_INLINE() macro to declare a "static inline" function. If the compiler supports it, try to always inline the function even if no optimization level was specified. * Modify pydtrace.h to use Py_STATIC_INLINE() when WITH_DTRACE is not defined. * Add an unit test on Py_DECREF() to make sure that _Py_NegativeRefcount() reports the correct filename.
* bpo-35053: Add Include/tracemalloc.h (GH-10091)Victor Stinner2018-10-251-0/+3
| | | | | | | * Modify object.h to ensure that pymem.h is included, to get _Py_tracemalloc_config variable. * Move _PyTraceMalloc_XXX() functions to tracemalloc.h, they need PyObject type. Break circular dependency between pymem.h and object.h.
* bpo-35053: Enhance tracemalloc to trace free lists (GH-10063)Victor Stinner2018-10-251-0/+3
| | | | | | | | | | | | tracemalloc now tries to update the traceback when an object is reused from a "free list" (optimization for faster object creation, used by the builtin list type for example). Changes: * Add _PyTraceMalloc_NewReference() function which tries to update the Python traceback of a Python object. * _Py_NewReference() now calls _PyTraceMalloc_NewReference(). * Add an unit test.
* bpo-9263: _PyObject_Dump() detects freed memory (GH-10061)Victor Stinner2018-10-231-0/+1
| | | | | | | | | _PyObject_Dump() now uses an heuristic to check if the object memory has been freed: log "<freed object>" in that case. The heuristic rely on the debug hooks on Python memory allocators which fills the memory with DEADBYTE (0xDB) when memory is deallocated. Use PYTHONMALLOC=debug to always enable these debug hooks.
* bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code ↵Serhiy Storchaka2018-01-251-2/+11
| | | | | (GH-5222) Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
* bpo-32544: Speed up hasattr() and getattr() (GH-5173)INADA Naoki2018-01-161-1/+3
| | | | | AttributeError was raised always when attribute is not found. This commit skip raising AttributeError when `tp_getattro` is `PyObject_GenericGetAttr`. It makes hasattr() and getattr() about 4x faster when attribute is not found.
* bpo-32030: Add more options to _PyCoreConfig (#4485)Victor Stinner2017-11-211-1/+0
| | | | | | Py_Main() now handles two more -X options: * -X showrefcount: new _PyCoreConfig.show_ref_count field * -X showalloccount: new _PyCoreConfig.show_alloc_count field
* Fix miscellaneous typos (#4275)luzpaz2017-11-051-1/+1
|
* bpo-23699: Use a macro to reduce boilerplate code in rich comparison ↵stratakis2017-11-021-0/+19
| | | | functions (GH-793)
* bpo-31497: Add private helper _PyType_Name(). (#3630)Serhiy Storchaka2017-09-171-0/+1
| | | | This function returns the last component of tp_name after a dot. Returns tp_name itself if it doesn't contain a dot.
* bpo-30860: Fix a refleak. (#3567)Eric Snow2017-09-141-2/+1
| | | | | Resolves bpo-31420. (This was accidentally reverted when in #3565.)
* bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)Eric Snow2017-09-141-1/+2
| | | PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
* bpo-30860: Fix a refleak. (#3506)Eric Snow2017-09-121-2/+1
| | | | | | | | | | | | | | * Drop warnoptions from PyInterpreterState. * Drop xoptions from PyInterpreterState. * Don't set warnoptions and _xoptions again. * Decref after adding to sys.__dict__. * Drop an unused macro. * Check sys.xoptions *before* we delete it.
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-2/+0
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)Eric Snow2017-09-061-0/+2
| | | Windows buildbots started failing due to include-related errors.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-061-2/+0
| | | | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-30341: Improve _PyTrash_thread_destroy_chain() a little bit (#1545)Xiang Zhang2017-05-131-1/+1
| | | | | * add a comment about why we need to increase trash_delete_nesting * move increase and decrese outside of the loop
* Issue #29058: All stable API extensions added after Python 3.2 are nowSerhiy Storchaka2016-12-271-0/+2
| | | | | available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of the minimum Python version supporting this API.
* Issue #26900: Excluded underscored names and other private API from limited API.Serhiy Storchaka2016-09-111-2/+13
|
* Issue #24254: Drop cls.__definition_order__.Eric Snow2016-09-081-2/+0
|
* Implement compact dictVictor Stinner2016-09-081-1/+0
| | | | | | | | | | | | Issue #27350: `dict` implementation is changed like PyPy. It is more compact and preserves insertion order. _PyDict_Dummy() function has been removed. Disable test_gdb: python-gdb.py is not updated yet to the new structure of compact dictionaries (issue #28023). Patch written by INADA Naoki.
* make _Py_static_string_init use a designated initializerBenjamin Peterson2016-09-071-1/+1
|
* Issue #24254: Preserve class attribute definition order.Eric Snow2016-09-051-0/+2
|
* Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREFSerhiy Storchaka2016-04-101-2/+12
|\ | | | | | | in places where Py_DECREF was used.
| * Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREFSerhiy Storchaka2016-04-101-2/+12
| | | | | | | | in places where Py_DECREF was used.
* | Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-2/+2
|\ \ | |/
| * Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-2/+2
| |
* | fix indentation in Py_DECREF()Victor Stinner2016-03-191-1/+1
|/
* Issue #26304: Change "allows to <verb>" to "allows <verb>ing" or similarMartin Panter2016-02-101-1/+1
| | | | | The original form is incorrect grammar and feels awkward, even though the meaning is clear.
* Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-241-0/+26
| | | | macro Py_SETREF.
* docs: Better comment for tp_as_async slotYury Selivanov2015-08-261-1/+2
|