Repository: samuelcolvin/pydantic (python)

Issue:
Pattern type serialisation error
### Checks

* [X] I added a descriptive title to this issue
* [X] I have searched (google, github) for similar issues and couldn't find anything
* [X] I have read and followed [the docs](https://pydantic-docs.helpmanual.io/) and still think this is a bug

<!-- Sorry to sound so draconian, but every second saved replying to issues is time spend improving pydantic :-) -->

# Bug

Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`:
```
             pydantic version: 1.7
            pydantic compiled: True
                 install path: /root/.local/lib/python3.8/site-packages/pydantic
               python version: 3.8.6 (default, Oct 13 2020, 20:49:19)  [GCC 8.3.0]
                     platform: Linux-3.10.0-1127.19.1.el7.x86_64-x86_64-with-glibc2.2.5
     optional deps. installed: ['email-validator']
```
<!-- or if you're using pydantic prior to v1.3, manually include: OS, python version and pydantic version -->

<!-- Please read the [docs](https://pydantic-docs.helpmanual.io/) and search through issues to
confirm your bug hasn't already been reported. -->

<!-- Where possible please include a self-contained code snippet describing your bug: -->

```py
from typing import Pattern
from pydantic import BaseModel

class Model(BaseModel):
    filter: Pattern

Model(filter="^regex$").json()
```

This produce an error : 
TypeError: Object of type 'Pattern' is not JSON serializable

I had to write a custom encoder to be able to serialize properly a Pattern type : 

```py
from typing import Pattern
from pydantic import BaseModel
import re

class Model(BaseModel):
    filter: Pattern
    class Config:
        json_encoders = {
            re.Pattern: lambda v: v.pattern,
        }

Model(filter="^regex$").json()
```

Pull request:
feat: add default encoder for `Pattern` type
<!-- Thank you for your contribution! -->
<!-- Unless your change is trivial, please create an issue to discuss the change before creating a PR -->
<!-- See https://pydantic-docs.helpmanual.io/contributing/ for help on Contributing -->

## Change Summary
As we allow `Pattern` to be used as a regular type and considering we now support `Pattern` when generating
schema (#1768) it makes sense to also add a default encoder for it

## Related issue number
closes #2045

## Checklist

* [ ] Unit tests for the changes exist
* [ ] Tests pass on CI and coverage remains at 100%
* [ ] Documentation reflects the changes where applicable
* [ ] `changes/<pull request or issue id>-<github username>.md` file added describing change
  (see [changes/README.md](https://github.com/samuelcolvin/pydantic/blob/master/changes/README.md) for details)


Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b411771f7..b9630e829 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -72,7 +72,7 @@ jobs:
       run: make test
 
     - run: coverage xml
-    - uses: codecov/codecov-action@v1.0.13
+    - uses: codecov/codecov-action@v1.0.14
       with:
         file: ./coverage.xml
         env_vars: COMPILED,DEPS,PYTHON,OS
@@ -87,7 +87,7 @@ jobs:
       run: make test
 
     - run: coverage xml
-    - uses: codecov/codecov-action@v1.0.13
+    - uses: codecov/codecov-action@v1.0.14
       with:
         file: ./coverage.xml
         env_vars: COMPILED,DEPS,PYTHON,OS
@@ -105,7 +105,7 @@ jobs:
       run: make test
 
     - run: coverage xml
-    - uses: codecov/codecov-action@v1.0.13
+    - uses: codecov/codecov-action@v1.0.14
       with:
         file: ./coverage.xml
         env_vars: COMPILED,DEPS,PYTHON,OS
@@ -143,7 +143,7 @@ jobs:
 
     - run: coverage xml
 
-    - uses: codecov/codecov-action@v1.0.13
+    - uses: codecov/codecov-action@v1.0.14
       with:
         file: ./coverage.xml
         env_vars: COMPILED,DEPS,PYTHON,OS
diff --git a/HISTORY.md b/HISTORY.md
index 0a1ec2a9f..692c8e2c2 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,3 +1,22 @@
+## v1.7.2 (2020-11-01)
+
+* fix slow `GenericModel` concrete model creation, allow `GenericModel` concrete name reusing in module, #2078 by @MrMrRobat
+* keep the order of the fields when `validate_assignment` is set, #2073 by @PrettyWood
+* forward all the params of the stdlib `dataclass` when converted into _pydantic_ `dataclass`, #2065 by @PrettyWood
+
+## v1.7.1 (2020-10-28)
+
+Thank you to pydantic's sponsors:
+@timdrijvers, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @jorgecarleitao, @koxudaxi, @primer-api, @mkeen
+for their kind support.
+
+* fix annotation of `validate_arguments` when passing configuration as argument, #2055 by @layday
+* Fix mypy assignment error when using `PrivateAttr`, #2048 by @aphedges
+* fix `underscore_attrs_are_private` causing `TypeError` when overriding `__init__`, #2047 by @samuelcolvin
+* Fixed regression introduced in v1.7 involving exception handling in field validators when `validate_assignment=True`, #2044 by @johnsabath
+* fix: _pydantic_ `dataclass` can inherit from stdlib `dataclass`
+  and `Config.arbitrary_types_allowed` is supported, #2042 by @PrettyWood
+
 ## v1.7 (2020-10-26)
 
 Thank you to pydantic's sponsors:
diff --git a/Makefile b/Makefile
index 8aa686f4b..cc5d66bcb 100644
--- a/Makefile
+++ b/Makefile
@@ -134,5 +134,5 @@ docs-serve:
 .PHONY: publish-docs
 publish-docs:
 	zip -r site.zip site
-	@curl -f -H "Content-Type: application/zip" -H "Authorization: Bearer ${NETLIFY}" \
+	@curl -H "Content-Type: application/zip" -H "Authorization: Bearer ${NETLIFY}" \
 	      --data-binary "@site.zip" https://api.netlify.com/api/v1/sites/pydantic-docs.netlify.com/deploys
diff --git a/changes/1975-mdavis-xyz.md b/changes/1975-mdavis-xyz.md
new file mode 100644
index 000000000..82cf2eb29
--- /dev/null
+++ b/changes/1975-mdavis-xyz.md
@@ -0,0 +1,1 @@
+Add `NonNegativeInt`, `NonPositiveInt`, `NonNegativeFloat`, `NonPositiveFloat`
diff --git a/changes/2045-PrettyWood.md b/changes/2045-PrettyWood.md
new file mode 100644
index 000000000..1fdf47c1e
--- /dev/null
+++ b/changes/2045-PrettyWood.md
@@ -0,0 +1,1 @@
+add default encoder for `Pattern` type
\ No newline at end of file
diff --git a/changes/2090-PrettyWood.md b/changes/2090-PrettyWood.md
new file mode 100644
index 000000000..2e2e56f55
--- /dev/null
+++ b/changes/2090-PrettyWood.md
@@ -0,0 +1,1 @@
+Ignore `__doc__` as private attribute when `Config.underscore_attrs_are_private` is set
\ No newline at end of file
diff --git a/docs/build/schema_mapping.py b/docs/build/schema_mapping.py
index f9731c0a0..578172746 100755
--- a/docs/build/schema_mapping.py
+++ b/docs/build/schema_mapping.py
@@ -382,6 +382,20 @@ table = [
         'JSON Schema Validation',
         ''
     ],
+    [
+        'NonNegativeInt',
+        'integer',
+        {'minimum': 0},
+        'JSON Schema Validation',
+        ''
+    ],
+    [
+        'NonPositiveInt',
+        'integer',
+        {'maximum': 0},
+        'JSON Schema Validation',
+        ''
+    ],
     [
         'ConstrainedFloat',
         'number',
@@ -413,6 +427,20 @@ table = [
         'JSON Schema Validation',
         ''
     ],
+    [
+        'NonNegativeFloat',
+        'number',
+        {'minimum': 0},
+        'JSON Schema Validation',
+        ''
+    ],
+    [
+        'NonPositiveFloat',
+        'number',
+        {'maximum': 0},
+        'JSON Schema Validation',
+        ''
+    ],
     [
         'ConstrainedDecimal',
         'number',
diff --git a/docs/datamodel_code_generator.md b/docs/datamodel_code_generator.md
index d96a11c28..dec9cbcb5 100644
--- a/docs/datamodel_code_generator.md
+++ b/docs/datamodel_code_generator.md
@@ -1,18 +1,18 @@
-[datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator/) is a command to generate pydantic models from other data types.
+The [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator/) project is a library and command-line utility to generate pydantic models from just about any data source, including:
 
+* OpenAPI 3 (YAML/JSON)
+* JSON Schema
+* JSON/YAML Data (which will converted to JSON Schema)
 
-* Supported source types
-    * OpenAPI 3 (YAML/JSON)
-    * JSON Schema
-    * JSON/YAML Data (It will be converted to JSON Schema)
+Whenever you find yourself with any data convertible JSON but without pydantic models, this tool will allow you to generate type-safe model hierarchies on demand.
 
-## Install
+## Installation
 ```bash
 pip install datamodel-code-generator
 ```
 
 ## Example
-In this case, The datamodel-code-generator creates pydantic models from JSON Schema.
+In this case, datamodel-code-generator creates pydantic models from a JSON Schema file.
 ```bash
 datamodel-codegen  --input person.json --input-file-type jsonschema --output model.py
 ```
diff --git a/docs/examples/dataclasses_arbitrary_types_allowed.py b/docs/examples/dataclasses_arbitrary_types_allowed.py
new file mode 100644
index 000000000..8a4f5597a
--- /dev/null
+++ b/docs/examples/dataclasses_arbitrary_types_allowed.py
@@ -0,0 +1,42 @@
+import dataclasses
+
+import pydantic
+
+
+class ArbitraryType:
+    def __init__(self, value):
+        self.value = value
+
+    def __repr__(self):
+        return f'ArbitraryType(value={self.value!r})'
+
+
+@dataclasses.dataclass
+class DC:
+    a: ArbitraryType
+    b: str
+
+
+# valid as it is a builtin dataclass without validation
+my_dc = DC(a=ArbitraryType(value=3), b='qwe')
+
+try:
+    class Model(pydantic.BaseModel):
+        dc: DC
+        other: str
+
+    Model(dc=my_dc, other='other')
+except RuntimeError as e:  # invalid as it is now a pydantic dataclass
+    print(e)
+
+
+class Model(pydantic.BaseModel):
+    dc: DC
+    other: str
+
+    class Config:
+        arbitrary_types_allowed = True
+
+
+m = Model(dc=my_dc, other='other')
+print(repr(m))
diff --git a/docs/examples/dataclasses_stdlib_inheritance.py b/docs/examples/dataclasses_stdlib_inheritance.py
new file mode 100644
index 000000000..0409b4696
--- /dev/null
+++ b/docs/examples/dataclasses_stdlib_inheritance.py
@@ -0,0 +1,27 @@
+import dataclasses
+
+import pydantic
+
+
+@dataclasses.dataclass
+class Z:
+    z: int
+
+
+@dataclasses.dataclass
+class Y(Z):
+    y: int = 0
+
+
+@pydantic.dataclasses.dataclass
+class X(Y):
+    x: int = 0
+
+
+foo = X(x=b'1', y='2', z='3')
+print(foo)
+
+try:
+    X(z='pika')
+except pydantic.ValidationError as e:
+    print(e)
diff --git a/docs/examples/dataclasses_stdlib_with_basemodel.py b/docs/examples/dataclasses_stdlib_with_basemodel.py
index 35ff1e883..92b494891 100644
--- a/docs/examples/dataclasses_stdlib_with_basemodel.py
+++ b/docs/examples/dataclasses_stdlib_with_basemodel.py
@@ -5,14 +5,20 @@ from typing import Optional
 from pydantic import BaseModel, ValidationError
 
 
+@dataclasses.dataclass(frozen=True)
+class User:
+    name: str
+
+
 @dataclasses.dataclass
 class File:
     filename: str
-    last_modification_time: Optional[datetime]
+    last_modification_time: Optional[datetime] = None
 
 
 class Foo(BaseModel):
     file: File
+    user: Optional[User] = None
 
 
 file = File(
@@ -25,3 +31,9 @@ try:
     Foo(file=file)
 except ValidationError as e:
     print(e)
+
+foo = Foo(file=File(filename='myfile'), user=User(name='pika'))
+try:
+    foo.user.name = 'bulbi'
+except dataclasses.FrozenInstanceError as e:
+    print(e)
diff --git a/docs/examples/types_constrained.py b/docs/examples/types_constrained.py
index c97fe24ae..53addddb1 100644
--- a/docs/examples/types_constrained.py
+++ b/docs/examples/types_constrained.py
@@ -6,6 +6,10 @@ from pydantic import (
     NegativeInt,
     PositiveFloat,
     PositiveInt,
+    NonNegativeFloat,
+    NonNegativeInt,
+    NonPositiveFloat,
+    NonPositiveInt,
     conbytes,
     condecimal,
     confloat,
@@ -29,12 +33,16 @@ class Model(BaseModel):
     mod_int: conint(multiple_of=5)
     pos_int: PositiveInt
     neg_int: NegativeInt
+    non_neg_int: NonNegativeInt
+    non_pos_int: NonPositiveInt
 
     big_float: confloat(gt=1000, lt=1024)
     unit_interval: confloat(ge=0, le=1)
     mod_float: confloat(multiple_of=0.5)
     pos_float: PositiveFloat
     neg_float: NegativeFloat
+    non_neg_float: NonNegativeFloat
+    non_pos_float: NonPositiveFloat
 
     short_list: conlist(int, min_items=1, max_items=4)
     short_set: conset(int, min_items=1, max_items=4)
diff --git a/docs/usage/dataclasses.md b/docs/usage/dataclasses.md
index 5f56b5882..536d91205 100644
--- a/docs/usage/dataclasses.md
+++ b/docs/usage/dataclasses.md
@@ -49,6 +49,8 @@ Dataclasses attributes can be populated by tuples, dictionaries or instances of
 
 ## Stdlib dataclasses and _pydantic_ dataclasses
 
+### Convert stdlib dataclasses into _pydantic_ dataclasses
+
 Stdlib dataclasses (nested or not) can be easily converted into _pydantic_ dataclasses by just decorating
 them with `pydantic.dataclasses.dataclass`.
 
@@ -57,14 +59,38 @@ them with `pydantic.dataclasses.dataclass`.
 ```
 _(This script is complete, it should run "as is")_
 
-Bear in mind that stdlib dataclasses (nested or not) are **automatically converted** into _pydantic_ dataclasses
-when mixed with `BaseModel`!
+### Inherit from stdlib dataclasses
+
+Stdlib dataclasses (nested or not) can also be inherited and _pydantic_ will automatically validate
+all the inherited fields.
+
+```py
+{!.tmp_examples/dataclasses_stdlib_inheritance.py!}
+```
+_(This script is complete, it should run "as is")_
+
+### Use of stdlib dataclasses with `BaseModel`
+
+Bear in mind that stdlib dataclasses (nested or not) are **automatically converted** into _pydantic_
+dataclasses when mixed with `BaseModel`! Furthermore the generated _pydantic_ dataclass will have
+the **exact same configuration** (`order`, `frozen`, ...) as the original one.
 
 ```py
 {!.tmp_examples/dataclasses_stdlib_with_basemodel.py!}
 ```
 _(This script is complete, it should run "as is")_
 
+### Use custom types
+
+Since stdlib dataclasses are automatically converted to add validation using
+custom types may cause some unexpected behaviour.
+In this case you can simply add `arbitrary_types_allowed` in the config!
+
+```py
+{!.tmp_examples/dataclasses_arbitrary_types_allowed.py!}
+```
+_(This script is complete, it should run "as is")_
+
 ## Initialize hooks
 
 When you initialize a dataclass, it is possible to execute code *after* validation
diff --git a/docs/usage/settings.md b/docs/usage/settings.md
index a06ea52d4..9f9c50580 100644
--- a/docs/usage/settings.md
+++ b/docs/usage/settings.md
@@ -135,7 +135,7 @@ Placing secret values in files is a common pattern to provide sensitive configur
 A secret file follows the same principal as a dotenv file except it only contains a single value and the file name 
 is used as the key. A secret file will look like the following:
 
-`/var/run/db_password`:
+`/var/run/database_password`:
 ```
 super_secret_database_password
 ```
diff --git a/pydantic/__init__.py b/pydantic/__init__.py
index 5cfc0583f..7b8a609b6 100644
--- a/pydantic/__init__.py
+++ b/pydantic/__init__.py
@@ -76,10 +76,14 @@ __all__ = [
     'conint',
     'PositiveInt',
     'NegativeInt',
+    'NonNegativeInt',
+    'NonPositiveInt',
     'ConstrainedFloat',
     'confloat',
     'PositiveFloat',
     'NegativeFloat',
+    'NonNegativeFloat',
+    'NonPositiveFloat',
     'ConstrainedDecimal',
     'condecimal',
     'UUID1',
diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py
index 4fbdd63fc..0d28e1b20 100644
--- a/pydantic/dataclasses.py
+++ b/pydantic/dataclasses.py
@@ -8,7 +8,7 @@ from .main import create_model, validate_model
 from .utils import ClassAttribute
 
 if TYPE_CHECKING:
-    from .main import BaseModel  # noqa: F401
+    from .main import BaseConfig, BaseModel  # noqa: F401
     from .typing import CallableGenerator
 
     DataclassT = TypeVar('DataclassT', bound='Dataclass')
@@ -120,7 +120,9 @@ def _process_class(
     # ```
     # with the exact same fields as the base dataclass
     if is_builtin_dataclass(_cls):
-        _cls = type(_cls.__name__, (_cls,), {'__post_init__': _pydantic_post_init})
+        _cls = type(
+            _cls.__name__, (_cls,), {'__annotations__': _cls.__annotations__, '__post_init__': _pydantic_post_init}
+        )
     else:
         _cls.__post_init__ = _pydantic_post_init
     cls: Type['Dataclass'] = dataclasses.dataclass(  # type: ignore
@@ -214,10 +216,13 @@ def dataclass(
     return wrap(_cls)
 
 
-def make_dataclass_validator(_cls: Type[Any], **kwargs: Any) -> 'CallableGenerator':
+def make_dataclass_validator(_cls: Type[Any], config: Type['BaseConfig']) -> 'CallableGenerator':
     """
     Create a pydantic.dataclass from a builtin dataclass to add type validation
     and yield the validators
+    It retrieves the parameters of the dataclass and forwards them to the newly created dataclass
     """
-    cls = dataclass(_cls, **kwargs)
+    dataclass_params = _cls.__dataclass_params__
+    stdlib_dataclass_parameters = {param: getattr(dataclass_params, param) for param in dataclass_params.__slots__}
+    cls = dataclass(_cls, config=config, **stdlib_dataclass_parameters)
     yield from _get_validators(cls)
diff --git a/pydantic/decorator.py b/pydantic/decorator.py
index 589baaaca..0d7ca8822 100644
--- a/pydantic/decorator.py
+++ b/pydantic/decorator.py
@@ -1,5 +1,19 @@
 from functools import wraps
-from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Tuple, Type, TypeVar, Union, cast, get_type_hints
+from typing import (
+    TYPE_CHECKING,
+    Any,
+    Callable,
+    Dict,
+    List,
+    Mapping,
+    Optional,
+    Tuple,
+    Type,
+    TypeVar,
+    Union,
+    get_type_hints,
+    overload,
+)
 
 from . import validator
 from .errors import ConfigError
@@ -11,16 +25,26 @@ __all__ = ('validate_arguments',)
 if TYPE_CHECKING:
     from .typing import AnyCallable
 
-    Callable = TypeVar('Callable', bound=AnyCallable)
+    AnyCallableT = TypeVar('AnyCallableT', bound=AnyCallable)
     ConfigType = Union[None, Type[Any], Dict[str, Any]]
 
 
-def validate_arguments(func: 'Callable' = None, *, config: 'ConfigType' = None) -> 'Callable':
+@overload
+def validate_arguments(func: None = None, *, config: 'ConfigType' = None) -> Callable[['AnyCallableT'], 'AnyCallableT']:
+    ...
+
+
+@overload
+def validate_arguments(func: 'AnyCallableT') -> 'AnyCallableT':
+    ...
+
+
+def validate_arguments(func: Optional['AnyCallableT'] = None, *, config: 'ConfigType' = None) -> Any:
     """
     Decorator to validate the arguments passed to a function.
     """
 
-    def validate(_func: 'Callable') -> 'Callable':
+    def validate(_func: 'AnyCallable') -> 'AnyCallable':
         vd = ValidatedFunction(_func, config)
 
         @wraps(_func)
@@ -30,12 +54,12 @@ def validate_arguments(func: 'Callable' = None, *, config: 'ConfigType' = None)
         wrapper_function.vd = vd  # type: ignore
         wrapper_function.raw_function = vd.raw_function  # type: ignore
         wrapper_function.model = vd.model  # type: ignore
-        return cast('Callable', wrapper_function)
+        return wrapper_function
 
     if func:
         return validate(func)
     else:
-        return cast('Callable', validate)
+        return validate
 
 
 ALT_V_ARGS = 'v__args'
@@ -44,7 +68,7 @@ V_POSITIONAL_ONLY_NAME = 'v__positional_only'
 
 
 class ValidatedFunction:
-    def __init__(self, function: 'Callable', config: 'ConfigType'):  # noqa C901
+    def __init__(self, function: 'AnyCallableT', config: 'ConfigType'):  # noqa C901
         from inspect import Parameter, signature
 
         parameters: Mapping[str, Parameter] = signature(function).parameters
diff --git a/pydantic/fields.py b/pydantic/fields.py
index c451770c0..36ea690a2 100644
--- a/pydantic/fields.py
+++ b/pydantic/fields.py
@@ -799,21 +799,10 @@ class ModelField(Representation):
         return args
 
 
-class PrivateAttr(Representation):
-    """
-    Indicates that attribute is only used internally and never mixed with regular fields.
-
-    Types or values of private attrs are not checked by pydantic and it's up to you to keep them relevant.
-
-    Private attrs are stored in model __slots__.
-    """
-
+class ModelPrivateAttr(Representation):
     __slots__ = ('default', 'default_factory')
 
     def __init__(self, default: Any = Undefined, *, default_factory: Optional[NoArgAnyCallable] = None) -> None:
-        if default is not Undefined and default_factory is not None:
-            raise TypeError('default and default_factory args can not be used together')
-
         self.default = default
         self.default_factory = default_factory
 
@@ -825,3 +814,28 @@ class PrivateAttr(Representation):
             other.default,
             other.default_factory,
         )
+
+
+def PrivateAttr(
+    default: Any = Undefined,
+    *,
+    default_factory: Optional[NoArgAnyCallable] = None,
+) -> Any:
+    """
+    Indicates that attribute is only used internally and never mixed with regular fields.
+
+    Types or values of private attrs are not checked by pydantic and it's up to you to keep them relevant.
+
+    Private attrs are stored in model __slots__.
+
+    :param default: the attribute’s default value
+    :param default_factory: callable that will be called when a default value is needed for this attribute
+      If both `default` and `default_factory` are set, an error is raised.
+    """
+    if default is not Undefined and default_factory is not None:
+        raise ValueError('cannot specify both default and default_factory')
+
+    return ModelPrivateAttr(
+        default,
+        default_factory=default_factory,
+    )
diff --git a/pydantic/generics.py b/pydantic/generics.py
index 852cc545f..76be7599b 100644
--- a/pydantic/generics.py
+++ b/pydantic/generics.py
@@ -1,9 +1,7 @@
 import sys
-from types import FrameType, ModuleType
 from typing import (
     TYPE_CHECKING,
     Any,
-    Callable,
     ClassVar,
     Dict,
     Generic,
@@ -62,12 +60,12 @@ class GenericModel(BaseModel):
         model_name = cls.__concrete_name__(params)
         validators = gather_all_validators(cls)
         fields = _build_generic_fields(cls.__fields__, concrete_type_hints, typevars_map)
-        model_module = get_caller_module_name() or cls.__module__
+        model_module, called_globally = get_caller_frame_info()
         created_model = cast(
             Type[GenericModel],  # casting ensures mypy is aware of the __concrete__ and __parameters__ attributes
             create_model(
                 model_name,
-                __module__=model_module,
+                __module__=model_module or cls.__module__,
                 __base__=cls,
                 __config__=None,
                 __validators__=validators,
@@ -75,13 +73,13 @@ class GenericModel(BaseModel):
             ),
         )
 
-        if is_call_from_module():  # create global reference and therefore allow pickling
-            object_in_module = sys.modules[model_module].__dict__.setdefault(model_name, created_model)
-            if object_in_module is not created_model:
-                # this should not ever happen because of _generic_types_cache, but just in case
-                raise TypeError(f'{model_name!r} already defined above, please consider reusing it') from NameError(
-                    f'Name conflict: {model_name!r} in {model_module!r} is already used by {object_in_module!r}'
-                )
+        if called_globally:  # create global reference and therefore allow pickling
+            object_by_reference = None
+            reference_name = model_name
+            reference_module_globals = sys.modules[created_model.__module__].__dict__
+            while object_by_reference is not created_model:
+                object_by_reference = reference_module_globals.setdefault(reference_name, created_model)
+                reference_name += '_'
 
         created_model.Config = cls.Config
         concrete = all(not _is_typevar(v) for v in concrete_type_hints.values())
@@ -143,34 +141,19 @@ def _is_typevar(v: Any) -> bool:
     return isinstance(v, TypeVar)
 
 
-def get_caller_module_name() -> Optional[str]:
-    """
-    Used inside a function to get its caller module name
-
-    Will only work against non-compiled code, therefore used only in pydantic.generics
-    """
-    import inspect
-
-    try:
-        previous_caller_frame = inspect.stack()[2].frame
-    except IndexError as e:
-        raise RuntimeError('This function must be used inside another function') from e
-
-    getmodule = cast(Callable[[FrameType, str], Optional[ModuleType]], inspect.getmodule)
-    previous_caller_module = getmodule(previous_caller_frame, previous_caller_frame.f_code.co_filename)
-    return previous_caller_module.__name__ if previous_caller_module is not None else None
-
-
-def is_call_from_module() -> bool:
+def get_caller_frame_info() -> Tuple[Optional[str], bool]:
     """
     Used inside a function to check whether it was called globally
 
     Will only work against non-compiled code, therefore used only in pydantic.generics
-    """
-    import inspect
 
+    :returns Tuple[module_name, called_globally]
+    """
     try:
-        previous_caller_frame = inspect.stack()[2].frame
-    except IndexError as e:
+        previous_caller_frame = sys._getframe(2)
+    except ValueError as e:
         raise RuntimeError('This function must be used inside another function') from e
-    return previous_caller_frame.f_locals is previous_caller_frame.f_globals
+    except AttributeError:  # sys module does not have _getframe function, so there's nothing we can do about it
+        return None, False
+    frame_globals = previous_caller_frame.f_globals
+    return frame_globals.get('__name__'), previous_caller_frame.f_locals is frame_globals
diff --git a/pydantic/json.py b/pydantic/json.py
index 9ce9d57d5..143ae877b 100644
--- a/pydantic/json.py
+++ b/pydantic/json.py
@@ -5,7 +5,7 @@ from enum import Enum
 from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
 from pathlib import Path
 from types import GeneratorType
-from typing import Any, Callable, Dict, Type, Union
+from typing import Any, Callable, Dict, Pattern, Type, Union
 from uuid import UUID
 
 from .color import Color
@@ -54,6 +54,9 @@ def pydantic_encoder(obj: Any) -> Any:
     elif is_dataclass(obj):
         return asdict(obj)
 
+    if isinstance(obj, Pattern):
+        return obj.pattern
+
     # Check the class type and its superclasses for a matching encoder
     for base in obj.__class__.__mro__[:-1]:
         try:
diff --git a/pydantic/main.py b/pydantic/main.py
index bc5444a70..3d57b1bbc 100644
--- a/pydantic/main.py
+++ b/pydantic/main.py
@@ -29,7 +29,7 @@ from typing import (
 from .class_validators import ValidatorGroup, extract_root_validators, extract_validators, inherit_validators
 from .error_wrappers import ErrorWrapper, ValidationError
 from .errors import ConfigError, DictError, ExtraError, MissingError
-from .fields import SHAPE_MAPPING, ModelField, PrivateAttr, Undefined
+from .fields import SHAPE_MAPPING, ModelField, ModelPrivateAttr, PrivateAttr, Undefined
 from .json import custom_pydantic_encoder, pydantic_encoder
 from .parse import Protocol, load_file, load_str_bytes
 from .schema import default_ref_template, model_schema
@@ -215,7 +215,7 @@ class ModelMetaclass(ABCMeta):
         validators: 'ValidatorListDict' = {}
 
         pre_root_validators, post_root_validators = [], []
-        private_attributes: Dict[str, PrivateAttr] = {}
+        private_attributes: Dict[str, ModelPrivateAttr] = {}
         slots: Set[str] = namespace.get('__slots__', ())
         slots = {slots} if isinstance(slots, str) else set(slots)
 
@@ -271,7 +271,7 @@ class ModelMetaclass(ABCMeta):
 
             for var_name, value in namespace.items():
                 can_be_changed = var_name not in class_vars and not isinstance(value, untouched_types)
-                if isinstance(value, PrivateAttr):
+                if isinstance(value, ModelPrivateAttr):
                     if not is_valid_private_name(var_name):
                         raise NameError(
                             f'Private attributes "{var_name}" must not be a valid field name; '
@@ -384,12 +384,16 @@ class BaseModel(Representation, metaclass=ModelMetaclass):
 
             known_field = self.__fields__.get(name, None)
             if known_field:
-                original_value = self.__dict__.pop(name)
-                value, error_ = known_field.validate(value, self.__dict__, loc=name, cls=self.__class__)
+                # We want to
+                # - make sure validators are called without the current value for this field inside `values`
+                # - keep other values (e.g. submodels) untouched (using `BaseModel.dict()` will change them into dicts)
+                # - keep the order of the fields
+                dict_without_original_value = {k: v for k, v in self.__dict__.items() if k != name}
+                value, error_ = known_field.validate(value, dict_without_original_value, loc=name, cls=self.__class__)
                 if error_:
-                    self.__dict__[name] = original_value
                     raise ValidationError([error_], self.__class__)
-                new_values[name] = value
+                else:
+                    new_values[name] = value
 
             errors = []
             for skip_on_failure, validator in self.__post_root_validators__:
diff --git a/pydantic/types.py b/pydantic/types.py
index 9c462e124..9c3279b99 100644
--- a/pydantic/types.py
+++ b/pydantic/types.py
@@ -63,10 +63,14 @@ __all__ = [
     'conint',
     'PositiveInt',
     'NegativeInt',
+    'NonNegativeInt',
+    'NonPositiveInt',
     'ConstrainedFloat',
     'confloat',
     'PositiveFloat',
     'NegativeFloat',
+    'NonNegativeFloat',
+    'NonPositiveFloat',
     'ConstrainedDecimal',
     'condecimal',
     'UUID1',
@@ -379,6 +383,14 @@ class NegativeInt(ConstrainedInt):
     lt = 0
 
 
+class NonPositiveInt(ConstrainedInt):
+    le = 0
+
+
+class NonNegativeInt(ConstrainedInt):
+    ge = 0
+
+
 class StrictInt(ConstrainedInt):
     strict = True
 
@@ -440,6 +452,14 @@ class NegativeFloat(ConstrainedFloat):
     lt = 0
 
 
+class NonPositiveFloat(ConstrainedFloat):
+    le = 0
+
+
+class NonNegativeFloat(ConstrainedFloat):
+    ge = 0
+
+
 class StrictFloat(ConstrainedFloat):
     strict = True
 
diff --git a/pydantic/utils.py b/pydantic/utils.py
index 96b792fbe..e3e613ca3 100644
--- a/pydantic/utils.py
+++ b/pydantic/utils.py
@@ -631,4 +631,10 @@ def is_valid_field(name: str) -> bool:
 
 
 def is_valid_private_name(name: str) -> bool:
-    return not is_valid_field(name) and name not in {'__annotations__', '__module__', '__annotations__', '__qualname__'}
+    return not is_valid_field(name) and name not in {
+        '__annotations__',
+        '__classcell__',
+        '__doc__',
+        '__module__',
+        '__qualname__',
+    }
diff --git a/pydantic/validators.py b/pydantic/validators.py
index 3fc9e4377..5beb4ea7e 100644
--- a/pydantic/validators.py
+++ b/pydantic/validators.py
@@ -593,7 +593,7 @@ def find_validators(  # noqa: C901 (ignore complexity)
         yield make_literal_validator(type_)
         return
     if is_builtin_dataclass(type_):
-        yield from make_dataclass_validator(type_)
+        yield from make_dataclass_validator(type_, config)
         return
     if type_ is Enum:
         yield enum_validator
diff --git a/pydantic/version.py b/pydantic/version.py
index 8ff7e35fd..cd81ee5f2 100644
--- a/pydantic/version.py
+++ b/pydantic/version.py
@@ -1,6 +1,6 @@
 __all__ = 'VERSION', 'version_info'
 
-VERSION = '1.7'
+VERSION = '1.7.2'
 
 
 def version_info() -> str:


Test patch:
diff --git a/tests/mypy/modules/success.py b/tests/mypy/modules/success.py
index 202184c93..35c2ba3c2 100644
--- a/tests/mypy/modules/success.py
+++ b/tests/mypy/modules/success.py
@@ -9,7 +9,7 @@ from datetime import date, datetime
 from typing import Any, Dict, Generic, List, Optional, TypeVar
 
 from pydantic import BaseModel, NoneStr, PyObject, StrictBool, root_validator, validate_arguments, validator
-from pydantic.fields import Field
+from pydantic.fields import Field, PrivateAttr
 from pydantic.generics import GenericModel
 from pydantic.typing import ForwardRef
 
@@ -121,6 +121,7 @@ class WithField(BaseModel):
     first_name: str = Field('John', const=True)
 
 
+# simple decorator
 @validate_arguments
 def foo(a: int, *, c: str = 'x') -> str:
     return c * a
@@ -130,6 +131,16 @@ foo(1, c='thing')
 foo(1)
 
 
+# nested decorator should not produce an error
+@validate_arguments(config={'arbitrary_types_allowed': True})
+def bar(a: int, *, c: str = 'x') -> str:
+    return c * a
+
+
+bar(1, c='thing')
+bar(1)
+
+
 class Foo(BaseModel):
     a: int
 
@@ -145,3 +156,7 @@ class MyConf(BaseModel):
 conf = MyConf()
 var1: date = conf.str_pyobject(2020, 12, 20)
 var2: date = conf.callable_pyobject(2111, 1, 1)
+
+
+class MyPrivateAttr(BaseModel):
+    _private_field: str = PrivateAttr()
diff --git a/tests/test_dataclasses.py b/tests/test_dataclasses.py
index 6ad604d48..e213ff567 100644
--- a/tests/test_dataclasses.py
+++ b/tests/test_dataclasses.py
@@ -2,7 +2,7 @@ import dataclasses
 from collections.abc import Hashable
 from datetime import datetime
 from pathlib import Path
-from typing import ClassVar, Dict, FrozenSet, Optional
+from typing import ClassVar, Dict, FrozenSet, List, Optional
 
 import pytest
 
@@ -738,3 +738,60 @@ def test_override_builtin_dataclass_nested_schema():
         'title': 'File',
         'type': 'object',
     }
+
+
+def test_inherit_builtin_dataclass():
+    @dataclasses.dataclass
+    class Z:
+        z: int
+
+    @dataclasses.dataclass
+    class Y(Z):
+        y: int
+
+    @pydantic.dataclasses.dataclass
+    class X(Y):
+        x: int
+
+    pika = X(x='2', y='4', z='3')
+    assert pika.x == 2
+    assert pika.y == 4
+    assert pika.z == 3
+
+
+def test_dataclass_arbitrary():
+    class ArbitraryType:
+        def __init__(self):
+            ...
+
+    @dataclasses.dataclass
+    class Test:
+        foo: ArbitraryType
+        bar: List[ArbitraryType]
+
+    class TestModel(BaseModel):
+        a: ArbitraryType
+        b: Test
+
+        class Config:
+            arbitrary_types_allowed = True
+
+    TestModel(a=ArbitraryType(), b=(ArbitraryType(), [ArbitraryType()]))
+
+
+def test_forward_stdlib_dataclass_params():
+    @dataclasses.dataclass(frozen=True)
+    class Item:
+        name: str
+
+    class Example(BaseModel):
+        item: Item
+        other: str
+
+        class Config:
+            arbitrary_types_allowed = True
+
+    e = Example(item=Item(name='pika'), other='bulbi')
+    e.other = 'bulbi2'
+    with pytest.raises(dataclasses.FrozenInstanceError):
+        e.item.name = 'pika2'
diff --git a/tests/test_generics.py b/tests/test_generics.py
index a37c2a8e5..ecd39b8f3 100644
--- a/tests/test_generics.py
+++ b/tests/test_generics.py
@@ -5,7 +5,7 @@ from typing import Any, ClassVar, Dict, Generic, List, Optional, Tuple, Type, Ty
 import pytest
 
 from pydantic import BaseModel, Field, ValidationError, root_validator, validator
-from pydantic.generics import GenericModel, _generic_types_cache, get_caller_module_name
+from pydantic.generics import GenericModel, _generic_types_cache
 
 skip_36 = pytest.mark.skipif(sys.version_info < (3, 7), reason='generics only supported for python 3.7 and above')
 
@@ -686,8 +686,7 @@ def test_generic_model_redefined_without_cache_fail(create_module):
     def module():
         from typing import Generic, TypeVar
 
-        import pytest
-
+        from pydantic import BaseModel
         from pydantic.generics import GenericModel, _generic_types_cache
 
         t = TypeVar('t')
@@ -695,86 +694,65 @@ def test_generic_model_redefined_without_cache_fail(create_module):
         class MyGeneric(GenericModel, Generic[t]):
             value: t
 
-        concrete = MyGeneric[t]
-        _generic_types_cache.clear()
-        with pytest.raises(
-            TypeError, match=r"'MyGeneric\[t\]' already defined above, please consider reusing it"
-        ) as exc_info:
-            MyGeneric[t]
-
-        cause = exc_info.value.__cause__
-        assert isinstance(cause, NameError), cause
-        expected_message = f"Name conflict: 'MyGeneric[t]' in {__name__!r} is already used by {concrete!r}"
-        assert cause.args[0] == expected_message, f'{cause.args[0]} != {expected_message}'
-
-
-def test_get_caller_module_name(create_module):
-    @create_module
-    def module():
-        from pydantic.generics import get_caller_module_name
-
-        def get_current_module_name():
-            return get_caller_module_name()
+        class Model(BaseModel):
+            ...
 
-        assert get_current_module_name() == __name__
+        concrete = MyGeneric[Model]
+        _generic_types_cache.clear()
+        second_concrete = MyGeneric[Model]
 
+        class Model(BaseModel):  # same name, but type different, so it's not in cache
+            ...
 
-def test_get_caller_module_name_not_found(mocker):
-    mocker.patch('inspect.getmodule', return_value=None)
-    assert get_caller_module_name() is None
+        third_concrete = MyGeneric[Model]
+        assert concrete is not second_concrete
+        assert concrete is not third_concrete
+        assert second_concrete is not third_concrete
+        assert globals()['MyGeneric[Model]'] is concrete
+        assert globals()['MyGeneric[Model]_'] is second_concrete
+        assert globals()['MyGeneric[Model]__'] is third_concrete
 
 
-def test_is_call_from_module(create_module):
+def test_get_caller_frame_info(create_module):
     @create_module
     def module():
-        from pydantic.generics import is_call_from_module
+        from pydantic.generics import get_caller_frame_info
 
         def function():
-            assert is_call_from_module()
+            assert get_caller_frame_info() == (__name__, True)
 
             another_function()
 
         def another_function():
-            assert not is_call_from_module()
+            assert get_caller_frame_info() == (__name__, False)
             third_function()
 
         def third_function():
-            assert not is_call_from_module()
+            assert get_caller_frame_info() == (__name__, False)
 
         function()
 
 
-def test_is_call_from_module_called_in_module(create_module):
+def test_get_caller_frame_info_called_from_module(create_module):
     @create_module
     def module():
         from unittest.mock import patch
 
         import pytest
 
-        from pydantic.generics import is_call_from_module
-
-        with pytest.raises(RuntimeError, match='This function must be used inside another function') as exc_info:
-            with patch('inspect.stack', new=lambda: [..., ...]):
-                is_call_from_module()
-
-        e = exc_info.value
-        assert isinstance(e.__cause__, IndexError)
-        assert isinstance(e.__context__, IndexError)
-
+        from pydantic.generics import get_caller_frame_info
 
-def test_get_caller_module_called_from_module(create_module):
-    @create_module
-    def module():
-        from unittest.mock import patch
-
-        import pytest
+        with pytest.raises(RuntimeError, match='This function must be used inside another function'):
+            with patch('sys._getframe', side_effect=ValueError('getframe_exc')):
+                get_caller_frame_info()
 
-        from pydantic.generics import get_caller_module_name
 
-        with pytest.raises(RuntimeError, match='This function must be used inside another function') as exc_info:
-            with patch('inspect.stack', new=lambda: [..., ...]):
-                get_caller_module_name()
+def test_get_caller_frame_info_when_sys_getframe_undefined():
+    from pydantic.generics import get_caller_frame_info
 
-        e = exc_info.value
-        assert isinstance(e.__cause__, IndexError)
-        assert isinstance(e.__context__, IndexError)
+    getframe = sys._getframe
+    del sys._getframe
+    try:
+        assert get_caller_frame_info() == (None, False)
+    finally:  # just to make sure we always setting original attribute back
+        sys._getframe = getframe
diff --git a/tests/test_json.py b/tests/test_json.py
index cf916f6ae..07bfc04f7 100644
--- a/tests/test_json.py
+++ b/tests/test_json.py
@@ -1,5 +1,6 @@
 import datetime
 import json
+import re
 import sys
 from dataclasses import dataclass as vanilla_dataclass
 from decimal import Decimal
@@ -51,6 +52,7 @@ class MyEnum(Enum):
         (Decimal('12.34'), '12.34'),
         (create_model('BarModel', a='b', c='d')(), '{"a": "b", "c": "d"}'),
         (MyEnum.foo, '"bar"'),
+        (re.compile('^regex$'), '"^regex$"'),
     ],
 )
 def test_encoding(input, output):
diff --git a/tests/test_private_attributes.py b/tests/test_private_attributes.py
index 07f702c7f..21f52090b 100644
--- a/tests/test_private_attributes.py
+++ b/tests/test_private_attributes.py
@@ -55,6 +55,8 @@ def test_private_attribute_factory():
 
 def test_private_attribute_annotation():
     class Model(BaseModel):
+        """The best model"""
+
         __foo__: str
 
         class Config:
@@ -63,6 +65,7 @@ def test_private_attribute_annotation():
     assert Model.__slots__ == {'__foo__'}
     assert repr(Model.__foo__) == "<member '__foo__' of 'Model' objects>"
     assert Model.__private_attributes__ == {'__foo__': PrivateAttr(Undefined)}
+    assert repr(Model.__doc__) == "'The best model'"
 
     m = Model()
     with pytest.raises(AttributeError):
@@ -158,5 +161,22 @@ def test_slots_are_ignored():
 
 
 def test_default_and_default_factory_used_error():
-    with pytest.raises(TypeError, match='default and default_factory args can not be used together'):
+    with pytest.raises(ValueError, match='cannot specify both default and default_factory'):
         PrivateAttr(default=123, default_factory=lambda: 321)
+
+
+def test_config_override_init():
+    class MyModel(BaseModel):
+        x: str
+        _private_attr: int
+
+        def __init__(self, **data) -> None:
+            super().__init__(**data)
+            self._private_attr = 123
+
+        class Config:
+            underscore_attrs_are_private = True
+
+    m = MyModel(x='hello')
+    assert m.dict() == {'x': 'hello'}
+    assert m._private_attr == 123
diff --git a/tests/test_schema.py b/tests/test_schema.py
index 9da7d14cc..13d92585a 100644
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -42,6 +42,10 @@ from pydantic.types import (
     NoneBytes,
     NoneStr,
     NoneStrBytes,
+    NonNegativeFloat,
+    NonNegativeInt,
+    NonPositiveFloat,
+    NonPositiveInt,
     PositiveFloat,
     PositiveInt,
     PyObject,
@@ -754,6 +758,8 @@ def test_secret_types(field_type, inner_type):
         (conint(multiple_of=5), {'multipleOf': 5}),
         (PositiveInt, {'exclusiveMinimum': 0}),
         (NegativeInt, {'exclusiveMaximum': 0}),
+        (NonNegativeInt, {'minimum': 0}),
+        (NonPositiveInt, {'maximum': 0}),
     ],
 )
 def test_special_int_types(field_type, expected_schema):
@@ -780,6 +786,8 @@ def test_special_int_types(field_type, expected_schema):
         (confloat(multiple_of=5), {'multipleOf': 5}),
         (PositiveFloat, {'exclusiveMinimum': 0}),
         (NegativeFloat, {'exclusiveMaximum': 0}),
+        (NonNegativeFloat, {'minimum': 0}),
+        (NonPositiveFloat, {'maximum': 0}),
         (ConstrainedDecimal, {}),
         (condecimal(gt=5, lt=10), {'exclusiveMinimum': 5, 'exclusiveMaximum': 10}),
         (condecimal(ge=5, le=10), {'minimum': 5, 'maximum': 10}),
diff --git a/tests/test_types.py b/tests/test_types.py
index 7e4c7e0bd..b07d1408d 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -43,6 +43,10 @@ from pydantic import (
     NameEmail,
     NegativeFloat,
     NegativeInt,
+    NonNegativeFloat,
+    NonNegativeInt,
+    NonPositiveFloat,
+    NonPositiveInt,
     PositiveFloat,
     PositiveInt,
     PyObject,
@@ -1178,15 +1182,17 @@ def test_int_validation():
     class Model(BaseModel):
         a: PositiveInt = None
         b: NegativeInt = None
-        c: conint(gt=4, lt=10) = None
-        d: conint(ge=0, le=10) = None
-        e: conint(multiple_of=5) = None
+        c: NonNegativeInt = None
+        d: NonPositiveInt = None
+        e: conint(gt=4, lt=10) = None
+        f: conint(ge=0, le=10) = None
+        g: conint(multiple_of=5) = None
 
-    m = Model(a=5, b=-5, c=5, d=0, e=25)
-    assert m == {'a': 5, 'b': -5, 'c': 5, 'd': 0, 'e': 25}
+    m = Model(a=5, b=-5, c=0, d=0, e=5, f=0, g=25)
+    assert m == {'a': 5, 'b': -5, 'c': 0, 'd': 0, 'e': 5, 'f': 0, 'g': 25}
 
     with pytest.raises(ValidationError) as exc_info:
-        Model(a=-5, b=5, c=-5, d=11, e=42)
+        Model(a=-5, b=5, c=-5, d=5, e=-5, f=11, g=42)
     assert exc_info.value.errors() == [
         {
             'loc': ('a',),
@@ -1202,18 +1208,30 @@ def test_int_validation():
         },
         {
             'loc': ('c',),
+            'msg': 'ensure this value is greater than or equal to 0',
+            'type': 'value_error.number.not_ge',
+            'ctx': {'limit_value': 0},
+        },
+        {
+            'loc': ('d',),
+            'msg': 'ensure this value is less than or equal to 0',
+            'type': 'value_error.number.not_le',
+            'ctx': {'limit_value': 0},
+        },
+        {
+            'loc': ('e',),
             'msg': 'ensure this value is greater than 4',
             'type': 'value_error.number.not_gt',
             'ctx': {'limit_value': 4},
         },
         {
-            'loc': ('d',),
+            'loc': ('f',),
             'msg': 'ensure this value is less than or equal to 10',
             'type': 'value_error.number.not_le',
             'ctx': {'limit_value': 10},
         },
         {
-            'loc': ('e',),
+            'loc': ('g',),
             'msg': 'ensure this value is a multiple of 5',
             'type': 'value_error.number.not_multiple',
             'ctx': {'multiple_of': 5},
@@ -1225,15 +1243,17 @@ def test_float_validation():
     class Model(BaseModel):
         a: PositiveFloat = None
         b: NegativeFloat = None
-        c: confloat(gt=4, lt=12.2) = None
-        d: confloat(ge=0, le=9.9) = None
-        e: confloat(multiple_of=0.5) = None
+        c: NonNegativeFloat = None
+        d: NonPositiveFloat = None
+        e: confloat(gt=4, lt=12.2) = None
+        f: confloat(ge=0, le=9.9) = None
+        g: confloat(multiple_of=0.5) = None
 
-    m = Model(a=5.1, b=-5.2, c=5.3, d=9.9, e=2.5)
-    assert m.dict() == {'a': 5.1, 'b': -5.2, 'c': 5.3, 'd': 9.9, 'e': 2.5}
+    m = Model(a=5.1, b=-5.2, c=0, d=0, e=5.3, f=9.9, g=2.5)
+    assert m.dict() == {'a': 5.1, 'b': -5.2, 'c': 0, 'd': 0, 'e': 5.3, 'f': 9.9, 'g': 2.5}
 
     with pytest.raises(ValidationError) as exc_info:
-        Model(a=-5.1, b=5.2, c=-5.3, d=9.91, e=4.2)
+        Model(a=-5.1, b=5.2, c=-5.1, d=5.1, e=-5.3, f=9.91, g=4.2)
     assert exc_info.value.errors() == [
         {
             'loc': ('a',),
@@ -1249,18 +1269,30 @@ def test_float_validation():
         },
         {
             'loc': ('c',),
+            'msg': 'ensure this value is greater than or equal to 0',
+            'type': 'value_error.number.not_ge',
+            'ctx': {'limit_value': 0},
+        },
+        {
+            'loc': ('d',),
+            'msg': 'ensure this value is less than or equal to 0',
+            'type': 'value_error.number.not_le',
+            'ctx': {'limit_value': 0},
+        },
+        {
+            'loc': ('e',),
             'msg': 'ensure this value is greater than 4',
             'type': 'value_error.number.not_gt',
             'ctx': {'limit_value': 4},
         },
         {
-            'loc': ('d',),
+            'loc': ('f',),
             'msg': 'ensure this value is less than or equal to 9.9',
             'type': 'value_error.number.not_le',
             'ctx': {'limit_value': 9.9},
         },
         {
-            'loc': ('e',),
+            'loc': ('g',),
             'msg': 'ensure this value is a multiple of 0.5',
             'type': 'value_error.number.not_multiple',
             'ctx': {'multiple_of': 0.5},
diff --git a/tests/test_validators.py b/tests/test_validators.py
index 44ca23c47..62a68b031 100644
--- a/tests/test_validators.py
+++ b/tests/test_validators.py
@@ -5,7 +5,7 @@ from typing import Dict, List, Optional, Tuple
 
 import pytest
 
-from pydantic import BaseModel, ConfigError, Extra, ValidationError, errors, validator
+from pydantic import BaseModel, ConfigError, Extra, Field, ValidationError, errors, validator
 from pydantic.class_validators import make_generic_validator, root_validator
 from pydantic.typing import Literal
 
@@ -1155,3 +1155,59 @@ def test_nested_literal_validator():
             'ctx': {'given': 'nope', 'permitted': ('foo', 'bar')},
         }
     ]
+
+
+def test_field_that_is_being_validated_is_excluded_from_validator_values(mocker):
+    check_values = mocker.MagicMock()
+
+    class Model(BaseModel):
+        foo: str
+        bar: str = Field(alias='pika')
+        baz: str
+
+        class Config:
+            validate_assignment = True
+
+        @validator('foo')
+        def validate_foo(cls, v, values):
+            check_values({**values})
+            return v
+
+        @validator('bar')
+        def validate_bar(cls, v, values):
+            check_values({**values})
+            return v
+
+    model = Model(foo='foo_value', pika='bar_value', baz='baz_value')
+    check_values.reset_mock()
+
+    assert list(dict(model).items()) == [('foo', 'foo_value'), ('bar', 'bar_value'), ('baz', 'baz_value')]
+
+    model.foo = 'new_foo_value'
+    check_values.assert_called_once_with({'bar': 'bar_value', 'baz': 'baz_value'})
+    check_values.reset_mock()
+
+    model.bar = 'new_bar_value'
+    check_values.assert_called_once_with({'foo': 'new_foo_value', 'baz': 'baz_value'})
+
+    # ensure field order is the same
+    assert list(dict(model).items()) == [('foo', 'new_foo_value'), ('bar', 'new_bar_value'), ('baz', 'baz_value')]
+
+
+def test_exceptions_in_field_validators_restore_original_field_value():
+    class Model(BaseModel):
+        foo: str
+
+        class Config:
+            validate_assignment = True
+
+        @validator('foo')
+        def validate_foo(cls, v):
+            if v == 'raise_exception':
+                raise RuntimeError('test error')
+            return v
+
+    model = Model(foo='foo')
+    with pytest.raises(RuntimeError, match='test error'):
+        model.foo = 'raise_exception'
+    assert model.foo == 'foo'