[New-bugs-announce] [issue31333] Implement ABCMeta in C

Ivan Levkivskyi report at bugs.python.org
Sun Sep 3 16:54:21 EDT 2017


New submission from Ivan Levkivskyi:

The idea is that creating ABCs is approximately twice slower than normal classes. Plus there are smaller penalties for various operations with ABCs. This mostly influences the Python interpreter start-up time (because of extensive use of ABCs in importlib), and start-up times of programs that extensively use ABCs.

The situation can be improved by rewriting ABCMeta in C. I have a working implementation, but it is far form being ready and still needs some polishing and optimizations (in particular _abc_cache and friends).

Already at this stage I have one question (I will add more when they appear while I am finishing the implementation): is it OK to make _abc_cache, _abc_negative_cache, _abc_negative_cache_version, and _abc_registry read-only? The point is that I want to prohibit something like this:

    MyABC._abc_cache = "Surprise on updating the cache!"

thus avoiding many PySet_Check(...) calls. These attributes are not documented and start with underscore.

----------
components: Extension Modules, Library (Lib)
messages: 301198
nosy: barry, levkivskyi
priority: normal
severity: normal
status: open
title: Implement ABCMeta in C
type: performance
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31333>
_______________________________________


More information about the New-bugs-announce mailing list