[New-bugs-announce] [issue9659] frozenset, when subclassed will yield warning upon call to super(...).__init__(iterable)

Carsten Klein report at bugs.python.org
Sun Aug 22 16:42:21 CEST 2010


New submission from Carsten Klein <carsten.klein at axn-software.de>:

Example

class a(frozenset):
    def __init__(self, iterable):
        super(a, self).__init__(iterable)


i = a([1,2,3])
> __main__:3: DeprecationWarning: object.__init__() takes no parameters
> a([1, 2, 3])


This might be due to the fact that the frozenset type structure does not initialize the tp_init field in setobject.c, thus inheriting the original __init__ from object.

Subclassing set will not issue that warning as it actually defines the tp_init field to (initroc)set_init.

This holds true also for the Python 2.7 release and maybe also later releases.

Expected behaviour: do not output that warning message and provide an initproc for the tp_field.

----------
components: None
messages: 114676
nosy: carsten.klein at axn-software.de
priority: normal
severity: normal
status: open
title: frozenset, when subclassed will yield warning upon call to super(...).__init__(iterable)
type: behavior
versions: Python 2.6

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


More information about the New-bugs-announce mailing list