summaryrefslogtreecommitdiff
path: root/Include/object.h
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-09-08 00:36:56 -0400
committerRaymond Hettinger <python@rcn.com>2015-09-08 00:36:56 -0400
commit6a97f4d4add4a048b03db0576a3da6522a02e176 (patch)
treea0eb3c2cf7546b895a6f47b5e6b9404a6cc45b62 /Include/object.h
parentba1b338c7060bb018ad015964d7da94621fc18ca (diff)
parenta505c27518b3bc7e2c088dd7d4db802956e1155d (diff)
downloadcpython-6a97f4d4add4a048b03db0576a3da6522a02e176.tar.gz
merge
Diffstat (limited to 'Include/object.h')
-rw-r--r--Include/object.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/Include/object.h b/Include/object.h
index 5f862ab6e9..4d286efe34 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -65,6 +65,7 @@ whose size is determined when the object is allocated.
#error Py_LIMITED_API is incompatible with Py_DEBUG, Py_TRACE_REFS, and Py_REF_DEBUG
#endif
+
#ifdef Py_TRACE_REFS
/* Define pointers to support a doubly-linked list of all live heap objects. */
#define _PyObject_HEAD_EXTRA \
@@ -275,6 +276,9 @@ typedef struct {
binaryfunc nb_inplace_true_divide;
unaryfunc nb_index;
+
+ binaryfunc nb_matrix_multiply;
+ binaryfunc nb_inplace_matrix_multiply;
} PyNumberMethods;
typedef struct {
@@ -297,6 +301,11 @@ typedef struct {
objobjargproc mp_ass_subscript;
} PyMappingMethods;
+typedef struct {
+ unaryfunc am_await;
+ unaryfunc am_aiter;
+ unaryfunc am_anext;
+} PyAsyncMethods;
typedef struct {
getbufferproc bf_getbuffer;
@@ -342,7 +351,8 @@ typedef struct _typeobject {
printfunc tp_print;
getattrfunc tp_getattr;
setattrfunc tp_setattr;
- void *tp_reserved; /* formerly known as tp_compare */
+ PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
+ or tp_reserved (Python 3) */
reprfunc tp_repr;
/* Method suites for standard classes */
@@ -449,6 +459,7 @@ typedef struct _heaptypeobject {
/* Note: there's a dependency on the order of these members
in slotptr() in typeobject.c . */
PyTypeObject ht_type;
+ PyAsyncMethods as_async;
PyNumberMethods as_number;
PyMappingMethods as_mapping;
PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
@@ -572,13 +583,6 @@ PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *);
PyAPI_FUNC(int) Py_ReprEnter(PyObject *);
PyAPI_FUNC(void) Py_ReprLeave(PyObject *);
-#ifndef Py_LIMITED_API
-/* Helper for passing objects to printf and the like.
- Leaks refcounts. Don't use it!
-*/
-#define PyObject_REPR(obj) PyUnicode_AsUTF8(PyObject_Repr(obj))
-#endif
-
/* Flag bits for printing: */
#define Py_PRINT_RAW 1 /* No string quotes etc. */
@@ -714,11 +718,17 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
_Py_NegativeRefcount(__FILE__, __LINE__, \
(PyObject *)(OP)); \
}
+/* Py_REF_DEBUG also controls the display of refcounts and memory block
+ * allocations at the interactive prompt and at interpreter shutdown
+ */
+PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void);
+#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs()
#else
#define _Py_INC_REFTOTAL
#define _Py_DEC_REFTOTAL
#define _Py_REF_DEBUG_COMMA
#define _Py_CHECK_REFCNT(OP) /* a semicolon */;
+#define _PY_DEBUG_PRINT_TOTAL_REFS()
#endif /* Py_REF_DEBUG */
#ifdef COUNT_ALLOCS