[issue23722] During metaclass.__init__, super() of the constructed class does not work
Tim Graham
report at bugs.python.org
Fri Dec 2 09:34:52 EST 2016
Tim Graham added the comment:
Hi, this causes a regression in Django and I'm not sure if Django or cpython is at fault. For a simple model that uses super() rather than super(Model self) in save():
from django.db import models
class Model(models.Model):
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
>>> Model().save()
Traceback (most recent call last):
File "/home/tim/code/mysite/model/tests.py", line 8, in test
Model().save()
File "/home/tim/code/mysite/model/models.py", line 5, in save
super().save(*args, **kwargs)
RuntimeError: super(): empty __class__ cell
django.db.models.Model does some things with metaclasses which is likely related to the root cause:
https://github.com/django/django/blob/6d1394182d8c4c02598e0cf47f42a5e86706411f/django/db/models/base.py
If someone could provide guidance about what the issue might be, I'm happy to provide more details or to debug this further.
Thank you!
----------
nosy: +Tim.Graham
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23722>
_______________________________________
More information about the Python-bugs-list
mailing list