[New-bugs-announce] [issue39665] Cryptic error message when creating types that don't include themselves in their MRO

ppperry report at bugs.python.org
Mon Feb 17 12:00:26 EST 2020


New submission from ppperry <mapreader at olum.org>:

I was trying to create a class that didn't have any references to itself to test issue39382 and ran the following code:

class Meta(type):
	def mro(cls):
		return type.mro(cls)[1:]
class X(metaclass=Meta):
	    pass

This produced an extremely cryptic error message:

Traceback (most recent call last):
  File "<pyshell#89>", line 1, in <module>
    class X(metaclass=Meta):
TypeError: super(type, obj): obj must be an instance or subtype of type

While what I am trying to do may well not be supported, the error message referencing the `super` function, which I didn't use, is not helpful.

----------
components: Build, Interpreter Core
messages: 362152
nosy: ppperry
priority: normal
severity: normal
status: open
title: Cryptic error message when creating types that don't include themselves in their MRO
type: behavior
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39665>
_______________________________________


More information about the New-bugs-announce mailing list