classification
Title: Can't create abstract tuple
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: abstract class instantiable when subclassing built-in types
View: 5996
Assigned To: Nosy List: Jack Hargreaves, luiz.poleto, maciej.szulik
Priority: normal Keywords:

Created on 2016-02-08 12:21 by Jack Hargreaves, last changed 2016-05-25 13:19 by r.david.murray. This issue is now closed.

Messages (3)
msg259839 - (view) Author: Jack Hargreaves (Jack Hargreaves) Date: 2016-02-08 12:21
When creating an abstract class, subclassing tuple causes check for instantiation of an abstract class to be bypassed. See the associated stackoverflow question -- http://stackoverflow.com/questions/35267954/mix-in-of-abstract-class-and-namedtuple

    from abc import abstractmethod, ABCMeta

    class AbstactClass(tuple, metaclass=ABCMeta):

        @abstractmethod
        def some_method(self):
            pass

    # following should throw a TypeError, but doesn't
    AbstactClass()
msg260193 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-02-12 19:21
3.2 to 3.4 only get security fixes
msg266294 - (view) Author: Luiz Poleto (luiz.poleto) * Date: 2016-05-25 03:45
Same as reported on issue #5996. Apparently this happens not only with tuple but with any builtin type.

There is a patch on that issue but there hasn't been any activity since 2011.
History
Date User Action Args
2016-05-25 13:19:26r.david.murraysetstatus: open -> closed
superseder: abstract class instantiable when subclassing built-in types
resolution: duplicate
stage: test needed -> resolved
2016-05-25 03:45:06luiz.poletosetnosy: + luiz.poleto
messages: + msg266294
2016-02-12 19:21:43terry.reedysetnosy: - terry.reedy
2016-02-12 19:21:30terry.reedysetversions: + Python 3.6, - Python 3.2, Python 3.3, Python 3.4
nosy: + terry.reedy

messages: + msg260193

components: + Library (Lib)
stage: test needed
2016-02-08 14:32:09maciej.szuliksetnosy: + maciej.szulik
2016-02-08 12:21:53Jack Hargreavescreate