New issue 3109: Inheriting from a function produces nonsensical-ish error 
message
https://bitbucket.org/pypy/pypy/issues/3109/inheriting-from-a-function-produces

Julian Berman:

```
>>> def foo():
...     pass

>>>
>>> class Bar(foo):
...     pass
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'internal-code' object expected, got 'str' instead

'internal-code' object expected, got 'str' instead
```

\(CPython is no better, FWIW, on 3.7:

‌

```
>>> def foo():
...     pass
...
>>>
>>> class Bar(foo):
...     pass
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: function() argument 1 must be code, not str
```

\)

‌

Something like “superclasses of a class must be instances of `type` \(i.e. 
classes\)” would be a lot nicer \(if in fact that is the criteria, I forget\)


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to