[issue17179] Misleading error from type() when passing unknown keyword argument

2021-12-05 Thread Irit Katriel
Change by Irit Katriel : -- stage: needs patch -> resolved status: pending -> closed ___ Python tracker ___ ___ Python-bugs-list

[issue17179] Misleading error from type() when passing unknown keyword argument

2021-11-24 Thread Irit Katriel
Irit Katriel added the comment: This seems to have been fixed by now. I get this on 3.11: >>> from types import new_class >>> from datetime import datetime >>> new_class('tdatetime', (datetime, ), kwds={'foo':'bar'}) Traceback (most recent call last): File "", line 1, in File

[issue17179] Misleading error from type() when passing unknown keyword argument

2013-02-18 Thread Chris Withers
Chris Withers added the comment: Some background: I hit this problem when adding Python 3 compatibility to one of my libraries, where I had the following code: from types import ClassType ... class_ = ClassType(n, (sometype, ), dict(class_attr1='foo', class_attr2='bar') It wasn't at all

[issue17179] Misleading error from type() when passing unknown keyword argument

2013-02-18 Thread Nick Coghlan
Nick Coghlan added the comment: For the simple case where you don't need to provide a metaclass hint, the simplest conversion is actually directly to the 3-argument form of type(). As far as the docstring goes, I don't want to make it as long as the full docs, but it could probably stand to

[issue17179] Misleading error from type() when passing unknown keyword argument

2013-02-15 Thread Nick Coghlan
Nick Coghlan added the comment: The types.new_class docs are quite clear that the supplied keyword arguments are equivalent to those provided in the type header (if you want to pre-populate the namespace, that's what exec_body is for). The problem here is that the dual signature of type