Skip to content

Commit edf41ae

Browse files
authored
Update type of Formatter.convert_field (missing |None) (#11377)
From the source it expects that the second parameter (conversion), can be None: ```python def convert_field(self, value, conversion): # do any conversion on the resulting object if conversion is None: return value ... ``` Since at least 17 years according to git blame, as None is refered as early as 11529195cae2438a3ac003babcb1b11af67c4037 And still present in main branch: https://github.com/python/cpython/blob/ef3ceab09d2d0959c343c662461123d5b0e0b64b/Lib/string.py
1 parent 994d22b commit edf41ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/string.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ class Formatter:
8080
def get_value(self, key: int | str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
8181
def check_unused_args(self, used_args: set[int | str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ...
8282
def format_field(self, value: Any, format_spec: str) -> Any: ...
83-
def convert_field(self, value: Any, conversion: str) -> Any: ...
83+
def convert_field(self, value: Any, conversion: str | None) -> Any: ...

0 commit comments

Comments
 (0)