Skip to content

Commit

Permalink
STY: Use raw string notation for regular expression (#3015)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-t-1 authored Dec 21, 2024
1 parent 4f2cd34 commit dd6178b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pypdf/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@ def _read_standard_xref_table(self, stream: StreamType) -> None:

offset, generation = int(offset_b), int(generation_b)
except Exception:
# if something wrong occurred
if hasattr(stream, "getbuffer"):
buf = bytes(stream.getbuffer())
else:
Expand All @@ -783,7 +782,7 @@ def _read_standard_xref_table(self, stream: StreamType) -> None:
buf = stream.read(-1)
stream.seek(p)

f = re.search(f"{num}\\s+(\\d+)\\s+obj".encode(), buf)
f = re.search(rf"{num}\s+(\d+)\s+obj".encode(), buf)
if f is None:
logger_warning(
f"entry {num} in Xref table invalid; object not found",
Expand Down

0 comments on commit dd6178b

Please sign in to comment.