Skip to content

Commit

Permalink
BUG: Wrong page inserted when PdfMerger.merge is done
Browse files Browse the repository at this point in the history
Caused-by: #207

Why it wasn't detected by the tests: We don't have any tests that check
for the correct result of a merge. We just check for exceptions

Closes: #1062
  • Loading branch information
MartinThoma committed Jul 5, 2022
1 parent 1e9c4dd commit f230ed5
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions PyPDF2/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,16 +913,8 @@ def _sweep_indirect_references(
if newobj is None:
try:
newobj = data.pdf.get_object(data)
hash_value = None
if newobj is not None:
hash_value = newobj.hash_value()
# Check if object is already added to pdf.
if hash_value in self._idnum_hash:
return IndirectObject(self._idnum_hash[hash_value], 0, self)
self._objects.append(None) # placeholder
idnum = len(self._objects)
if hash_value is not None:
self._idnum_hash[hash_value] = idnum
newobj_ido = IndirectObject(idnum, 0, self)
if data.pdf not in extern_map:
extern_map[data.pdf] = {}
Expand Down

0 comments on commit f230ed5

Please sign in to comment.