Skip to content

Commit b5cc2e9

Browse files
committed
Set stacklevel on validator function field_name arg DeprecationWarning
1 parent 9bac3bd commit b5cc2e9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python/pydantic_core/core_schema.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,6 +2063,7 @@ def fn(v: bytes, info: core_schema.ValidationInfo) -> str:
20632063
warnings.warn(
20642064
'The `field_name` argument on `with_info_before_validator_function` is deprecated, it will be passed to the function through `ValidationState` instead.',
20652065
DeprecationWarning,
2066+
stacklevel=2,
20662067
)
20672068

20682069
return _dict_not_none(
@@ -2166,6 +2167,7 @@ def fn(v: str, info: core_schema.ValidationInfo) -> str:
21662167
warnings.warn(
21672168
'The `field_name` argument on `with_info_after_validator_function` is deprecated, it will be passed to the function through `ValidationState` instead.',
21682169
DeprecationWarning,
2170+
stacklevel=2,
21692171
)
21702172

21712173
return _dict_not_none(
@@ -2309,6 +2311,7 @@ def fn(
23092311
warnings.warn(
23102312
'The `field_name` argument on `with_info_wrap_validator_function` is deprecated, it will be passed to the function through `ValidationState` instead.',
23112313
DeprecationWarning,
2314+
stacklevel=2,
23122315
)
23132316

23142317
return _dict_not_none(
@@ -2407,6 +2410,7 @@ def fn(v: str, info: core_schema.ValidationInfo) -> str:
24072410
warnings.warn(
24082411
'The `field_name` argument on `with_info_plain_validator_function` is deprecated, it will be passed to the function through `ValidationState` instead.',
24092412
DeprecationWarning,
2413+
stacklevel=2,
24102414
)
24112415

24122416
return _dict_not_none(

0 commit comments

Comments
 (0)