Repository: pydantic/pydantic

Issue:
__post_init__ and validators are not triggered in class inherited from stdlib dataclass in 1.10.1
### Initial Checks

- [X] I have searched GitHub for a duplicate issue and I'm sure this is something new
- [X] I have searched Google & StackOverflow for a solution 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
- [X] I am confident that the issue is with pydantic  (not my code, or another library in the ecosystem like [FastAPI](https://fastapi.tiangolo.com) or [mypy](https://mypy.readthedocs.io/en/stable))


### Description

__post_init__ and validator are not triggered in the following code. However, uncommenting any of the lines: `py_dataclass(D_C_Base)` or `b: str = "string"` solves the issue.
Versions 1.9.x could trigger both __post_init__ and validators without these lines.



### Example Code

```Python
from dataclasses import dataclass
from pydantic.dataclasses import dataclass as py_dataclass
from pydantic import validator


@dataclass
class D_C_Base:
    a: float = 1.0

# py_dataclass(D_C_Base)

@py_dataclass
class D_C_Child(D_C_Base):
    # b: str = "string"
    
    def __post_init__(self):
        print('POST_INIT')
        
    @validator('a')
    def validate_a(cls, value):
        print(f'Validating "a" is {value}')

d_c_class = D_C_Child()
```


### Python, Pydantic & OS Version

```Text
pydantic version: 1.10.1
pydantic compiled: True
install path: C:\Users\TestUser\.conda\envs\py38\Lib\site-packages\pydantic
               python version: 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)]
platform: Windows-10-10.0.22000-SP0
optional deps. installed: ['typing-extensions']

Also,

pydantic version: 1.10.1
pydantic compiled: True
install path: /local/envs/py39_test/lib/python3.9/site-packages/pydantic
               python version: 3.9.1 (default, Dec 11 2020, 14:32:07)  [GCC 7.3.0]
platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
optional deps. installed: ['typing-extensions']
```


### Affected Components

- [X] [Compatibility between releases](https://pydantic-docs.helpmanual.io/changelog/)
- [X] [Data validation/parsing](https://pydantic-docs.helpmanual.io/usage/models/#basic-model-usage)
- [ ] [Data serialization](https://pydantic-docs.helpmanual.io/usage/exporting_models/) - `.dict()` and `.json()`
- [ ] [JSON Schema](https://pydantic-docs.helpmanual.io/usage/schema/)
- [x] [Dataclasses](https://pydantic-docs.helpmanual.io/usage/dataclasses/)
- [ ] [Model Config](https://pydantic-docs.helpmanual.io/usage/model_config/)
- [ ] [Field Types](https://pydantic-docs.helpmanual.io/usage/types/) - adding or changing a particular data type
- [ ] [Function validation decorator](https://pydantic-docs.helpmanual.io/usage/validation_decorator/)
- [ ] [Generic Models](https://pydantic-docs.helpmanual.io/usage/models/#generic-models)
- [ ] [Other Model behaviour](https://pydantic-docs.helpmanual.io/usage/models/) - `construct()`, pickling, private attributes, ORM mode
- [ ] [Settings Management](https://pydantic-docs.helpmanual.io/usage/settings/)
- [ ] [Plugins](https://pydantic-docs.helpmanual.io/) and integration with other tools - mypy, FastAPI, python-devtools, Hypothesis, VS Code, PyCharm, etc.


Comments:
I can confirm the behaviour, @PrettyWood can you look at this?

Patch:
diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py
--- a/pydantic/dataclasses.py
+++ b/pydantic/dataclasses.py
@@ -34,7 +34,20 @@ class M:
 import sys
 from contextlib import contextmanager
 from functools import wraps
-from typing import TYPE_CHECKING, Any, Callable, ClassVar, Dict, Generator, Optional, Type, TypeVar, Union, overload
+from typing import (
+    TYPE_CHECKING,
+    Any,
+    Callable,
+    ClassVar,
+    Dict,
+    Generator,
+    Optional,
+    Set,
+    Type,
+    TypeVar,
+    Union,
+    overload,
+)
 
 from typing_extensions import dataclass_transform
 
@@ -184,7 +197,7 @@ def dataclass(
     def wrap(cls: Type[Any]) -> 'DataclassClassOrWrapper':
         import dataclasses
 
-        if is_builtin_dataclass(cls):
+        if is_builtin_dataclass(cls) and _extra_dc_args(_cls) == _extra_dc_args(_cls.__bases__[0]):  # type: ignore
             dc_cls_doc = ''
             dc_cls = DataclassProxy(cls)
             default_validate_on_init = False
@@ -418,6 +431,14 @@ def _dataclass_validate_assignment_setattr(self: 'Dataclass', name: str, value:
     object.__setattr__(self, name, value)
 
 
+def _extra_dc_args(cls: Type[Any]) -> Set[str]:
+    return {
+        x
+        for x in dir(cls)
+        if x not in getattr(cls, '__dataclass_fields__', {}) and not (x.startswith('__') and x.endswith('__'))
+    }
+
+
 def is_builtin_dataclass(_cls: Type[Any]) -> bool:
     """
     Whether a class is a stdlib dataclass


Test patch:
diff --git a/tests/test_dataclasses.py b/tests/test_dataclasses.py
--- a/tests/test_dataclasses.py
+++ b/tests/test_dataclasses.py
@@ -1395,3 +1395,80 @@ class Bar:
         @pydantic.dataclasses.dataclass
         class Foo:
             a: List[Bar(a=1)]
+
+
+def test_parent_post_init():
+    @dataclasses.dataclass
+    class A:
+        a: float = 1
+
+        def __post_init__(self):
+            self.a *= 2
+
+    @pydantic.dataclasses.dataclass
+    class B(A):
+        @validator('a')
+        def validate_a(cls, value):
+            value += 3
+            return value
+
+    assert B().a == 5  # 1 * 2 + 3
+
+
+def test_subclass_post_init_post_parse():
+    @dataclasses.dataclass
+    class A:
+        a: float = 1
+
+    @pydantic.dataclasses.dataclass
+    class B(A):
+        def __post_init_post_parse__(self):
+            self.a *= 2
+
+        @validator('a')
+        def validate_a(cls, value):
+            value += 3
+            return value
+
+    assert B().a == 8  # (1 + 3) * 2
+
+
+def test_subclass_post_init():
+    @dataclasses.dataclass
+    class A:
+        a: int = 1
+
+    @pydantic.dataclasses.dataclass
+    class B(A):
+        def __post_init__(self):
+            self.a *= 2
+
+        @validator('a')
+        def validate_a(cls, value):
+            value += 3
+            return value
+
+    assert B().a == 5  # 1 * 2 + 3
+
+
+def test_subclass_post_init_inheritance():
+    @dataclasses.dataclass
+    class A:
+        a: int = 1
+
+    @pydantic.dataclasses.dataclass
+    class B(A):
+        def __post_init__(self):
+            self.a *= 2
+
+        @validator('a')
+        def validate_a(cls, value):
+            value += 3
+            return value
+
+    @pydantic.dataclasses.dataclass
+    class C(B):
+        def __post_init__(self):
+            self.a *= 3
+
+    assert C().a == 6  # 1 * 3 + 3