This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Using type() as a constructor doesn't support new class keyword arguments
Type: enhancement Stage:
Components: Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, gulopine
Priority: normal Keywords:

Created on 2011-10-08 21:53 by gulopine, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg145190 - (view) Author: Marty Alchin (gulopine) Date: 2011-10-08 21:53
PEP 3115 introduced keyword arguments to class definitions and changed metaclasses to use them instead. Unfortunately, `type()` doesn't seem to have been updated to accept those keyword arguments as well. What this amounts to is that using `type()` as a constructor can no longer fully replicate the behavior of a class definition. Therefore, classes that use keyword arguments can't be created dynamically.

I would attempt a patch, but I don't have a development environment capable of compiling Python, so I wouldn't have any chance to test it.
msg145197 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-10-08 23:37
That's not true. You simply call the metaclass itself.
msg145198 - (view) Author: Marty Alchin (gulopine) Date: 2011-10-08 23:57
Hrm, that does seem to satisfy the case I was immediately concerned with, but I was thinking there was another issue with it, but now I'm having trouble pinning down an example. I'll just assume I was getting ahead of myself. Thanks for the sanity lesson.
History
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57344
2011-10-08 23:57:27gulopinesetmessages: + msg145198
2011-10-08 23:37:01benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg145197

resolution: not a bug
2011-10-08 21:53:38gulopinecreate