Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pydantic for openSUSE:Factory 
checked in at 2024-01-07 21:38:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pydantic (Old)
 and      /work/SRC/openSUSE:Factory/.python-pydantic.new.28375 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pydantic"

Sun Jan  7 21:38:56 2024 rev:20 rq:1137356 version:1.10.13

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pydantic/python-pydantic.changes  
2023-07-06 18:28:10.130960081 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pydantic.new.28375/python-pydantic.changes   
    2024-01-07 21:38:59.141145544 +0100
@@ -1,0 +2,20 @@
+Thu Nov 16 09:58:50 UTC 2023 - Dirk Müller <dmuel...@suse.com>
+
+- update to 1.10.13:
+  * Fix: Add max length check to `pydantic.validate_email`
+  * Docs: Fix pip commands to install v1
+  * Fixes the `maxlen` property being dropped on `deque`
+    validation. Happened only if the deque item has been typed.
+    Changes the `_validate_sequence_like` func, #6581 by
+  * Importing create_model in tools.py through relative path
+    instead of absolute path - so that it doesn't import V2 code
+    when copied over to V2 branch, #6361 by @SharathHuddar
+  * Add Pydantic `Json` field support to settings management,
+  * Fixed literal validator errors for unhashable values
+  * Fixed bug with generics receiving forward refs
+  * Update install method of FastAPI for internal tests in CI,
+    #6117 by @Kludex
+- add Fix-Python-3.12-test-failures.patch: fix test fails with
+  Python 3.12
+
+-------------------------------------------------------------------

Old:
----
  pydantic-1.10.9.tar.gz

New:
----
  Fix-Python-3.12-test-failures.patch
  pydantic-1.10.13.tar.gz

BETA DEBUG BEGIN:
  New:    #6117 by @Kludex
- add Fix-Python-3.12-test-failures.patch: fix test fails with
  Python 3.12
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pydantic.spec ++++++
--- /var/tmp/diff_new_pack.4lnQBU/_old  2024-01-07 21:39:00.181183375 +0100
+++ /var/tmp/diff_new_pack.4lnQBU/_new  2024-01-07 21:39:00.185183521 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pydantic
 #
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
 # Copyright (c) 2019, Martin Hauke <mar...@gmx.de>
 #
 # All modifications and additions to the file contributed by third parties
@@ -19,7 +19,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-pydantic
-Version:        1.10.9
+Version:        1.10.13
 Release:        0
 Summary:        Data validation and settings management using python type 
hinting
 License:        MIT
@@ -28,6 +28,7 @@
 # PATCH-FIX-OPENSUSE Ignore DeprecationWarning until requests-toolbelt is fixed
 # (Pulled in by email-validator)
 Patch0:         ignore-urllib3-pyopenssl-warning.patch
+Patch1:         Fix-Python-3.12-test-failures.patch
 BuildRequires:  %{python_module email-validator >= 1.0.3}
 BuildRequires:  %{python_module packaging}
 BuildRequires:  %{python_module pytest-mock}

++++++ Fix-Python-3.12-test-failures.patch ++++++
>From 5fd4002c62d3538efc3ff51f92850f4c0bf4ffab Mon Sep 17 00:00:00 2001
From: Maxwell G <maxw...@gtmx.me>
Date: Sat, 12 Aug 2023 00:21:50 +0000
Subject: [PATCH] Fix Python 3.12 test failures

---
 tests/test_abc.py      | 15 ++++++++++++---
 tests/test_generics.py |  6 ++++--
 tests/test_types.py    |  6 +++++-
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/tests/test_abc.py b/tests/test_abc.py
index 8beed04..d7e8f3d 100644
--- a/tests/test_abc.py
+++ b/tests/test_abc.py
@@ -1,4 +1,5 @@
 import abc
+import sys
 
 import pytest
 
@@ -40,7 +41,15 @@ def 
test_model_subclassing_abstract_base_classes_without_implementation_raises_e
 
     with pytest.raises(TypeError) as excinfo:
         Model(some_field='some_value')
-    assert str(excinfo.value) == (
-        "Can't instantiate abstract class Model with abstract methods "
-        "my_abstract_classmethod, my_abstract_method, my_abstract_property, 
my_abstract_staticmethod"  # noqa: Q000
+    message = (
+        (
+            "Can't instantiate abstract class Model with abstract methods "
+            "my_abstract_classmethod, my_abstract_method, 
my_abstract_property, my_abstract_staticmethod"  # noqa: Q000
+        )
+        if sys.version_info < (3, 12)
+        else (
+            "Can't instantiate abstract class Model without an implementation 
for abstract methods "
+            "'my_abstract_classmethod', 'my_abstract_method', 
'my_abstract_property', 'my_abstract_staticmethod'"  # noqa: Q000
+        )
     )
+    assert str(excinfo.value) == message
diff --git a/tests/test_generics.py b/tests/test_generics.py
index 68f93d4..23e6263 100644
--- a/tests/test_generics.py
+++ b/tests/test_generics.py
@@ -579,9 +579,11 @@ def test_partial_specification_name():
         b: BT
 
     partial_model = Model[int, BT]
-    assert partial_model.__name__ == 'Model[int, BT]'
+    expected = 'Model[int, BT]' if sys.version_info < (3, 12) else 'Model[int, 
TypeVar]'
+    assert partial_model.__name__ == expected
     concrete_model = partial_model[str]
-    assert concrete_model.__name__ == 'Model[int, BT][str]'
+    expected += '[str]'
+    assert concrete_model.__name__ == expected
 
 
 def test_partial_specification_instantiation():
diff --git a/tests/test_types.py b/tests/test_types.py
index b908d46..4277398 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -2713,7 +2713,11 @@ def test_secretfield():
     class Foobar(SecretField):
         ...
 
-    message = "Can't instantiate abstract class Foobar with abstract methods? 
get_secret_value"
+    message = (
+        "Can't instantiate abstract class Foobar with abstract methods? 
get_secret_value"
+        if sys.version_info < (3, 12)
+        else "Can't instantiate abstract class Foobar without an 
implementation for abstract method 'get_secret_value'"
+    )
 
     with pytest.raises(TypeError, match=message):
         Foobar()
-- 
2.41.0


++++++ pydantic-1.10.9.tar.gz -> pydantic-1.10.13.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/.github/workflows/ci.yml 
new/pydantic-1.10.13/.github/workflows/ci.yml
--- old/pydantic-1.10.9/.github/workflows/ci.yml        2023-06-07 
17:51:36.000000000 +0200
+++ new/pydantic-1.10.13/.github/workflows/ci.yml       2023-09-27 
18:38:55.000000000 +0200
@@ -491,8 +491,7 @@
         with:
           version_file_path: 'pydantic/version.py'
 
-      # need to remove "latest" once V2 is released!
-      - run: mike deploy -b docs-site ${{ 
steps.check-version.outputs.VERSION_MAJOR_MINOR }} latest --update-aliases 
--push
+      - run: mike deploy -b docs-site ${{ 
steps.check-version.outputs.VERSION_MAJOR_MINOR }} --update-aliases --push
         if: "startsWith(github.ref, 'refs/tags/') && 
!fromJSON(steps.check-version.outputs.IS_PRERELEASE)"
 
   release:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/HISTORY.md 
new/pydantic-1.10.13/HISTORY.md
--- old/pydantic-1.10.9/HISTORY.md      2023-06-07 17:51:36.000000000 +0200
+++ new/pydantic-1.10.13/HISTORY.md     2023-09-27 18:38:55.000000000 +0200
@@ -1,3 +1,22 @@
+## v1.10.13 (2023-09-27)
+
+* Fix: Add max length check to `pydantic.validate_email`, #7673 by @hramezani
+* Docs: Fix pip commands to install v1, #6930 by @chbndrhnns
+
+## v1.10.12 (2023-07-24)
+
+* Fixes the `maxlen` property being dropped on `deque` validation. Happened 
only if the deque item has been typed. Changes the `_validate_sequence_like` 
func, #6581 by @maciekglowka
+
+## v1.10.11 (2023-07-04)
+
+* Importing create_model in tools.py through relative path instead of absolute 
path - so that it doesn't import V2 code when copied over to V2 branch, #6361 
by @SharathHuddar
+
+## v2.0b3 (2023-06-16)
+
+Third beta pre-release of Pydantic V2
+
+See the full changelog 
[here](https://github.com/pydantic/pydantic/releases/tag/v2.0b3)
+
 ## v2.0b2 (2023-06-03)
 
 Add `from_attributes` runtime flag to `TypeAdapter.validate_python` and 
`BaseModel.model_validate`.
@@ -34,6 +53,13 @@
 
 See [this post](https://docs.pydantic.dev/blog/pydantic-v2-alpha/) for more 
details.
 
+## v1.10.10 (2023-06-30)
+
+* Add Pydantic `Json` field support to settings management, #6250 by @hramezani
+* Fixed literal validator errors for unhashable values, #6188 by @markus1978
+* Fixed bug with generics receiving forward refs, #6130 by @mark-todd
+* Update install method of FastAPI for internal tests in CI, #6117 by @Kludex
+
 ## v1.10.9 (2023-06-07)
 
 * Fix trailing zeros not ignored in Decimal validation, #5968 by @hramezani
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/docs/build/exec_examples.py 
new/pydantic-1.10.13/docs/build/exec_examples.py
--- old/pydantic-1.10.9/docs/build/exec_examples.py     2023-06-07 
17:51:36.000000000 +0200
+++ new/pydantic-1.10.13/docs/build/exec_examples.py    2023-09-27 
18:38:55.000000000 +0200
@@ -353,6 +353,9 @@
         if upgrade:
             versions.extend(populate_upgraded_versions(file, file_text, 
lowest_version))
 
+        # flush importlib caches to ensure the code we just generated is 
discovered
+        importlib.invalidate_caches()
+
         json_outputs: set[str | None] = set()
         should_run_as_is = not requirements
         final_content: list[str] = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/docs/contributing.md 
new/pydantic-1.10.13/docs/contributing.md
--- old/pydantic-1.10.9/docs/contributing.md    2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/docs/contributing.md   2023-09-27 18:38:55.000000000 
+0200
@@ -33,7 +33,7 @@
 *pydantic* has few dependencies, doesn't require compiling and tests don't 
need access to databases, etc.
 Because of this, setting up and running the tests should be very simple.
 
-You'll need to have a version between **Python 3.7 and 3.11**, **virtualenv**, 
**git**, and **make** installed.
+You'll need to have a version between **Python 3.7 and 3.11**, **virtualenv**, 
**git**, **pdm** and **make** installed.
 
 ```bash
 # 1. clone your fork and cd into the repo directory
Binary files old/pydantic-1.10.9/docs/favicon.png and 
new/pydantic-1.10.13/docs/favicon.png differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/docs/install.md 
new/pydantic-1.10.13/docs/install.md
--- old/pydantic-1.10.9/docs/install.md 2023-06-07 17:51:36.000000000 +0200
+++ new/pydantic-1.10.13/docs/install.md        2023-09-27 18:38:55.000000000 
+0200
@@ -1,7 +1,7 @@
 Installation is as simple as:
 
 ```bash
-pip install pydantic
+pip install 'pydantic<2'
 ```
 
 *pydantic* has no required dependencies except Python 3.7, 3.8, 3.9, 3.10 or 
3.11 and
@@ -12,7 +12,7 @@
 channel:
 
 ```bash
-conda install pydantic -c conda-forge
+conda install 'pydantic<2' -c conda-forge
 ```
 
 ## Compiled with Cython
@@ -36,7 +36,7 @@
 Compiled binaries can increase the size of your Python environment. If for 
some reason you want to reduce the size of your *pydantic* installation you can 
avoid installing any binaries using the [`pip 
--no-binary`](https://pip.pypa.io/en/stable/cli/pip_install/#install-no-binary) 
option. Make sure `Cython` is not in your environment, or that you have the 
`SKIP_CYTHON` environment variable set to avoid re-compiling *pydantic* 
libraries:
 
 ```bash
-SKIP_CYTHON=1 pip install --no-binary pydantic pydantic
+SKIP_CYTHON=1 pip install --no-binary pydantic pydantic<2
 ```
 !!! note
     `pydantic` is repeated here intentionally, `--no-binary pydantic` tells 
`pip` you want no binaries for pydantic,
@@ -47,7 +47,7 @@
 CFLAGS="-Os -g0 -s" pip install \
   --no-binary pydantic \
   --global-option=build_ext \
-  pydantic
+  pydantic<2
 ```
 
 ## Optional dependencies
@@ -60,11 +60,11 @@
 
 To install these along with *pydantic*:
 ```bash
-pip install pydantic[email]
+pip install 'pydantic[email]<2'
 # or
-pip install pydantic[dotenv]
+pip install 'pydantic[dotenv]<2'
 # or just
-pip install pydantic[email,dotenv]
+pip install 'pydantic[email,dotenv]<2'
 ```
 
 Of course, you can also install these requirements manually with `pip install 
email-validator` and/or `pip install python-dotenv`.
@@ -74,7 +74,7 @@
 
 And if you prefer to install *pydantic* directly from the repository:
 ```bash
-pip install git+git://github.com/pydantic/pydantic@main#egg=pydantic
+pip install git+https://github.com/pydantic/pydantic@1.10.X-fixes#egg=pydantic
 # or with extras
-pip install 
git+git://github.com/pydantic/pydantic@main#egg=pydantic[email,dotenv]
+pip install 
git+https;://github.com/pydantic/pydantic@1.10.X-fixes#egg=pydantic[email,dotenv]
 ```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/docs/logo-white.svg 
new/pydantic-1.10.13/docs/logo-white.svg
--- old/pydantic-1.10.9/docs/logo-white.svg     2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/docs/logo-white.svg    2023-09-27 18:38:55.000000000 
+0200
@@ -1,3 +1,5 @@
-<svg xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 600 600">
-  <path fill="white" d="M 300 10 A 290 290 0 0 0 10 300 A 290 290 0 0 0 300 
590 A 290 290 0 0 0 590 300 A 290 290 0 0 0 300 10 z M 109.625 143.96875 L 
486.69141 143.96875 C 504.05308 143.96875 512.73557 165.01557 500.48438 
177.26758 L 350.17188 327.59961 L 350.17188 540.56836 C 350.17187 556.42735 
332.30789 565.52791 319.48047 556.54883 L 254.46094 511.05273 C 249.24641 
507.40188 246.14062 501.43687 246.14062 495.07227 L 246.14062 327.59961 L 
95.832031 177.26758 C 83.555651 164.9912 92.299083 143.96875 109.625 143.96875 
z "/>
+<svg xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 120 120">
+  <path
+     fill="#fff"
+     d="M 119.18,86.64 98.02,57.3 c 0,0 0,0 0,0 L 63.77,9.8 c -1.74,-2.4 
-5.76,-2.4 -7.49,0 l -34.24,47.49 c 0,0 0,0 0,0 L 0.87,86.64 c -0.86,1.2 
-1.1,2.73 -0.65,4.13 0.46,1.4 1.55,2.5 2.95,2.96 l 55.41,18.14 c 0,0 0,0 
0.01,9e-4 0.46,0.15 0.94,0.23 1.43,0.23 0.49,0 0.97,-0.08 1.43,-0.23 0,0 0,0 
0.01,0 L 116.87,93.73 c 1.4,-0.46 2.5,-1.55 2.95,-2.96 0.46,-1.4 0.22,-2.93 
-0.65,-4.13 z m -59.15,-66.25 22.21,30.8 -20.77,-6.8 c -0.16,-0.05 -0.33,-0.04 
-0.49,-0.08 -0.16,-0.04 -0.32,-0.06 -0.48,-0.08 -0.16,-0.02 -0.31,-0.08 
-0.47,-0.08 -0.16,0 -0.31,0.06 -0.47,0.08 -0.17,0.02 -0.32,0.04 -0.48,0.08 
-0.16,0.03 -0.33,0.03 -0.48,0.08 h 0 l -20.64,6.76 -0.13,0.04 22.21,-30.8 z m 
-31.38,43.52 24.18,-7.92 2.58,-0.84 V 101.12 L 12.06,86.92 Z m 36,37.2 V 55.15 
l 26.76,8.76 16.59,23 z"/>
 </svg>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/docs/theme/announce.html 
new/pydantic-1.10.13/docs/theme/announce.html
--- old/pydantic-1.10.9/docs/theme/announce.html        2023-06-07 
17:51:36.000000000 +0200
+++ new/pydantic-1.10.13/docs/theme/announce.html       2023-09-27 
18:38:55.000000000 +0200
@@ -1,4 +1,3 @@
-<!-- the following line is displayed in the announce bar -->
+<!-- the following line is displayed in the announcement bar -->
 <!-- keep length under 164 characters (less HTML tags) to fit on 1280px 
desktop window -->
-<strong>Pydantic V2 alpha 1 is here:</strong>
-We're releasing the first alpha of Pydantic V2 for evaluation. Read the <a 
href="/blog/pydantic-v2-alpha/">alpha release blog post</a> for details.
+Pydantic's <a href="https://pydantic.dev/roadmap/";>commercial roadmap</a> is 
out 🚀, and we'd love to hear your feedback 📢!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/pydantic/env_settings.py 
new/pydantic-1.10.13/pydantic/env_settings.py
--- old/pydantic-1.10.9/pydantic/env_settings.py        2023-06-07 
17:51:36.000000000 +0200
+++ new/pydantic-1.10.13/pydantic/env_settings.py       2023-09-27 
18:38:55.000000000 +0200
@@ -6,8 +6,9 @@
 from .config import BaseConfig, Extra
 from .fields import ModelField
 from .main import BaseModel
+from .types import JsonWrapper
 from .typing import StrPath, display_as_type, get_origin, is_union
-from .utils import deep_update, path_type, sequence_like
+from .utils import deep_update, lenient_issubclass, path_type, sequence_like
 
 env_file_sentinel = str(object())
 
@@ -231,6 +232,9 @@
         """
         Find out if a field is complex, and if so whether JSON errors should 
be ignored
         """
+        if lenient_issubclass(field.annotation, JsonWrapper):
+            return False, False
+
         if field.is_complex():
             allow_parse_failure = False
         elif is_union(get_origin(field.type_)) and field.sub_fields and 
any(f.is_complex() for f in field.sub_fields):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/pydantic/fields.py 
new/pydantic-1.10.13/pydantic/fields.py
--- old/pydantic-1.10.9/pydantic/fields.py      2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/pydantic/fields.py     2023-09-27 18:38:55.000000000 
+0200
@@ -943,7 +943,7 @@
         elif self.shape == SHAPE_TUPLE_ELLIPSIS:
             converted = tuple(result)
         elif self.shape == SHAPE_DEQUE:
-            converted = deque(result)
+            converted = deque(result, maxlen=getattr(v, 'maxlen', None))
         elif self.shape == SHAPE_SEQUENCE:
             if isinstance(v, tuple):
                 converted = tuple(result)
@@ -952,7 +952,7 @@
             elif isinstance(v, Generator):
                 converted = iter(result)
             elif isinstance(v, deque):
-                converted = deque(result)
+                converted = deque(result, maxlen=getattr(v, 'maxlen', None))
         return converted, None
 
     def _validate_iterable(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/pydantic/generics.py 
new/pydantic-1.10.13/pydantic/generics.py
--- old/pydantic-1.10.9/pydantic/generics.py    2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/pydantic/generics.py   2023-09-27 18:38:55.000000000 
+0200
@@ -6,6 +6,7 @@
     Any,
     ClassVar,
     Dict,
+    ForwardRef,
     Generic,
     Iterator,
     List,
@@ -19,7 +20,7 @@
 )
 from weakref import WeakKeyDictionary, WeakValueDictionary
 
-from typing_extensions import Annotated
+from typing_extensions import Annotated, Literal as ExtLiteral
 
 from .class_validators import gather_all_validators
 from .fields import DeferredType
@@ -30,6 +31,8 @@
 
 if sys.version_info >= (3, 10):
     from typing import _UnionGenericAlias
+if sys.version_info >= (3, 8):
+    from typing import Literal
 
 GenericModelT = TypeVar('GenericModelT', bound='GenericModel')
 TypeVarType = Any  # since mypy doesn't allow the use of TypeVar as a type
@@ -267,6 +270,8 @@
         annotated_type, *annotations = type_args
         return Annotated[replace_types(annotated_type, type_map), 
tuple(annotations)]
 
+    if (origin_type is ExtLiteral) or (sys.version_info >= (3, 8) and 
origin_type is Literal):
+        return type_map.get(type_, type_)
     # Having type args is a good indicator that this is a typing module
     # class instantiation or a generic alias of some sort.
     if type_args:
@@ -317,7 +322,12 @@
 
     # If all else fails, we try to resolve the type directly and otherwise just
     # return the input with no modifications.
-    return type_map.get(type_, type_)
+    new_type = type_map.get(type_, type_)
+    # Convert string to ForwardRef
+    if isinstance(new_type, str):
+        return ForwardRef(new_type)
+    else:
+        return new_type
 
 
 def check_parameters_count(cls: Type[GenericModel], parameters: Tuple[Any, 
...]) -> None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/pydantic/mypy.py 
new/pydantic-1.10.13/pydantic/mypy.py
--- old/pydantic-1.10.9/pydantic/mypy.py        2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/pydantic/mypy.py       2023-09-27 18:38:55.000000000 
+0200
@@ -75,11 +75,12 @@
 
 CONFIGFILE_KEY = 'pydantic-mypy'
 METADATA_KEY = 'pydantic-mypy-metadata'
-BASEMODEL_FULLNAME = 'pydantic.main.BaseModel'
-BASESETTINGS_FULLNAME = 'pydantic.env_settings.BaseSettings'
-MODEL_METACLASS_FULLNAME = 'pydantic.main.ModelMetaclass'
-FIELD_FULLNAME = 'pydantic.fields.Field'
-DATACLASS_FULLNAME = 'pydantic.dataclasses.dataclass'
+_NAMESPACE = __name__[:-5]  # 'pydantic' in 1.10.X, 'pydantic.v1' in v2.X
+BASEMODEL_FULLNAME = f'{_NAMESPACE}.main.BaseModel'
+BASESETTINGS_FULLNAME = f'{_NAMESPACE}.env_settings.BaseSettings'
+MODEL_METACLASS_FULLNAME = f'{_NAMESPACE}.main.ModelMetaclass'
+FIELD_FULLNAME = f'{_NAMESPACE}.fields.Field'
+DATACLASS_FULLNAME = f'{_NAMESPACE}.dataclasses.dataclass'
 
 
 def parse_mypy_version(version: str) -> Tuple[int, ...]:
@@ -335,7 +336,7 @@
                 if (
                     isinstance(first_dec, CallExpr)
                     and isinstance(first_dec.callee, NameExpr)
-                    and first_dec.callee.fullname == 
'pydantic.class_validators.validator'
+                    and first_dec.callee.fullname == 
f'{_NAMESPACE}.class_validators.validator'
                 ):
                     sym.node.func.is_class = True
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/pydantic/networks.py 
new/pydantic-1.10.13/pydantic/networks.py
--- old/pydantic-1.10.9/pydantic/networks.py    2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/pydantic/networks.py   2023-09-27 18:38:55.000000000 
+0200
@@ -702,6 +702,10 @@
 
 
 pretty_email_regex = re.compile(r'([\w ]*?) *<(.*)> *')
+MAX_EMAIL_LENGTH = 2048
+"""Maximum length for an email.
+A somewhat arbitrary but very generous number compared to what is allowed by 
most implementations.
+"""
 
 
 def validate_email(value: Union[str]) -> Tuple[str, str]:
@@ -714,6 +718,10 @@
     """
     if email_validator is None:
         import_email_validator()
+
+    if len(value) > MAX_EMAIL_LENGTH:
+        raise errors.EmailError()
+
     m = pretty_email_regex.fullmatch(value)
     name: Union[str, None] = None
     if m:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/pydantic/tools.py 
new/pydantic-1.10.13/pydantic/tools.py
--- old/pydantic-1.10.9/pydantic/tools.py       2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/pydantic/tools.py      2023-09-27 18:38:55.000000000 
+0200
@@ -21,7 +21,7 @@
 
 @lru_cache(maxsize=2048)
 def _get_parsing_type(type_: Any, *, type_name: Optional[NameFactory] = None) 
-> Any:
-    from pydantic.main import create_model
+    from .main import create_model
 
     if type_name is None:
         type_name = _generate_parsing_type_name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/pydantic/validators.py 
new/pydantic-1.10.13/pydantic/validators.py
--- old/pydantic-1.10.9/pydantic/validators.py  2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/pydantic/validators.py 2023-09-27 18:38:55.000000000 
+0200
@@ -488,7 +488,7 @@
     def literal_validator(v: Any) -> Any:
         try:
             return allowed_choices[v]
-        except KeyError:
+        except (KeyError, TypeError):
             raise errors.WrongConstantError(given=v, 
permitted=permitted_choices)
 
     return literal_validator
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/pydantic/version.py 
new/pydantic-1.10.13/pydantic/version.py
--- old/pydantic-1.10.9/pydantic/version.py     2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/pydantic/version.py    2023-09-27 18:38:55.000000000 
+0200
@@ -1,6 +1,6 @@
 __all__ = 'compiled', 'VERSION', 'version_info'
 
-VERSION = '1.10.9'
+VERSION = '1.10.13'
 
 try:
     import cython  # type: ignore
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/tests/test_fastapi.sh 
new/pydantic-1.10.13/tests/test_fastapi.sh
--- old/pydantic-1.10.9/tests/test_fastapi.sh   2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/tests/test_fastapi.sh  2023-09-27 18:38:55.000000000 
+0200
@@ -5,10 +5,8 @@
 
 cd fastapi
 git fetch --tags
-latest_tag_commit=$(git rev-list --tags --max-count=1)
-latest_tag=$(git describe --tags "${latest_tag_commit}")
-git checkout "${latest_tag}"
+git checkout 0.99.1
 
-pip install .[all,dev,doc,test]
+pip install -r requirements.txt
 
 ./scripts/test.sh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/tests/test_networks.py 
new/pydantic-1.10.13/tests/test_networks.py
--- old/pydantic-1.10.9/tests/test_networks.py  2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/tests/test_networks.py 2023-09-27 18:38:55.000000000 
+0200
@@ -789,6 +789,7 @@
         '\"@example.com',
         ',@example.com',
         'foobar <foobar<@example.com>',
+        'foobar <' + 'a' * 4096 + '@example.com>',
     ],
 )
 def test_address_invalid(value):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/tests/test_settings.py 
new/pydantic-1.10.13/tests/test_settings.py
--- old/pydantic-1.10.9/tests/test_settings.py  2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/tests/test_settings.py 2023-09-27 18:38:55.000000000 
+0200
@@ -7,7 +7,7 @@
 
 import pytest
 
-from pydantic import BaseModel, BaseSettings, Field, HttpUrl, NoneStr, 
SecretStr, ValidationError, dataclasses
+from pydantic import BaseModel, BaseSettings, Field, HttpUrl, Json, NoneStr, 
SecretStr, ValidationError, dataclasses
 from pydantic.env_settings import (
     EnvSettingsSource,
     InitSettingsSource,
@@ -1278,3 +1278,35 @@
 
     s = Settings()
     assert s.top == {1: 'apple', 2: 'banana'}
+
+
+def test_env_json_field(env):
+    class Settings(BaseSettings):
+        x: Json
+
+    env.set('x', '{"foo": "bar"}')
+
+    s = Settings()
+    assert s.x == {'foo': 'bar'}
+
+    env.set('x', 'test')
+    with pytest.raises(ValidationError) as exc_info:
+        Settings()
+    assert exc_info.value.errors() == [{'loc': ('x',), 'msg': 'Invalid JSON', 
'type': 'value_error.json'}]
+
+
+def test_env_json_field_dict(env):
+    class Settings(BaseSettings):
+        x: Json[Dict[str, int]]
+
+    env.set('x', '{"foo": 1}')
+
+    s = Settings()
+    assert s.x == {'foo': 1}
+
+    env.set('x', '{"foo": "bar"}')
+    with pytest.raises(ValidationError) as exc_info:
+        Settings()
+    assert exc_info.value.errors() == [
+        {'loc': ('x', 'foo'), 'msg': 'value is not a valid integer', 'type': 
'type_error.integer'}
+    ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/tests/test_types.py 
new/pydantic-1.10.13/tests/test_types.py
--- old/pydantic-1.10.9/tests/test_types.py     2023-06-07 17:51:36.000000000 
+0200
+++ new/pydantic-1.10.13/tests/test_types.py    2023-09-27 18:38:55.000000000 
+0200
@@ -3123,6 +3123,25 @@
     assert Model(v=value).v == result
 
 
+def test_deque_maxlen():
+    class DequeTypedModel(BaseModel):
+        field: Deque[int] = deque(maxlen=10)
+
+    assert DequeTypedModel(field=deque(maxlen=25)).field.maxlen == 25
+    assert DequeTypedModel().field.maxlen == 10
+
+    class DequeUnTypedModel(BaseModel):
+        field: deque = deque(maxlen=10)
+
+    assert DequeUnTypedModel(field=deque(maxlen=25)).field.maxlen == 25
+    assert DequeTypedModel().field.maxlen == 10
+
+    class DeuqueNoDefaultModel(BaseModel):
+        field: deque
+
+    assert DeuqueNoDefaultModel(field=deque(maxlen=25)).field.maxlen == 25
+
+
 @pytest.mark.parametrize(
     'cls,value,errors',
     (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pydantic-1.10.9/tests/test_validators.py 
new/pydantic-1.10.13/tests/test_validators.py
--- old/pydantic-1.10.9/tests/test_validators.py        2023-06-07 
17:51:36.000000000 +0200
+++ new/pydantic-1.10.13/tests/test_validators.py       2023-09-27 
18:38:55.000000000 +0200
@@ -1189,6 +1189,24 @@
     ]
 
 
+def test_literal_validator_non_str_value():
+    class Model(BaseModel):
+        a: Literal['foo']
+
+    Model(a='foo')
+
+    with pytest.raises(ValidationError) as exc_info:
+        Model(a={'bar': 'foo'})
+    assert exc_info.value.errors() == [
+        {
+            'loc': ('a',),
+            'msg': "unexpected value; permitted: 'foo'",
+            'type': 'value_error.const',
+            'ctx': {'given': {'bar': 'foo'}, 'permitted': ('foo',)},
+        }
+    ]
+
+
 def test_literal_validator_str_enum():
     class Bar(str, Enum):
         FIZ = 'fiz'

Reply via email to