[New-bugs-announce] [issue9731] ABCMeta.register should verify that methods are present

Daniel Stutzbach report at bugs.python.org
Wed Sep 1 15:02:33 CEST 2010

New submission from Daniel Stutzbach <daniel at stutzbachenterprises.com>:

In Issue 9212, I mused:

> I sort of wonder if .register() should verify that the concrete class
> provides all of the methods of the ABC.

Éric Araujo suggested I open that as an issue for consideration.  

I have found a few bugs in the standard library where a concrete class did not actually implement all of the methods of the ABC that it purported to implement.  Specifically:

dict's keys view claims to implement the Set ABC but doesn't provide the is_disjoint method (Issue 9212)

range objects claims to support the Sequence ABC but don't provide the count and index methods (Issue 9213)

Should ABCMeta.register verify that the type implements all of the appropriate methods?

On the one hand, that would prevent similar bugs from sneaking by.  On the other hand, it's extra code that would get executed every time Python started (site.py imports os.py which imports _abcoll.py).


components: Library (Lib)
messages: 115293
nosy: benjamin.peterson, eric.araujo, gvanrossum, stutzbach
priority: normal
severity: normal
status: open
title: ABCMeta.register should verify that methods are present
type: feature request
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list