Skip to content

Commit

Permalink
test: Fix recursion issue in walkpdf (#1112)
Browse files Browse the repository at this point in the history
This fixes the recursion issue in walkpdf introduced by PyPDF==4.1.0.

This fix is based @pubpub-zz's suggestion in
py-pdf/pypdf#2508 (comment)

Fixes #1111
  • Loading branch information
kesara authored Mar 11, 2024
1 parent 37f406c commit a809924
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=3.2.1" "weasyprint>=53.0,!=57.0,!=60.0"
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.1.0" "weasyprint>=53.0,!=57.0,!=60.0"
- name: Generate Valid Tests
run: |
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=3.2.1" "weasyprint>=53.0,!=57.0,!=60.0"
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.1.0" "weasyprint>=53.0,!=57.0,!=60.0"
- name: Generate Valid Tests
run: |
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
# echo "Installing pip + wheel..."
# python -m pip install --upgrade pip wheel
# echo "Installing requirements.txt + test dependencies..."
# python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=3.2.1" "weasyprint>=53.0,!=57.0,!=60.0"
# python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.1.0" "weasyprint>=53.0,!=57.0,!=60.0"
# - name: Generate Valid Tests
# run: |
# make yestests || true
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ deps =
pyflakes
decorator
dict2xml
pypdf>=3.2.1
pypdf>=4.1.0
weasyprint>=53.0,!=57.0,!=60.0
2 changes: 1 addition & 1 deletion xml2rfc/walkpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
def walk(obj, seen):
dobj = {} # Direct objects
iobj = [] # Indirect objects
if hasattr(obj, 'keys'):
if isinstance(obj, pypdf.generic.DictionaryObject):
for key in obj.keys():
k = key[1:] if key.startswith('/') else key
d, i = walk(obj[key], seen)
Expand Down

0 comments on commit a809924

Please sign in to comment.