]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98576: Fix types in dataclass.InitVar example (gh-98577)
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>
Mon, 31 Oct 2022 15:02:02 +0000 (08:02 -0700)
committerGitHub <noreply@github.com>
Mon, 31 Oct 2022 15:02:02 +0000 (11:02 -0400)
Doc/library/dataclasses.rst

index c4895aa822bf38ce42f255a2b23d45d5effa7bba..847299649d1efd164af83be496a1870cbcd4d4cd 100644 (file)
@@ -578,8 +578,8 @@ value is not provided when creating the class::
   @dataclass
   class C:
       i: int
-      j: int = None
-      database: InitVar[DatabaseType] = None
+      j: int | None = None
+      database: InitVar[DatabaseType | None] = None
 
       def __post_init__(self, database):
           if self.j is None and database is not None: