Repository: samuelcolvin/pydantic
Pull request #2230 (2021-01-01 05:27:39)

build(deps): bump codecov/codecov-action from v1.0.15 to v1.1.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.0.15 to v1.1.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/codecov/codecov-action/releases">codecov/codecov-action's releases</a>.</em></p>
<blockquote>
<h2>v1.1.1</h2>
<h3>Fixes</h3>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/184">#184</a> Add automation to ensure proper builds and deployments (fixes issue with non-built v1.1.0)</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/184">#184</a> Fixes verbose flag</li>
</ul>
<h2>v1.1.0</h2>
<h3>Features</h3>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/110">#110</a> Add &quot;working-directory:&quot; input</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/174">#174</a> Support Xcode specificed parameters</li>
</ul>
<h3>Fixes</h3>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/172">#172</a> File is saved as text</li>
</ul>
<h3>Dependencies and Misc</h3>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/166">#166</a> Bump requestretry from 4.1.1 to 4.1.2</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/169">#169</a> Bump typescript from 4.0.5 to 4.1.2</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/178">#178</a> Bump @types/jest from 26.0.15 to 26.0.19</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md">codecov/codecov-action's changelog</a>.</em></p>
<blockquote>
<h3>1.1.1</h3>
<h4>Fixes</h4>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/184">#184</a> Add automations ensure proper builds and deployments</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/184">#184</a> Fixes verbose flag</li>
</ul>
<h3>1.1.0</h3>
<h4>Features</h4>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/110">#110</a> Add &quot;working-directory:&quot; input</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/174">#174</a> Support Xcode specificed parameters</li>
</ul>
<h4>Fixes</h4>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/172">#172</a> File is saved as text</li>
</ul>
<h4>Dependencies and Misc</h4>
<ul>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/166">#166</a> Bump requestretry from 4.1.1 to 4.1.2</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/169">#169</a> Bump typescript from 4.0.5 to 4.1.2</li>
<li><a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/178">#178</a> Bump @types/jest from 26.0.15 to 26.0.19</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/codecov/codecov-action/commit/1fc7722ded4708880a5aea49f2bfafb9336f0c8d"><code>1fc7722</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/codecov/codecov-action/issues/184">#184</a> from codecov/makefile</li>
<li><a href="https://github.com/codecov/codecov-action/commit/08574d831c904e7391c85172fd0ebe27edc5b597"><code>08574d8</code></a> Add dist file</li>
<li><a href="https://github.com/codecov/codecov-action/commit/0c1af46295bc45dfe9c7b8fd5a2bb59864d4d194"><code>0c1af46</code></a> Update install script</li>
<li><a href="https://github.com/codecov/codecov-action/commit/f8c87eb84eff353c49fcb2f295110a82afdca7ae"><code>f8c87eb</code></a> Update changelog</li>
<li><a href="https://github.com/codecov/codecov-action/commit/8b988c28b0225931e3dafaa583fd1b0234d42fe8"><code>8b988c2</code></a> Fix verbose flag</li>
<li><a href="https://github.com/codecov/codecov-action/commit/4686d7034ce68daada1fc22862da4d07ca1ca779"><code>4686d70</code></a> Udpate CHANGELOG</li>
<li><a href="https://github.com/codecov/codecov-action/commit/4ef30f27a0061b3f6153715692e0b3bbf5bf5029"><code>4ef30f2</code></a> Update changelog</li>
<li><a href="https://github.com/codecov/codecov-action/commit/58cd650984fef6fc32b7c26819da2f80ebe3b686"><code>58cd650</code></a> Update package-lock</li>
<li><a href="https://github.com/codecov/codecov-action/commit/efb844969e1458c862ec91766b9126bbf6a55feb"><code>efb8449</code></a> force</li>
<li><a href="https://github.com/codecov/codecov-action/commit/c6de3f854889dffc74b6286572911d15c35bc2a2"><code>c6de3f8</code></a> Add makefile and automations</li>
<li>Additional commits viewable in <a href="https://github.com/codecov/codecov-action/compare/v1.0.15...1fc7722ded4708880a5aea49f2bfafb9336f0c8d">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

codecov[bot]: # [Codecov](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230?src=pr&el=h1) Report
> Merging [#2230](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230?src=pr&el=desc) (df3d0e5) into [master](https://codecov.io/gh/samuelcolvin/pydantic/commit/8bad7bc91105616dfcc23ce1d68fba12f328a2a3?el=desc) (8bad7bc) will **decrease** coverage by `4.04%`.
> The diff coverage is `n/a`.


```diff
@@             Coverage Diff             @@
##            master    #2230      +/-   ##
===========================================
- Coverage   100.00%   95.95%   -4.05%     
===========================================
  Files           21       21              
  Lines         4181     4181              
  Branches       849      849              
===========================================
- Hits          4181     4012     -169     
- Misses           0      151     +151     
- Partials         0       18      +18     
```


| [Impacted Files](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pydantic/generics.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvZ2VuZXJpY3MucHk=) | `27.02% <0.00%> (-72.98%)` | :arrow_down: |
| [pydantic/typing.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvdHlwaW5nLnB5) | `68.84% <0.00%> (-31.16%)` | :arrow_down: |
| [pydantic/decorator.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvZGVjb3JhdG9yLnB5) | `87.65% <0.00%> (-12.35%)` | :arrow_down: |
| [pydantic/version.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvdmVyc2lvbi5weQ==) | `88.23% <0.00%> (-11.77%)` | :arrow_down: |
| [pydantic/fields.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvZmllbGRzLnB5) | `96.78% <0.00%> (-3.22%)` | :arrow_down: |
| [pydantic/env\_settings.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvZW52X3NldHRpbmdzLnB5) | `97.93% <0.00%> (-2.07%)` | :arrow_down: |
| [pydantic/error\_wrappers.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvZXJyb3Jfd3JhcHBlcnMucHk=) | `98.86% <0.00%> (-1.14%)` | :arrow_down: |
| [pydantic/networks.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvbmV0d29ya3MucHk=) | `99.26% <0.00%> (-0.74%)` | :arrow_down: |
| [pydantic/utils.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvdXRpbHMucHk=) | `99.30% <0.00%> (-0.70%)` | :arrow_down: |
| [pydantic/types.py](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230/diff?src=pr&el=tree#diff-cHlkYW50aWMvdHlwZXMucHk=) | `99.59% <0.00%> (-0.41%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230?src=pr&el=footer). Last update [8bad7bc...df3d0e5](https://codecov.io/gh/samuelcolvin/pydantic/pull/2230?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 81288f452..53c7b153c 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.15
+    - uses: codecov/codecov-action@v1.1.1
       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.15
+    - uses: codecov/codecov-action@v1.1.1
       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.15
+    - uses: codecov/codecov-action@v1.1.1
       with:
         file: ./coverage.xml
         env_vars: COMPILED,DEPS,PYTHON,OS
@@ -143,7 +143,7 @@ jobs:
 
     - run: coverage xml
 
-    - uses: codecov/codecov-action@v1.0.15
+    - uses: codecov/codecov-action@v1.1.1
       with:
         file: ./coverage.xml
         env_vars: COMPILED,DEPS,PYTHON,OS
diff --git a/HISTORY.md b/HISTORY.md
index 692c8e2c2..c5aeda5b0 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,3 +1,16 @@
+## v1.7.3 (2020-11-30)
+
+Thank you to pydantic's sponsors:
+@timdrijvers, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @jorgecarleitao, @koxudaxi, @primer-api,
+@mkeen, @meadsteve for their kind support.
+
+* fix: set right default value for required (optional) fields, #2142 by @PrettyWood
+* fix: support `underscore_attrs_are_private` with generic models, #2138 by @PrettyWood
+* fix: update all modified field values in `root_validator` when `validate_assignment` is on, #2116 by @PrettyWood
+* Allow pickling of `pydantic.dataclasses.dataclass` dynamically created from a built-in `dataclasses.dataclass`, #2111 by @aimestereo
+* Fix a regression where Enum fields would not propagate keyword arguments to the schema, #2109 by @bm424
+* Ignore `__doc__` as private attribute when `Config.underscore_attrs_are_private` is set, #2090 by @PrettyWood
+
 ## v1.7.2 (2020-11-01)
 
 * fix slow `GenericModel` concrete model creation, allow `GenericModel` concrete name reusing in module, #2078 by @MrMrRobat
diff --git a/changes/2095-PrettyWood.md b/changes/2095-PrettyWood.md
new file mode 100644
index 000000000..9f643028f
--- /dev/null
+++ b/changes/2095-PrettyWood.md
@@ -0,0 +1,1 @@
+add validator for `None`, `NoneType` or `Literal[None]`
\ No newline at end of file
diff --git a/changes/2168-andrewmwhite.md b/changes/2168-andrewmwhite.md
new file mode 100644
index 000000000..6b906fcdd
--- /dev/null
+++ b/changes/2168-andrewmwhite.md
@@ -0,0 +1,2 @@
+fix URL regex to parse fragment without query string
+
diff --git a/docs/build/schema_mapping.py b/docs/build/schema_mapping.py
index 578172746..4f204b358 100755
--- a/docs/build/schema_mapping.py
+++ b/docs/build/schema_mapping.py
@@ -11,6 +11,13 @@ import re
 from pathlib import Path
 
 table = [
+    [
+        'None',
+        'null',
+        '',
+        'JSON Schema Core',
+        'Same for `type(None)` or `Literal[None]`'
+    ],
     [
         'bool',
         'boolean',
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 49078122f..1b8ba1000 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -3,7 +3,7 @@ flake8==3.8.4
 flake8-quotes==3.2.0
 mkdocs==1.1.2
 mkdocs-exclude==1.0.2
-mkdocs-material==6.1.7
+mkdocs-material==6.2.3
 markdown-include==0.6.0
 sqlalchemy
 orjson
diff --git a/docs/usage/types.md b/docs/usage/types.md
index eda606550..7f1c4d301 100644
--- a/docs/usage/types.md
+++ b/docs/usage/types.md
@@ -11,6 +11,9 @@ with custom properties and validation.
 [Strict Types](#strict-types); if you need to constrain the values allowed (e.g. to require a positive int) see
 [Constrained Types](#constrained-types).
 
+`None`, `type(None)` or `Literal[None]` (equivalent according to [PEP 484](https://www.python.org/dev/peps/pep-0484/#using-none))
+: allows only `None` value
+
 `bool`
 : see [Booleans](#booleans) below for details on how bools are validated and what values are permitted
 
diff --git a/pydantic/errors.py b/pydantic/errors.py
index 4e43a1f08..db2df4f4b 100644
--- a/pydantic/errors.py
+++ b/pydantic/errors.py
@@ -17,6 +17,7 @@ __all__ = (
     'NoneIsNotAllowedError',
     'NoneIsAllowedError',
     'WrongConstantError',
+    'NotNoneError',
     'BoolError',
     'BytesError',
     'DictError',
@@ -160,6 +161,11 @@ class WrongConstantError(PydanticValueError):
         return f'unexpected value; permitted: {permitted}'
 
 
+class NotNoneError(PydanticTypeError):
+    code = 'not_none'
+    msg_template = 'value is not None'
+
+
 class BoolError(PydanticTypeError):
     msg_template = 'value could not be parsed to a boolean'
 
diff --git a/pydantic/fields.py b/pydantic/fields.py
index 7d848359d..4a0469f97 100644
--- a/pydantic/fields.py
+++ b/pydantic/fields.py
@@ -28,6 +28,7 @@ from .error_wrappers import ErrorWrapper
 from .errors import NoneIsNotAllowedError
 from .types import Json, JsonWrapper
 from .typing import (
+    NONE_TYPES,
     Callable,
     ForwardRef,
     NoArgAnyCallable,
@@ -307,7 +308,7 @@ class ModelField(Representation):
         required: 'BoolUndefined' = Undefined
         if value is Required:
             required = True
-            value = Ellipsis
+            value = None
         elif value is not Undefined:
             required = False
         field_info.alias = field_info.alias or field_info_from_config.get('alias')
@@ -368,7 +369,7 @@ class ModelField(Representation):
         when we want to validate the default value i.e. when `validate_all` is set to True.
         """
         if self.default_factory is not None:
-            if self.type_ is None:
+            if self.type_ is Undefined:
                 raise errors_.ConfigError(
                     f'you need to set the type of field {self.name!r} when using `default_factory`'
                 )
@@ -377,11 +378,11 @@ class ModelField(Representation):
 
         default_value = self.get_default()
 
-        if default_value is not None and self.type_ is None:
+        if default_value is not None and self.type_ is Undefined:
             self.type_ = default_value.__class__
             self.outer_type_ = self.type_
 
-        if self.type_ is None:
+        if self.type_ is Undefined:
             raise errors_.ConfigError(f'unable to infer type for attribute "{self.name}"')
 
         if self.required is False and default_value is None:
@@ -571,7 +572,10 @@ class ModelField(Representation):
                 return v, errors
 
         if v is None:
-            if self.allow_none:
+            if self.type_ in NONE_TYPES:
+                # keep validating
+                pass
+            elif self.allow_none:
                 if self.post_validators:
                     return self._apply_validators(v, values, loc, cls, self.post_validators)
                 else:
@@ -753,12 +757,6 @@ class ModelField(Representation):
                 return v, ErrorWrapper(exc, loc)
         return v, None
 
-    def include_in_schema(self) -> bool:
-        """
-        False if this is a simple field just allowing None as used in Unions/Optional.
-        """
-        return self.type_ != NoneType
-
     def is_complex(self) -> bool:
         """
         Whether the field is "complex" eg. env variables should be parsed as JSON.
diff --git a/pydantic/main.py b/pydantic/main.py
index 4834cbf12..796fc7747 100644
--- a/pydantic/main.py
+++ b/pydantic/main.py
@@ -285,7 +285,7 @@ class ModelMetaclass(ABCMeta):
                     inferred = ModelField.infer(
                         name=var_name,
                         value=value,
-                        annotation=annotations.get(var_name),
+                        annotation=annotations.get(var_name, Undefined),
                         class_validators=vg.get_validators(var_name),
                         config=config,
                     )
@@ -788,12 +788,12 @@ class BaseModel(Representation, metaclass=ModelMetaclass):
         value_include = ValueItems(self, include) if include else None
 
         for field_key, v in self.__dict__.items():
-            if (
-                (allowed_keys is not None and field_key not in allowed_keys)
-                or (exclude_none and v is None)
-                or (exclude_defaults and getattr(self.__fields__.get(field_key), 'default', _missing) == v)
-            ):
+            if (allowed_keys is not None and field_key not in allowed_keys) or (exclude_none and v is None):
                 continue
+            if exclude_defaults:
+                model_field = self.__fields__.get(field_key)
+                if not getattr(model_field, 'required', True) and getattr(model_field, 'default', _missing) == v:
+                    continue
             if by_alias and field_key in self.__fields__:
                 dict_key = self.__fields__[field_key].alias
             else:
diff --git a/pydantic/networks.py b/pydantic/networks.py
index 8f44eedb7..d5d74794b 100644
--- a/pydantic/networks.py
+++ b/pydantic/networks.py
@@ -60,7 +60,7 @@ def url_regex() -> Pattern[str]:
             r'(?P<domain>[^\s/:?#]+)'  # domain, validation occurs later
             r')?'
             r'(?::(?P<port>\d+))?'  # port
-            r'(?P<path>/[^\s?]*)?'  # path
+            r'(?P<path>/[^\s?#]*)?'  # path
             r'(?:\?(?P<query>[^\s#]+))?'  # query
             r'(?:#(?P<fragment>\S+))?',  # fragment
             re.IGNORECASE,
diff --git a/pydantic/schema.py b/pydantic/schema.py
index e51d74ce1..bb4324523 100644
--- a/pydantic/schema.py
+++ b/pydantic/schema.py
@@ -57,7 +57,16 @@ from .types import (
     conset,
     constr,
 )
-from .typing import ForwardRef, Literal, get_args, get_origin, is_callable_type, is_literal_type, literal_values
+from .typing import (
+    NONE_TYPES,
+    ForwardRef,
+    Literal,
+    get_args,
+    get_origin,
+    is_callable_type,
+    is_literal_type,
+    literal_values,
+)
 from .utils import ROOT_KEY, get_model, lenient_issubclass, sequence_like
 
 if TYPE_CHECKING:
@@ -640,7 +649,6 @@ def field_singleton_sub_fields_schema(
     """
     definitions = {}
     nested_models: Set[str] = set()
-    sub_fields = [sf for sf in sub_fields if sf.include_in_schema()]
     if len(sub_fields) == 1:
         return field_type_schema(
             sub_fields[0],
@@ -759,6 +767,8 @@ def field_singleton_schema(  # noqa: C901 (ignore complexity)
         )
     if field.type_ is Any or field.type_.__class__ == TypeVar:
         return {}, definitions, nested_models  # no restrictions
+    if field.type_ in NONE_TYPES:
+        return {'type': 'null'}, definitions, nested_models
     if is_callable_type(field.type_):
         raise SkipField(f'Callable {field.name} was excluded from schema since JSON schema has no equivalent type.')
     f_schema: Dict[str, Any] = {}
diff --git a/pydantic/typing.py b/pydantic/typing.py
index 16d27fc48..8f8cbac92 100644
--- a/pydantic/typing.py
+++ b/pydantic/typing.py
@@ -181,6 +181,7 @@ __all__ = (
     'AnyCallable',
     'NoArgAnyCallable',
     'NoneType',
+    'NONE_TYPES',
     'display_as_type',
     'resolve_annotations',
     'is_callable_type',
@@ -208,6 +209,9 @@ __all__ = (
 
 
 NoneType = None.__class__
+NONE_TYPES: Set[Any] = {None, NoneType}
+if Literal:
+    NONE_TYPES.add(Literal[None])
 
 
 def display_as_type(v: Type[Any]) -> str:
diff --git a/pydantic/utils.py b/pydantic/utils.py
index 1a2c2cbe6..ab2f3bcdf 100644
--- a/pydantic/utils.py
+++ b/pydantic/utils.py
@@ -646,7 +646,8 @@ _EMPTY = object()
 
 
 def all_identical(left: Iterable[Any], right: Iterable[Any]) -> bool:
-    """Check that the items of `left` are the same objects as those in `right`.
+    """
+    Check that the items of `left` are the same objects as those in `right`.
 
     >>> a, b = object(), object()
     >>> all_identical([a, b, a], [a, b, a])
diff --git a/pydantic/validators.py b/pydantic/validators.py
index c47ee2f4f..cbb64c80f 100644
--- a/pydantic/validators.py
+++ b/pydantic/validators.py
@@ -27,8 +27,10 @@ from uuid import UUID
 from . import errors
 from .datetime_parse import parse_date, parse_datetime, parse_duration, parse_time
 from .typing import (
+    NONE_TYPES,
     AnyCallable,
     ForwardRef,
+    Literal,
     all_literal_values,
     display_as_type,
     get_class,
@@ -511,6 +513,12 @@ def any_class_validator(v: Any) -> Type[T]:
     raise errors.ClassError()
 
 
+def none_validator(v: Any) -> 'Literal[None]':
+    if v is None:
+        return v
+    raise errors.NotNoneError()
+
+
 def pattern_validator(v: Any) -> Pattern[str]:
     if isinstance(v, Pattern):
         return v
@@ -589,6 +597,9 @@ def find_validators(  # noqa: C901 (ignore complexity)
     type_type = type_.__class__
     if type_type == ForwardRef or type_type == TypeVar:
         return
+    if type_ in NONE_TYPES:
+        yield none_validator
+        return
     if type_ is Pattern:
         yield pattern_validator
         return
diff --git a/pydantic/version.py b/pydantic/version.py
index 4ba6f2dfb..dd840e984 100644
--- a/pydantic/version.py
+++ b/pydantic/version.py
@@ -1,6 +1,6 @@
 __all__ = 'VERSION', 'version_info'
 
-VERSION = '1.7.2'
+VERSION = '1.7.3'
 
 
 def version_info() -> str:


Test patch:
diff --git a/tests/requirements-linting.txt b/tests/requirements-linting.txt
index 336553d16..0dc0c0602 100644
--- a/tests/requirements-linting.txt
+++ b/tests/requirements-linting.txt
@@ -5,4 +5,4 @@ isort==5.6.4
 mypy==0.790
 pycodestyle==2.6.0
 pyflakes==2.2.0
-twine==3.2.0
+twine==3.3.0
diff --git a/tests/requirements-testing.txt b/tests/requirements-testing.txt
index bb600754b..beb21c594 100644
--- a/tests/requirements-testing.txt
+++ b/tests/requirements-testing.txt
@@ -1,4 +1,4 @@
-coverage==5.3
+coverage==5.3.1
 # pin importlib-metadata as upper versions need typing-extensions to work if on python < 3.8
 importlib-metadata==3.1.0;python_version<"3.8"
 mypy==0.790
diff --git a/tests/test_create_model.py b/tests/test_create_model.py
index f9f2862a1..44ea34c0f 100644
--- a/tests/test_create_model.py
+++ b/tests/test_create_model.py
@@ -182,3 +182,15 @@ def test_repeat_base_usage():
     assert model.__fields__.keys() == {'a', 'b'}
     assert model2.__fields__.keys() == {'a', 'c'}
     assert model3.__fields__.keys() == {'a', 'b', 'd'}
+
+
+def test_dynamic_and_static():
+    class A(BaseModel):
+        x: int
+        y: float
+        z: str
+
+    DynamicA = create_model('A', x=(int, ...), y=(float, ...), z=(str, ...))
+
+    for field_name in ('x', 'y', 'z'):
+        assert A.__fields__[field_name].default == DynamicA.__fields__[field_name].default
diff --git a/tests/test_dataclasses.py b/tests/test_dataclasses.py
index e087455b6..197db324b 100644
--- a/tests/test_dataclasses.py
+++ b/tests/test_dataclasses.py
@@ -407,7 +407,7 @@ def test_fields():
     fields = user.__pydantic_model__.__fields__
 
     assert fields['id'].required is True
-    assert fields['id'].default is Ellipsis
+    assert fields['id'].default is None
 
     assert fields['name'].required is False
     assert fields['name'].default == 'John Doe'
@@ -426,7 +426,7 @@ def test_default_factory_field():
     fields = user.__pydantic_model__.__fields__
 
     assert fields['id'].required is True
-    assert fields['id'].default is Ellipsis
+    assert fields['id'].default is None
 
     assert fields['aliases'].required is False
     assert fields['aliases'].default == {'John': 'Joey'}
diff --git a/tests/test_networks.py b/tests/test_networks.py
index 256fcd0ca..79dfb41e6 100644
--- a/tests/test_networks.py
+++ b/tests/test_networks.py
@@ -206,6 +206,15 @@ def test_at_in_path():
     assert url.path == '/@handle'
 
 
+def test_fragment_without_query():
+    url = validate_url('https://pydantic-docs.helpmanual.io/usage/types/#constrained-types')
+    assert url.scheme == 'https'
+    assert url.host == 'pydantic-docs.helpmanual.io'
+    assert url.path == '/usage/types/'
+    assert url.query is None
+    assert url.fragment == 'constrained-types'
+
+
 @pytest.mark.parametrize(
     'value',
     [
diff --git a/tests/test_types.py b/tests/test_types.py
index 457817c8f..672072e10 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -69,17 +69,13 @@ from pydantic import (
     errors,
     validator,
 )
+from pydantic.typing import Literal, NoneType
 
 try:
     import email_validator
 except ImportError:
     email_validator = None
 
-try:
-    import typing_extensions
-except ImportError:
-    typing_extensions = None
-
 
 class ConBytesModel(BaseModel):
     v: conbytes(max_length=10) = b'foobar'
@@ -2396,10 +2392,10 @@ def test_generic_without_params_error():
     ]
 
 
-@pytest.mark.skipif(not typing_extensions, reason='typing_extensions not installed')
+@pytest.mark.skipif(not Literal, reason='typing_extensions not installed')
 def test_literal_single():
     class Model(BaseModel):
-        a: typing_extensions.Literal['a']
+        a: Literal['a']
 
     Model(a='a')
     with pytest.raises(ValidationError) as exc_info:
@@ -2414,10 +2410,10 @@ def test_literal_single():
     ]
 
 
-@pytest.mark.skipif(not typing_extensions, reason='typing_extensions not installed')
+@pytest.mark.skipif(not Literal, reason='typing_extensions not installed')
 def test_literal_multiple():
     class Model(BaseModel):
-        a_or_b: typing_extensions.Literal['a', 'b']
+        a_or_b: Literal['a', 'b']
 
     Model(a_or_b='a')
     Model(a_or_b='b')
@@ -2609,3 +2605,59 @@ def test_deque_json():
         v: Deque[int]
 
     assert Model(v=deque((1, 2, 3))).json() == '{"v": [1, 2, 3]}'
+
+
+none_value_type_cases = (None, type(None), NoneType)
+if Literal:
+    none_value_type_cases += (Literal[None],)
+
+
+@pytest.mark.parametrize('value_type', none_value_type_cases)
+def test_none(value_type):
+    class Model(BaseModel):
+        my_none: value_type
+        my_none_list: List[value_type]
+        my_none_dict: Dict[str, value_type]
+        my_json_none: Json[value_type]
+
+    Model(
+        my_none=None,
+        my_none_list=[None] * 3,
+        my_none_dict={'a': None, 'b': None},
+        my_json_none='null',
+    )
+
+    assert Model.schema() == {
+        'title': 'Model',
+        'type': 'object',
+        'properties': {
+            'my_none': {'title': 'My None', 'type': 'null'},
+            'my_none_list': {
+                'title': 'My None List',
+                'type': 'array',
+                'items': {'type': 'null'},
+            },
+            'my_none_dict': {
+                'title': 'My None Dict',
+                'type': 'object',
+                'additionalProperties': {'type': 'null'},
+            },
+            'my_json_none': {'title': 'My Json None', 'type': 'null'},
+        },
+        'required': ['my_none', 'my_none_list', 'my_none_dict', 'my_json_none'],
+    }
+
+    with pytest.raises(ValidationError) as exc_info:
+        Model(
+            my_none='qwe',
+            my_none_list=[1, None, 'qwe'],
+            my_none_dict={'a': 1, 'b': None},
+            my_json_none='"a"',
+        )
+    assert exc_info.value.errors() == [
+        {'loc': ('my_none',), 'msg': 'value is not None', 'type': 'type_error.not_none'},
+        {'loc': ('my_none_list', 0), 'msg': 'value is not None', 'type': 'type_error.not_none'},
+        {'loc': ('my_none_list', 2), 'msg': 'value is not None', 'type': 'type_error.not_none'},
+        {'loc': ('my_none_dict', 'a'), 'msg': 'value is not None', 'type': 'type_error.not_none'},
+        {'loc': ('my_json_none',), 'msg': 'value is not None', 'type': 'type_error.not_none'},
+    ]