diff options
author | V3n3RiX <venerix@koprulu.sector> | 2025-05-15 12:59:17 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2025-05-15 12:59:17 +0100 |
commit | 317f7ab04be81dbdfa5b1c9c42729927c5bde946 (patch) | |
tree | b90afe9d6ef62b771a6ddb9eb1968d6338ccd206 /dev-python/faker/files | |
parent | 5e9cf59ef591ef814092c1f6f32d2ef2369d3882 (diff) |
Diffstat (limited to 'dev-python/faker/files')
-rw-r--r-- | dev-python/faker/files/faker-37.1.0-py314.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/dev-python/faker/files/faker-37.1.0-py314.patch b/dev-python/faker/files/faker-37.1.0-py314.patch new file mode 100644 index 000000000000..9f6931ba7a8d --- /dev/null +++ b/dev-python/faker/files/faker-37.1.0-py314.patch @@ -0,0 +1,45 @@ +From eaad7bb42385793a0622376caf3b832a7836781e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Wed, 14 May 2025 13:17:48 +0200 +Subject: [PATCH] Fix type annotations for Python 3.14 + +Fix type annotations for `Provider.json()` to avoid name collision +in Python 3.14.0b1 where `json` is resolved to the `json()` method +itself rather than the `json` module. Import `JSONEncoder` directly +instead, so we can reference it without `json.`. + +Fixes #2212 +--- + faker/providers/misc/__init__.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/faker/providers/misc/__init__.py b/faker/providers/misc/__init__.py +index dca3363e..6ed2e958 100644 +--- a/faker/providers/misc/__init__.py ++++ b/faker/providers/misc/__init__.py +@@ -9,6 +9,7 @@ import tarfile + import uuid + import zipfile + ++from json import JSONEncoder + from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Set, Tuple, Type, Union, overload + + from faker.exceptions import UnsupportedFeature +@@ -536,7 +537,7 @@ class Provider(BaseProvider): + data_columns: Optional[List] = None, + num_rows: int = 10, + indent: Optional[int] = None, +- cls: Optional[Type[json.JSONEncoder]] = None, ++ cls: Optional[Type[JSONEncoder]] = None, + ) -> bytes: + """ + Generate random JSON structure and return as bytes. +@@ -551,7 +552,7 @@ class Provider(BaseProvider): + data_columns: Optional[List] = None, + num_rows: int = 10, + indent: Optional[int] = None, +- cls: Optional[Type[json.JSONEncoder]] = None, ++ cls: Optional[Type[JSONEncoder]] = None, + ) -> str: + """ + Generate random JSON structure values. |