Skip to content

Commit 235c784

Browse files
authored
Merge branch 'py-pdf:main' into issue-3290
2 parents 09ea9b0 + e8e2ab6 commit 235c784

24 files changed

+160
-76
lines changed

.github/workflows/benchmark.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: actions/setup-python@v5
2525
with:
2626
python-version: ${{ matrix.python-version }}
27-
- name: Install requirements (Python 3)
27+
- name: Install requirements
2828
run: |
2929
pip install -r requirements/ci-3.11.txt
3030
- name: Install pypdf
@@ -46,4 +46,3 @@ jobs:
4646
alert-threshold: '200%'
4747
comment-on-alert: true
4848
fail-on-alert: true
49-
alert-comment-cc-users: '@MartinThoma'

.github/workflows/github-ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
python -c "from tests import download_test_pdfs; download_test_pdfs()"
5050
- name: Test with pytest
5151
run: |
52-
python -m pytest tests --cov=pypdf --cov-append -n auto -vv
52+
python -m pytest tests --cov=pypdf --cov-append -n auto -vv -p no:benchmark
5353
5454
5555
tests:
@@ -137,7 +137,7 @@ jobs:
137137
echo " pass" >> $SITECUSTOMIZE_PATH
138138
- name: Test with pytest
139139
run: |
140-
python -m pytest tests --cov=pypdf --cov-append -n auto -vv
140+
python -m pytest tests --cov=pypdf --cov-append -n auto -vv -p no:benchmark
141141
env:
142142
COVERAGE_PROCESS_START: 'pyproject.toml'
143143
- name: Rename coverage data file
@@ -197,7 +197,7 @@ jobs:
197197
- uses: actions/checkout@v4
198198
- uses: actions/setup-python@v5
199199
with:
200-
python-version: ${{env.PYTHON_LATEST}}
200+
python-version: ${{ env.PYTHON_LATEST }}
201201

202202
- run: python -m pip install flit check-wheel-contents
203203
- run: flit build
@@ -221,7 +221,7 @@ jobs:
221221
- uses: actions/setup-python@v5
222222
with:
223223
# Use latest Python, so it understands all syntax.
224-
python-version: ${{env.PYTHON_LATEST}}
224+
python-version: ${{ env.PYTHON_LATEST }}
225225

226226
- run: python -m pip install --upgrade coverage[toml]
227227

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
args: [--py38-plus]
3232

3333
- repo: https://github.com/pre-commit/mirrors-mypy
34-
rev: 'v1.15.0'
34+
rev: 'v1.16.0'
3535
hooks:
3636
- id: mypy
3737
additional_dependencies: [types-Pillow==10.2.0.20240822]

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# CHANGELOG
22

3+
## Version 5.6.0, 2025-06-01
4+
5+
### New Features (ENH)
6+
- Add basic support for JBIG2 by using jbig2dec (#3163)
7+
8+
### Bug Fixes (BUG)
9+
- Fix crashes by removing unnecessary line (#3293)
10+
- Add delimiters to NameObject.renumber_table (#3286)
11+
12+
### Robustness (ROB)
13+
- Handle DecodeParms being a NullObject (#3285)
14+
15+
### Code Style (STY)
16+
- Update to mypy 1.16.0 (#3300)
17+
18+
[Full Changelog](https://github.com/py-pdf/pypdf/compare/5.5.0...5.6.0)
19+
320
## Version 5.5.0, 2025-05-11
421

522
### New Features (ENH)

pypdf/_cmap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ._codecs import adobe_glyphs, charset_encoding
77
from ._utils import logger_error, logger_warning
88
from .generic import (
9+
ArrayObject,
910
DecodedStreamObject,
1011
DictionaryObject,
1112
StreamObject,
@@ -443,7 +444,7 @@ def build_font_width_map(
443444
)
444445
break
445446
elif "/Widths" in ft:
446-
w = ft["/Widths"].get_object()
447+
w = cast(ArrayObject, ft["/Widths"].get_object())
447448
if "/FontDescriptor" in ft and "/MissingWidth" in cast(
448449
DictionaryObject, ft["/FontDescriptor"]
449450
):

pypdf/_doc_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def viewer_preferences(self) -> Optional[ViewerPreferences]:
329329
o = o.get_object()
330330
if not isinstance(o, ViewerPreferences):
331331
o = ViewerPreferences(o)
332-
if hasattr(o, "indirect_reference"):
332+
if hasattr(o, "indirect_reference") and o.indirect_reference is not None:
333333
self._replace_object(o.indirect_reference, o)
334334
else:
335335
self.root_object[NameObject(CD.VIEWER_PREFERENCES)] = o

pypdf/_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,7 @@ def merge_transformed_page(
14301430
self._merge_page(
14311431
page2,
14321432
lambda page2Content: PageObject._add_transformation_matrix(
1433-
page2Content, page2.pdf, cast(CompressedTransformationMatrix, ctm)
1433+
page2Content, page2.pdf, ctm
14341434
),
14351435
ctm,
14361436
over,

pypdf/_reader.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def _info(self) -> Optional[DictionaryObject]:
254254
info = self.trailer.get(TK.INFO, None)
255255
if is_null_or_none(info):
256256
return None
257+
assert info is not None, "mypy"
257258
info = info.get_object()
258259
if not isinstance(info, DictionaryObject):
259260
raise PdfReadError(
@@ -271,7 +272,10 @@ def _ID(self) -> Optional[ArrayObject]:
271272
272273
"""
273274
id = self.trailer.get(TK.ID, None)
274-
return None if is_null_or_none(id) else cast(ArrayObject, id.get_object())
275+
if is_null_or_none(id):
276+
return None
277+
assert id is not None, "mypy"
278+
return cast(ArrayObject, id.get_object())
275279

276280
@property
277281
def pdf_header(self) -> str:

pypdf/_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ def rename_kwargs(
466466
f"{old_term} is deprecated as an argument. Use {new_term} instead"
467467
),
468468
category=DeprecationWarning,
469+
stacklevel=3,
469470
)
470471

471472

pypdf/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "5.5.0"
1+
__version__ = "5.6.0"

0 commit comments

Comments
 (0)