[issue23276] hackcheck is broken in association with __setattr__

Alfred Krohmer report at bugs.python.org
Tue Jan 20 09:40:20 CET 2015


Alfred Krohmer added the comment:

Can you elaborate what QtClass and QtMeta is in your case?

My original example was reduced to a minimal case and seems to work with your suggestions.

The complete example involving SQLalchemy is here:

http://stackoverflow.com/questions/28032928/sqlalchemy-multiple-base-classes-not-working

and does, however, not work.

If I try to do

    # ...

    def __setattr__(cls, key, value):
        super(type(QMediaPlaylist), cls).__setattr__(cls, key, value)
        return

The program segfaults when instantiating the Playlist class. However, this approach seems a little bit strange to me anyhow.

The same happens when I try to do:

    # ...

    def __setattr__(cls, key, value):
        super(type(base), cls).__setattr__(cls, key, value)
        return

I think that comes from PyQt specific attributes SQLalchemy is trying to set / replace.

So, coming back to the original question, how can I actually set an attribute of my class Playlist from within its metaclass without involving the parent classes of the subclass (type(base) and type(QMediaPlaylist))? Because the __setattr__ from PyQt won't work (segfault) and the one from SQLalchemy does stupid stuff.

----------

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


More information about the Python-bugs-list mailing list