8000 PyObject doesn't work with None default · Issue #305 · pydantic/pydantic · GitHub
[go: up one dir, main page]

Skip to content

PyObject doesn't work with None default #305

@samuelcolvin

Description

@samuelcolvin

Bug

import pydantic

class Foo(pydantic.BaseModel):
    x: pydantic.PyObject = None
    

Foo()
~/code/pydantic/pydantic/utils.py in import_string(dotted_path)
    102     """
    103     try:
--> 104         module_path, class_name = dotted_path.strip(' ').rsplit('.', 1)
    105     except ValueError as e:
    106         raise ImportError(f'"{dotted_path}" doesn\'t look like a module path') from e

AttributeError: 'NoneType' object has no attribute 'strip'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug V1Bug related to Pydantic V1.X

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0