diff --git a/pypdf/_doc_common.py b/pypdf/_doc_common.py index e8b7a0665..6757a6211 100644 --- a/pypdf/_doc_common.py +++ b/pypdf/_doc_common.py @@ -715,7 +715,7 @@ def indexed_key(k: str, fields: Dict[Any, Any]) -> str: return ( k + "." - + str(sum([1 for kk in fields if kk.startswith(k + ".")]) + 2) + + str(sum(1 for kk in fields if kk.startswith(k + ".")) + 2) ) # Retrieve document form fields diff --git a/pypdf/_reader.py b/pypdf/_reader.py index b04ea1761..16c24db09 100644 --- a/pypdf/_reader.py +++ b/pypdf/_reader.py @@ -1181,7 +1181,7 @@ def add_form_topname(self, name: str) -> Optional[DictionaryObject]: interim[NameObject("/Kids")] = acroform[NameObject("/Fields")] self.cache_indirect_object( 0, - max([i for (g, i) in self.resolved_objects if g == 0]) + 1, + max(i for (g, i) in self.resolved_objects if g == 0) + 1, interim, ) arr = ArrayObject()