Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: py-pdf/pypdf
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.28.1
Choose a base ref
...
head repository: py-pdf/pypdf
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.28.2
Choose a head ref
  • 3 commits
  • 5 files changed
  • 2 contributors

Commits on May 23, 2022

  1. 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
    MasterOdin authored May 23, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    68c9202 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9947c7b View commit details
  3. REL: 1.28.2

    Bug Fixes (BUG):
    -  PendingDeprecationWarning for getContents (#893)
    -  PendingDeprecationWarning on using PdfMerger (#891)
    MartinThoma committed May 23, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    MartinThoma Martin Thoma
    Copy the full SHA
    c68b98d View commit details
Showing with 19 additions and 8 deletions.
  1. +9 −0 CHANGELOG
  2. +1 −1 PyPDF2/_page.py
  3. +1 −1 PyPDF2/_version.py
  4. +4 −4 PyPDF2/merger.py
  5. +4 −2 Tests/test_utils.py
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Version 1.28.2, 2022-05-23
--------------------------

Bug Fixes (BUG):
- PendingDeprecationWarning for getContents (#893)
- PendingDeprecationWarning on using PdfMerger (#891)

Full Changelog: https://github.com/py-pdf/PyPDF2/compare/1.28.1...1.28.2

Version 1.28.1, 2022-05-22
--------------------------

2 changes: 1 addition & 1 deletion PyPDF2/_page.py
Original file line number Diff line number Diff line change
@@ -495,7 +495,7 @@ def _merge_page(self, page2, page2transformation=None, ctm=None, expand=False):
PageObject._push_pop_gs(original_content, self.pdf)
)

page2content = page2.getContents()
page2content = page2.get_contents()
if page2content is not None:
page2content = ContentStream(page2content, self.pdf)
page2content.operations.insert(
2 changes: 1 addition & 1 deletion PyPDF2/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.28.1"
__version__ = "1.28.2"
8 changes: 4 additions & 4 deletions PyPDF2/merger.py
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
from sys import version_info

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

dests = reader.namedDestinations
dests = reader.named_destinations
trimmed_dests = self._trim_dests(reader, dests, pages)
self.named_dests += trimmed_dests

@@ -241,7 +241,7 @@ def write(self, fileobj):
file-like object.
"""
my_file = False
if isString(fileobj):
if _isString(fileobj):
fileobj = file(fileobj, "wb")
my_file = True

6 changes: 4 additions & 2 deletions Tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -18,11 +18,13 @@
[(0, True), (-1, True), (1, True), ("1", False), (1.5, False)],
)
def test_isInt(value, expected):
assert PyPDF2._utils.isInt(value) == expected
with pytest.warns(UserWarning):
assert PyPDF2._utils.isInt(value) == expected


def test_isBytes():
assert PyPDF2._utils.isBytes(b"")
with pytest.warns(UserWarning):
assert PyPDF2._utils.isBytes(b"")


@pytest.mark.parametrize(