Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(136)

Unified Diff: Include/object.h

Issue 29259: Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects
Patch Set: Created 2 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
--- a/Include/object.h Wed Jan 25 23:33:27 2017 +0100
+++ b/Include/object.h Thu Jan 26 02:43:18 2017 +0100
@@ -339,6 +339,8 @@ typedef int (*descrsetfunc) (PyObject *,
typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *);
typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t);
+typedef PyObject* (*fastternaryfunc) (PyObject *self, PyObject **stack,
+ Py_ssize_t nargs, PyObject *kwnames);
#ifdef Py_LIMITED_API
typedef struct _typeobject PyTypeObject; /* opaque */
@@ -424,6 +426,8 @@ typedef struct _typeobject {
destructor tp_finalize;
+ fastternaryfunc tp_fastcall;
+
#ifdef COUNT_ALLOCS
/* these must be last and never explicitly initialized */
Py_ssize_t tp_allocs;
@@ -631,12 +635,12 @@ given type object has a specified featur
/* Objects support garbage collection (see objimp.h) */
#define Py_TPFLAGS_HAVE_GC (1UL << 14)
-/* These two bits are preserved for Stackless Python, next after this is 17 */
+/* Bits 15 and 16 were used by Stackless Python, but are now used for tp_fastcall */
#ifdef STACKLESS
-#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3UL << 15)
-#else
+# error "Stackless is no more supported"
+#endif
+/* Constant kept for backward compatibility */
#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0
-#endif
/* Objects support type attribute cache */
#define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18)
@@ -655,17 +659,21 @@ given type object has a specified featur
#define Py_TPFLAGS_BASE_EXC_SUBCLASS (1UL << 30)
#define Py_TPFLAGS_TYPE_SUBCLASS (1UL << 31)
-#define Py_TPFLAGS_DEFAULT ( \
- Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
- Py_TPFLAGS_HAVE_VERSION_TAG | \
- 0)
-
/* NOTE: The following flags reuse lower bits (removed as part of the
* Python 3.0 transition). */
-/* Type structure has tp_finalize member (3.4) */
+/* Type structure has tp_finalize member (3.4), it can be NULL */
#define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0)
+/* Type structure has tp_fastcall member (3.7), it can be NULL */
+#define Py_TPFLAGS_HAVE_FASTCALL (1UL << 15)
+
+#define Py_TPFLAGS_DEFAULT ( \
+ Py_TPFLAGS_HAVE_VERSION_TAG | \
+ Py_TPFLAGS_HAVE_FINALIZE | \
+ Py_TPFLAGS_HAVE_FASTCALL | \
+ 0)
+
#ifdef Py_LIMITED_API
#define PyType_HasFeature(t,f) ((PyType_GetFlags(t) & (f)) != 0)
#else
« no previous file with comments | « Include/methodobject.h ('k') | Lib/test/test_gdb.py » ('j') | Objects/abstract.c » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+