Skip to content

Commit

Permalink
BUG: Add deprecated EncodedStreamObject functions back until PyPDF2==…
Browse files Browse the repository at this point in the history
…3.0.0 (#1139)

Accidentally, PyPDF2 did not follow the deprecation process:
https://pypdf2.readthedocs.io/en/latest/dev/deprecations.html

ISSUE: The EncodedStreamObject.getData / setData were removed
AFFECTS: PyPDF2>=1.28.3,<=2.6.0
FIX: Add the getData / setData methods back with deprecation warnings

Closes #1138
  • Loading branch information
MasterOdin authored Jul 21, 2022
1 parent fa96d66 commit e1f9772
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions PyPDF2/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,9 +1162,17 @@ def get_data(self) -> Union[None, str, bytes]:
self.decoded_self = decoded
return decoded._data

def getData(self) -> Union[None, str, bytes]: # pragma: no cover
deprecate_with_replacement("getData", "get_data")
return self.get_data()

def set_data(self, data: Any) -> None:
raise PdfReadError("Creating EncodedStreamObject is not currently supported")

def setData(self, data: Any) -> None: # pragma: no cover
deprecate_with_replacement("setData", "set_data")
return self.set_data(data)


class ContentStream(DecodedStreamObject):
def __init__(
Expand Down

0 comments on commit e1f9772

Please sign in to comment.