This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author thet
Recipients thet
Date 2009-05-11.14:06:00
SpamBayes Score 2.5018656e-09
Marked as misclassified No
Message-id <1242050763.07.0.145569961651.issue5996@psf.upfronthosting.co.za>
In-reply-to
Content
when declaring a abstract base class with an abstract property or method
and subclassing from dict, the class is instantiable (instanceable?).

>>> import abc
>>> class A(object):
...     __metaclass__ = abc.ABCMeta
...     @abc.abstractproperty
...     def abstract(self): return True
... 
>>> a = A()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Can't instantiate abstract class A with abstract methods abstract
>>> 
>>> class A2(dict):
...     __metaclass__ = abc.ABCMeta
...     @abc.abstractproperty
...     def abstract(self): return True
... 
>>> a2 = A2()
>>> 


although, when using the dict definition from __builtin__.pi directly,
the abc behaves like expected. but this may be a bug in the
c-implementation from dict.

platform:
Python 2.6.2 (r262:71600, Apr 25 2009, 21:56:41) 
[GCC 4.3.2] on linux2
History
Date User Action Args
2009-05-11 14:06:03thetsetrecipients: + thet
2009-05-11 14:06:03thetsetmessageid: <1242050763.07.0.145569961651.issue5996@psf.upfronthosting.co.za>
2009-05-11 14:06:01thetlinkissue5996 messages
2009-05-11 14:06:00thetcreate