diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-02-28 04:45:36 (GMT) |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-02-28 04:45:36 (GMT) |
commit | 960b9b7a2f6e9b4f0e6b692d604c53b3fd2f5d1c (patch) | |
tree | 9f0cc6bac83e4c2607c6bea64249932fc5353859 /Include/object.h | |
parent | c105289ec4e22f5d53f3e5872ad6a49da8a33b6d (diff) | |
download | cpython-960b9b7a2f6e9b4f0e6b692d604c53b3fd2f5d1c.zip cpython-960b9b7a2f6e9b4f0e6b692d604c53b3fd2f5d1c.tar.gz cpython-960b9b7a2f6e9b4f0e6b692d604c53b3fd2f5d1c.tar.bz2 |
Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed
./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'
up from 2.5us to 0.201us. This fixes issue 1762.
Diffstat (limited to 'Include/object.h')
-rw-r--r-- | Include/object.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/object.h b/Include/object.h index 65440a6..8d04935 100644 --- a/Include/object.h +++ b/Include/object.h @@ -537,6 +537,9 @@ given type object has a specified feature. #define Py_TPFLAGS_HAVE_VERSION_TAG (1L<<18) #define Py_TPFLAGS_VALID_VERSION_TAG (1L<<19) +/* Type is abstract and cannot be instantiated */ +#define Py_TPFLAGS_IS_ABSTRACT (1L<<20) + /* These flags are used to determine if a type is a subclass. */ #define Py_TPFLAGS_INT_SUBCLASS (1L<<23) #define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) |