New submission from mike bayer <mike...@zzzcomputing.com>:

This is likely related or a dupe of https://bugs.python.org/issue29270, but the 
error message is different.  I'm posting this to confirm it's the same issue, 
or not, and to at least provide a google result for people who also see this 
error as 29270 seems to imply this might not be fixable.

Like 29270, it involves the fact that the interpreter seems to be looking at my 
super() call inside of a method without actually calling it, and then getting 
upset about __classcell__:



from typing import NamedTuple


class X(NamedTuple):
    a: str
    b: str

    # comment this out to remove the issue
    def foo(self):
        return super(X, self)


and that's it!  on my interpreter:

Python 3.8.3 (default, May 23 2020, 16:34:37) 
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux

I get:

$ python test3.py 
Traceback (most recent call last):
  File "test3.py", line 4, in <module>
    class X(NamedTuple):
RuntimeError: __class__ not set defining 'X' as <class '__main__.X'>. Was 
__classcell__ propagated to type.__new__?

The most surprising thing is that this seems extremely basic and google is not 
finding this error message for me.

----------
components: Interpreter Core
messages: 375863
nosy: zzzeek
priority: normal
severity: normal
status: open
title: __class__ not set defining 'X' as <class '__main__.X'>. Was 
__classcell__ propagated to type.__new__?
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41629>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to