Skip to content
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

pydantic.BaseModel 对象无法正确打印 #80

Open
fyc09 opened this issue Oct 1, 2022 · 2 comments
Open

pydantic.BaseModel 对象无法正确打印 #80

fyc09 opened this issue Oct 1, 2022 · 2 comments

Comments

@fyc09
Copy link

fyc09 commented Oct 1, 2022

我在使用 pydantic + objprint,打印对象使用了 #52 中的方法,但程序在 op 处阻塞住。

from objprint import op
from pydantic import BaseModel


class A(BaseModel):
    a: int


obj = A(a=1)
op(obj, honor_existing=False)
@sledgeh4w
Copy link

继承BaseModel的类都有一个Config属性,这个属性好像有着很复杂的引用关系,就导致一直阻塞,可以在调用op时指定遍历深度就能避免阻塞。

op(obj, honor_existing=False, depth=1)

@fyc09
Copy link
Author

fyc09 commented Jan 6, 2023

但当我使用 0.2.1 版本的 objprint,这段程序就可以正常工作。我还发现 #65 之前的所有版本都可以正常运行这段函数,在 a855ff8 以前都是正确的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants