Repository: pydantic/pydantic

Issue:
Variable length tuples not working in 1.8.0
### 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

It wasn't clear to me from the description of the breaking changes described in 1.8.0 whether it is expected that variable length tuples should now be handled differently, but I'm seeing something similar to #2132 when nesting generics inside of a variable length tuple:

```python
from typing import Tuple
from pydantic import BaseModel

# works
class A(BaseModel):
	t: Tuple[Tuple[int]] = ()

# works
class B(BaseModel):
	t: Tuple[Tuple[int, ...]] = ()

# fails
class C(BaseModel):
	t: Tuple[Tuple[int], ...] = ()
```

```pytb
TypeError                                 Traceback (most recent call last)
~/miniconda3/envs/napdev/lib/python3.8/site-packages/pydantic/validators.cpython-38-darwin.so in pydantic.validators.find_validators()

TypeError: issubclass() arg 1 must be a class

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-3-3f541325cc4d> in <module>
----> 1 class C(BaseModel):
      2     t: Tuple[Tuple[int], ...] = ()
      3

~/miniconda3/envs/napdev/lib/python3.8/site-packages/pydantic/main.cpython-38-darwin.so in pydantic.main.ModelMetaclass.__new__()

~/miniconda3/envs/napdev/lib/python3.8/site-packages/pydantic/fields.cpython-38-darwin.so in pydantic.fields.ModelField.infer()

~/miniconda3/envs/napdev/lib/python3.8/site-packages/pydantic/fields.cpython-38-darwin.so in pydantic.fields.ModelField.__init__()

~/miniconda3/envs/napdev/lib/python3.8/site-packages/pydantic/fields.cpython-38-darwin.so in pydantic.fields.ModelField.prepare()

~/miniconda3/envs/napdev/lib/python3.8/site-packages/pydantic/fields.cpython-38-darwin.so in pydantic.fields.ModelField.populate_validators()

~/miniconda3/envs/napdev/lib/python3.8/site-packages/pydantic/validators.cpython-38-darwin.so in find_validators()

RuntimeError: error checking inheritance of typing.Tuple[int] (type: Tuple[int])
```

Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`:
```
             pydantic version: 1.8
            pydantic compiled: True
                 install path: ~/miniconda3/envs/napdev/lib/python3.8/site-packages/pydantic
               python version: 3.8.6 | packaged by conda-forge | (default, Jan 25 2021, 23:22:12)  [Clang 11.0.1 ]
                     platform: macOS-10.15.7-x86_64-i386-64bit
     optional deps. installed: ['typing-extensions']
```



Discussion:

Resolving patch:
diff --git a/pydantic/fields.py b/pydantic/fields.py
--- a/pydantic/fields.py
+++ b/pydantic/fields.py
@@ -538,6 +538,7 @@ def _type_analysis(self) -> None:  # noqa: C901 (ignore complexity)
             elif len(args) == 2 and args[1] is Ellipsis:  # e.g. Tuple[int, ...]
                 self.type_ = args[0]
                 self.shape = SHAPE_TUPLE_ELLIPSIS
+                self.sub_fields = [self._create_sub_type(args[0], f'{self.name}_0')]
             elif args == ((),):  # Tuple[()] means empty tuple
                 self.shape = SHAPE_TUPLE
                 self.type_ = Any


Test patch:
diff --git a/tests/test_edge_cases.py b/tests/test_edge_cases.py
--- a/tests/test_edge_cases.py
+++ b/tests/test_edge_cases.py
@@ -203,12 +203,19 @@ class Model(BaseModel):
         empty_tuple: Tuple[()]
         simple_tuple: tuple = None
         tuple_of_different_types: Tuple[int, float, str, bool] = None
+        tuple_of_single_tuples: Tuple[Tuple[int], ...] = ()
 
-    m = Model(empty_tuple=[], simple_tuple=[1, 2, 3, 4], tuple_of_different_types=[4, 3, 2, 1])
+    m = Model(
+        empty_tuple=[],
+        simple_tuple=[1, 2, 3, 4],
+        tuple_of_different_types=[4, 3, 2, 1],
+        tuple_of_single_tuples=(('1',), (2,)),
+    )
     assert m.dict() == {
         'empty_tuple': (),
         'simple_tuple': (1, 2, 3, 4),
         'tuple_of_different_types': (4, 3.0, '2', True),
+        'tuple_of_single_tuples': ((1,), (2,)),
     }