prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Сreating a child model causes a RecursionError exception
  <!-- Questions, Feature Requests, and Bug Reports are all welcome -->
  <!-- delete as applicable: -->
  # Bug
  
  * OS: **Ubuntu 14.04**
  * Python version `import sys; print(sys.version)`: **3.6.7**
  * Pydantic version `import pydantic; print(pydantic.VERSION)`: **0.14**
  
  I'm expecting, that I can use a classic inheritance for dataclass models:
  ```py
  import pydantic.dataclasses
  
  @pydantic.dataclasses.dataclass
  class A:
      a: str = None
  
  @pydantic.dataclasses.dataclass
  class B(A):
      b: str = None
  
  B(a='a', b='b')
  ```
  
  But as a result I'm receiving this:
  ```
  Traceback (most recent call last):
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "<ipython-input-9-10a7116ca691>", line 12, in <module>
      B(a='a', b='b')
    File "<string>", line 4, in __init__
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/dataclasses.py", line 13, in post_init
      self.__post_init_original__()
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/dataclasses.py", line 13, in post_init
      self.__post_init_original__()
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/dataclasses.py", line 13, in post_init
      self.__post_init_original__()
    [Previous line repeated 952 more times]
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/dataclasses.py", line 9, in post_init
      d = validate_model(self.__pydantic_model__, self.__dict__)
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/main.py", line 484, in validate_model
      v_, errors_ = field.validate(value, values, loc=field.alias, cls=model.__class__)
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/fields.py", line 303, in validate
      v, errors = self._validate_singleton(v, values, loc, cls)
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/fields.py", line 406, in _validate_singleton
      return self._apply_validators(v, values, loc, cls, self.validators)
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/fields.py", line 412, in _apply_validators
      v = validator(v)
    File "/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/validators.py", line 23, in str_validator
      if isinstance(v, (str, NoneType)):
  RecursionError: maximum recursion depth exceeded in __instancecheck__
  ```
  This line below causes this problem:
  https://github.com/samuelcolvin/pydantic/blob/master/pydantic/dataclasses.py#L13
  
  UPD: defining `__post_init__` in child model fixes the problem, but this is workaround.
  ```py
  import pydantic.dataclasses
  
  @pydantic.dataclasses.dataclass
  class A:
      a: str = None
  
  @pydantic.dataclasses.dataclass
  class B(A):
      b: str = None
  
      def __post_init__():
          pass
  
  B(a='a', b='b')
  ```
  
  </issue>
  <code>
  [start of pydantic/dataclasses.py]
  1 import dataclasses
  2 
  3 from pydantic import ValidationError
  4 
  5 from .main import create_model, validate_model
  6 
  7 
  8 def post_init(self):
  9     d = validate_model(self.__pydantic_model__, self.__dict__)
  10     object.__setattr__(self, '__dict__', d)
  11     object.__setattr__(self, '__initialised__', True)
  12     if self.__post_init_original__:
  13         self.__post_init_original__()
  14 
  15 
  16 def setattr_validate_assignment(self, name, value):
  17     if self.__initialised__:
  18         d = dict(self.__dict__)
  19         d.pop(name)
  20         value, error_ = self.__pydantic_model__.__fields__[name].validate(value, d, loc=name)
  21         if error_:
  22             raise ValidationError([error_])
  23 
  24     object.__setattr__(self, name, value)
  25 
  26 
  27 def _process_class(_cls, init, repr, eq, order, unsafe_hash, frozen, validate_assignment):
  28     post_init_original = getattr(_cls, '__post_init__', None)
  29     _cls.__post_init__ = post_init
  30     cls = dataclasses._process_class(_cls, init, repr, eq, order, unsafe_hash, frozen)
  31 
  32     fields = {name: (field.type, field.default) for name, field in cls.__dataclass_fields__.items()}
  33     cls.__post_init_original__ = post_init_original
  34     cls.__pydantic_model__ = create_model(cls.__name__, **fields)
  35     cls.__initialised__ = False
  36 
  37     if validate_assignment and not frozen:
  38         cls.__setattr__ = setattr_validate_assignment
  39     return cls
  40 
  41 
  42 def dataclass(
  43     _cls=None, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, validate_assignment=False
  44 ):
  45     """
  46     Like the python standard lib dataclasses but with type validation.
  47 
  48     Arguments are the same as for standard dataclasses, except for validate_assignment which has the same meaning
  49     as Config.validate_assignment.
  50     """
  51 
  52     def wrap(cls):
  53         return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, validate_assignment)
  54 
  55     if _cls is None:
  56         return wrap
  57 
  58     return wrap(_cls)
  59
  [end of pydantic/dataclasses.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py
  --- a/pydantic/dataclasses.py
  +++ b/pydantic/dataclasses.py
  @@ -5,7 +5,7 @@
   from .main import create_model, validate_model
   
   
  -def post_init(self):
  +def _pydantic_post_init(self):
       d = validate_model(self.__pydantic_model__, self.__dict__)
       object.__setattr__(self, '__dict__', d)
       object.__setattr__(self, '__initialised__', True)
  @@ -26,7 +26,9 @@
   
   def _process_class(_cls, init, repr, eq, order, unsafe_hash, frozen, validate_assignment):
       post_init_original = getattr(_cls, '__post_init__', None)
  -    _cls.__post_init__ = post_init
  +    if post_init_original and post_init_original.__name__ == '_pydantic_post_init':
  +        post_init_original = None
  +    _cls.__post_init__ = _pydantic_post_init
       cls = dataclasses._process_class(_cls, init, repr, eq, order, unsafe_hash, frozen)
   
       fields = {name: (field.type, field.default) for name, field in cls.__dataclass_fields__.items()}
  
verification_info: {"golden_diff": "diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py\n--- a/pydantic/dataclasses.py\n+++ b/pydantic/dataclasses.py\n@@ -5,7 +5,7 @@\n from .main import create_model, validate_model\n \n \n-def post_init(self):\n+def _pydantic_post_init(self):\n     d = validate_model(self.__pydantic_model__, self.__dict__)\n     object.__setattr__(self, '__dict__', d)\n     object.__setattr__(self, '__initialised__', True)\n@@ -26,7 +26,9 @@\n \n def _process_class(_cls, init, repr, eq, order, unsafe_hash, frozen, validate_assignment):\n     post_init_original = getattr(_cls, '__post_init__', None)\n-    _cls.__post_init__ = post_init\n+    if post_init_original and post_init_original.__name__ == '_pydantic_post_init':\n+        post_init_original = None\n+    _cls.__post_init__ = _pydantic_post_init\n     cls = dataclasses._process_class(_cls, init, repr, eq, order, unsafe_hash, frozen)\n \n     fields = {name: (field.type, field.default) for name, field in cls.__dataclass_fields__.items()}\n", "issue": "\u0421reating a child model causes a RecursionError exception\n<!-- Questions, Feature Requests, and Bug Reports are all welcome -->\r\n<!-- delete as applicable: -->\r\n# Bug\r\n\r\n* OS: **Ubuntu 14.04**\r\n* Python version `import sys; print(sys.version)`: **3.6.7**\r\n* Pydantic version `import pydantic; print(pydantic.VERSION)`: **0.14**\r\n\r\nI'm expecting, that I can use a classic inheritance for dataclass models:\r\n```py\r\nimport pydantic.dataclasses\r\n\r\n@pydantic.dataclasses.dataclass\r\nclass A:\r\n    a: str = None\r\n\r\n@pydantic.dataclasses.dataclass\r\nclass B(A):\r\n    b: str = None\r\n\r\nB(a='a', b='b')\r\n```\r\n\r\nBut as a result I'm receiving this:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/IPython/core/interactiveshell.py\", line 2881, in run_code\r\n    exec(code_obj, self.user_global_ns, self.user_ns)\r\n  File \"<ipython-input-9-10a7116ca691>\", line 12, in <module>\r\n    B(a='a', b='b')\r\n  File \"<string>\", line 4, in __init__\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/dataclasses.py\", line 13, in post_init\r\n    self.__post_init_original__()\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/dataclasses.py\", line 13, in post_init\r\n    self.__post_init_original__()\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/dataclasses.py\", line 13, in post_init\r\n    self.__post_init_original__()\r\n  [Previous line repeated 952 more times]\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/dataclasses.py\", line 9, in post_init\r\n    d = validate_model(self.__pydantic_model__, self.__dict__)\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/main.py\", line 484, in validate_model\r\n    v_, errors_ = field.validate(value, values, loc=field.alias, cls=model.__class__)\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/fields.py\", line 303, in validate\r\n    v, errors = self._validate_singleton(v, values, loc, cls)\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/fields.py\", line 406, in _validate_singleton\r\n    return self._apply_validators(v, values, loc, cls, self.validators)\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/fields.py\", line 412, in _apply_validators\r\n    v = validator(v)\r\n  File \"/usr/local/pyenv/versions/3.6.7/lib/python3.6/site-packages/pydantic/validators.py\", line 23, in str_validator\r\n    if isinstance(v, (str, NoneType)):\r\nRecursionError: maximum recursion depth exceeded in __instancecheck__\r\n```\r\nThis line below causes this problem:\r\nhttps://github.com/samuelcolvin/pydantic/blob/master/pydantic/dataclasses.py#L13\r\n\r\nUPD: defining `__post_init__` in child model fixes the problem, but this is workaround.\r\n```py\r\nimport pydantic.dataclasses\r\n\r\n@pydantic.dataclasses.dataclass\r\nclass A:\r\n    a: str = None\r\n\r\n@pydantic.dataclasses.dataclass\r\nclass B(A):\r\n    b: str = None\r\n\r\n    def __post_init__():\r\n        pass\r\n\r\nB(a='a', b='b')\r\n```\n", "before_files": [{"content": "import dataclasses\n\nfrom pydantic import ValidationError\n\nfrom .main import create_model, validate_model\n\n\ndef post_init(self):\n    d = validate_model(self.__pydantic_model__, self.__dict__)\n    object.__setattr__(self, '__dict__', d)\n    object.__setattr__(self, '__initialised__', True)\n    if self.__post_init_original__:\n        self.__post_init_original__()\n\n\ndef setattr_validate_assignment(self, name, value):\n    if self.__initialised__:\n        d = dict(self.__dict__)\n        d.pop(name)\n        value, error_ = self.__pydantic_model__.__fields__[name].validate(value, d, loc=name)\n        if error_:\n            raise ValidationError([error_])\n\n    object.__setattr__(self, name, value)\n\n\ndef _process_class(_cls, init, repr, eq, order, unsafe_hash, frozen, validate_assignment):\n    post_init_original = getattr(_cls, '__post_init__', None)\n    _cls.__post_init__ = post_init\n    cls = dataclasses._process_class(_cls, init, repr, eq, order, unsafe_hash, frozen)\n\n    fields = {name: (field.type, field.default) for name, field in cls.__dataclass_fields__.items()}\n    cls.__post_init_original__ = post_init_original\n    cls.__pydantic_model__ = create_model(cls.__name__, **fields)\n    cls.__initialised__ = False\n\n    if validate_assignment and not frozen:\n        cls.__setattr__ = setattr_validate_assignment\n    return cls\n\n\ndef dataclass(\n    _cls=None, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, validate_assignment=False\n):\n    \"\"\"\n    Like the python standard lib dataclasses but with type validation.\n\n    Arguments are the same as for standard dataclasses, except for validate_assignment which has the same meaning\n    as Config.validate_assignment.\n    \"\"\"\n\n    def wrap(cls):\n        return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, validate_assignment)\n\n    if _cls is None:\n        return wrap\n\n    return wrap(_cls)\n", "path": "pydantic/dataclasses.py"}]}