[issue41629] __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__?

2020-08-25 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Related SO questions : 

* 
https://stackoverflow.com/questions/61543768/super-in-a-typing-namedtuple-subclass-fails-in-python-3-8
* 
https://stackoverflow.com/questions/41343263/provide-classcell-example-for-python-3-6-metaclass

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41629] __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__?

2020-08-25 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The example used to raise deprecation warning in python 3.7

python3.7 -Wall ../backups/bpo41629.py
../backups/bpo41629.py:4: DeprecationWarning: __class__ not set defining 'X' as 
. Was __classcell__ propagated to type.__new__?
  class X(NamedTuple):

It was converted into RuntimeError in 
https://github.com/python/cpython/commit/f5e7b1999f46e592d42dfab51563ea5411946fb7
 . Related https://bugs.python.org/issue23722

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41629] __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__?

2020-08-24 Thread mike bayer


New submission from mike bayer :

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 
class X(NamedTuple):
RuntimeError: __class__ not set defining 'X' as . 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 . Was 
__classcell__ propagated to type.__new__?
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com