Skip to content

Commit

Permalink
Adjust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed May 29, 2022
1 parent f7a3723 commit 6becad1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions PyPDF2/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ class PdfReader:
:param bool strict: Determines whether user should be warned of all
problems and also causes some correctable problems to be fatal.
Defaults to ``False``.
:param None/str/bytes password: Decrypt pdf at initialization. if None, decrypt will be called
:param None/str/bytes password: Decrypt PDF file at initialization. If the
password is None, the file will not be decrypted.
Defaults to ``None``
"""

Expand Down Expand Up @@ -261,9 +262,8 @@ def __init__(
self.stream = stream

self._override_encryption = False
if password is not None:
if self.decrypt(password) == 0:
raise PdfReadError("Wrong password")
if password is not None and self.decrypt(password) == 0:
raise PdfReadError("Wrong password")

@property
def metadata(self) -> Optional[DocumentInformation]:
Expand Down

0 comments on commit 6becad1

Please sign in to comment.