Skip to content

Commit

Permalink
Lazy import
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed May 15, 2024
1 parent 675e380 commit 531f3c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pydantic/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from ._internal import _config, _decorators, _typing_extra
from ._internal import _dataclasses as _pydantic_dataclasses
from ._internal._utils import is_model_class
from ._migration import getattr_migration
from .config import ConfigDict
from .errors import PydanticUserError
Expand Down Expand Up @@ -192,6 +191,8 @@ def create_dataclass(cls: type[Any]) -> type[PydanticDataclass]:
Returns:
A Pydantic dataclass.
"""
from ._internal._utils import is_model_class

if is_model_class(cls):
raise PydanticUserError(
f'Cannot create a Pydantic dataclass from {cls.__name__} as it is already a Pydantic model',
Expand Down

0 comments on commit 531f3c2

Please sign in to comment.