-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow extra keyword arguments in MetaModel.__new__ #867
Labels
Comments
4 tasks
samuelcolvin
pushed a commit
that referenced
this issue
Oct 8, 2019
…__ (#868) * Fix #867 by accepting and passing on **kwargs in ModelMetaclass.__new__ pydantic.main.MetaModel.__new__ should include **kwargs at the end of the method definition and pass them on to the super call at the end in order to allow the special method __init_subclass__ to be defined with custom parameters on extended BaseModel classes. * MetaModel -> ModelMetaclass * shrink change notes * rename and reformat change description
samuelcolvin
added
feature request
and removed
bug V1
Bug related to Pydantic V1.X
labels
Nov 22, 2019
andreshndz
pushed a commit
to cuenca-mx/pydantic
that referenced
this issue
Jan 17, 2020
…ss.__new__ (pydantic#868) * Fix pydantic#867 by accepting and passing on **kwargs in ModelMetaclass.__new__ pydantic.main.MetaModel.__new__ should include **kwargs at the end of the method definition and pass them on to the super call at the end in order to allow the special method __init_subclass__ to be defined with custom parameters on extended BaseModel classes. * MetaModel -> ModelMetaclass * shrink change notes * rename and reformat change description
4 tasks
alexdrydew
pushed a commit
to alexdrydew/pydantic
that referenced
this issue
Dec 23, 2023
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug
pydantic.main.ModelMetaclass.__new__
should include**kwargs
at the end of the method definition and pass them on to thesuper
call at the end in order to allow the special method__init_subclass__
to be defined with custom parameters on extendedBaseModel
classes.Environment:
import sys; print(sys.version)
:3.7.3 (default, Apr 3 2019, 19:16:38) \n[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]
import pydantic; print(pydantic.VERSION)
: 0.31For example:
should not raise any exceptions. But:
I can (and will) submit a PR for this if you accept it; it is an extremely simple fix (plus not-so-simple tests because metaclasses).
The text was updated successfully, but these errors were encountered: