Skip to content

Commit 68c9202

Browse files
authored
BUG: Fix deprecation warning on using PdfMerger (#891)
Fixes a deprecation warning being raised when trying to use the PdfMerger class. This regression of #887 is caused by #889 which reversed the changes done to the PyPDF2/merger.py module so that it once again used the deprecated user-facing isString method as opposed to the internal _isString method. Additionally, this PR fixes the deprecation warning raised by referencing reader.namedDestinations as opposed to reader.named_destinations. Closes #890
1 parent 000ac49 commit 68c9202

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

PyPDF2/merger.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from sys import version_info
3030

3131
from PyPDF2._reader import PdfReader
32-
from PyPDF2._utils import DEPR_MSG, isString, str_
32+
from PyPDF2._utils import _isString, DEPR_MSG, str_
3333
from PyPDF2._writer import PdfWriter
3434
from PyPDF2.constants import PagesAttributes as PA
3535
from PyPDF2.generic import *
@@ -130,7 +130,7 @@ def merge(
130130
# BytesIO (or StreamIO) stream.
131131
# If fileobj is none of the above types, it is not modified
132132
decryption_key = None
133-
if isString(fileobj):
133+
if _isString(fileobj):
134134
fileobj = file(fileobj, "rb")
135135
my_file = True
136136
elif hasattr(fileobj, "seek") and hasattr(fileobj, "read"):
@@ -185,7 +185,7 @@ def merge(
185185
else:
186186
self.bookmarks += outline
187187

188-
dests = reader.namedDestinations
188+
dests = reader.named_destinations
189189
trimmed_dests = self._trim_dests(reader, dests, pages)
190190
self.named_dests += trimmed_dests
191191

@@ -241,7 +241,7 @@ def write(self, fileobj):
241241
file-like object.
242242
"""
243243
my_file = False
244-
if isString(fileobj):
244+
if _isString(fileobj):
245245
fileobj = file(fileobj, "wb")
246246
my_file = True
247247

0 commit comments

Comments
 (0)