8000 Update V1 copy to v1.10.21 (#11706) · pydantic/pydantic@04fd639 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04fd639

Browse files
authored
Update V1 copy to v1.10.21 (#11706)
1 parent bd1f8cf commit 04fd639

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed

HISTORY.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,28 @@ First pre-release of Pydantic V2!
19271927

19281928
See [this post](https://docs.pydantic.dev/blog/pydantic-v2-alpha/) for more details.
19291929

1930+
## v1.10.21 (2025-01-10)
1931+
1932+
* Fix compatibility with ForwardRef._evaluate and Python < 3.12.4 by @griels in https://github.com/pydantic/pydantic/pull/11232
1933+
1934+
## v1.10.20 (2025-01-07)
1935+
1936+
This release provides proper support for Python 3.13, with (Cythonized) wheels published for this version.
1937+
As a consequence, Cython was updated from `0.29.x` to `3.0.x`.
1938+
1939+
* General maintenance of CI and build ecosystem by @Viicos in https://github.com/pydantic/pydantic/pull/10847
1940+
- Update Cython to `3.0.x`.
1941+
- Properly address Python 3.13 deprecation warnings.
1942+
- Migrate packaging to `pyproject.toml`, make use of PEP 517 build options.
1943+
- Use [`build`](https://pypi.org/project/build/) instead of direct `setup.py` invocations.
1944+
- Update various Github Actions versions.
1945+
* Replace outdated stpmex link in documentation by @jaredenorris in https://github.com/pydantic/pydantic/pull/10997
1946+
1947+
## v1.10.19 (2024-11-06)
1948+
1949+
* Add warning when v2 model is nested in v1 model by @sydney-runkle in https://github.com/pydantic/pydantic/pull/10432
1950+
* Fix deprecation warning in V1 `isinstance` check by @alicederyn in https://github.com/pydantic/pydantic/pull/10645
1951+
19301952
## v1.10.19 (2024-11-06)
19311953

19321954
* Add warning when v2 model is nested in v1 model by @sydney-runkle in https://github.com/pydantic/pydantic/pull/10432

pydantic/v1/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ def is_untouched(v: Any) -> bool:
282282
cls = super().__new__(mcs, name, bases, new_namespace, **kwargs)
283283
# set __signature__ attr only for model class, but not for its instances
284284
cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config))
285+
286+
if not _is_base_model_class_defined:
287+
# Cython does not understand the `if TYPE_CHECKING:` condition in the
288+
# BaseModel's body (where annotations are set), so clear them manually:
289+
getattr(cls, '__annotations__', {}).clear()
290+
285291
if resolve_forward_refs:
286292
cls.__try_update_forward_refs__()
287293

pydantic/v1/typing.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
def evaluate_forwardref(type_: ForwardRef, globalns: Any, localns: Any) -> Any:
5959
return type_._evaluate(globalns, localns)
6060

61-
else:
61+
elif sys.version_info < (3, 12, 4):
6262

6363
def evaluate_forwardref(type_: ForwardRef, globalns: Any, localns: Any) -> Any:
6464
# Even though it is the right signature for python 3.9, mypy complains with
@@ -67,6 +67,13 @@ def evaluate_forwardref(type_: ForwardRef, globalns: Any, localns: Any) -> Any:
6767
# TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
6868
return cast(Any, type_)._evaluate(globalns, localns, recursive_guard=set())
6969

70+
else:
71+
72+
def evaluate_forwardref(type_: ForwardRef, globalns: Any, localns: Any) -> Any:
73+
# Pydantic 1.x will not support PEP 695 syntax, but provide `type_params` to avoid
74+
# warnings:
75+
return cast(Any, type_)._evaluate(globalns, localns, type_params=(), recursive_guard=set())
76+
7077

7178
if sys.version_info < (3, 9):
7279
# Ensure we always get all the whole `Annotated` hint, not just the annotated type.

pydantic/v1/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def sequence_like(v: Any) -> bool:
159159
return isinstance(v, (list, tuple, set, frozenset, GeneratorType, deque))
160160

161161

162-
def validate_field_name(bases: List[Type['BaseModel']], field_name: str) -> None:
162+
def validate_field_name(bases: Iterable[Type[Any]], field_name: str) -> None:
163163
"""
164164
Ensure that the field's name does not shadow an existing attribute of the model.
165165
"""
@@ -708,6 +708,8 @@ def is_valid_field(name: str) -> bool:
708708
'__orig_bases__',
709709
'__orig_class__',
710710
'__qualname__',
711+
'__firstlineno__',
712+
'__static_attributes__',
711713
}
712714

713715

pydantic/v1/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__all__ = 'compiled', 'VERSION', 'version_info'
22

3-
VERSION = '1.10.19'
3+
VERSION = '1.10.21'
44

55
try:
66
import cython # type: ignore

0 commit comments

Comments
 (0)
0