Skip to content

ROB: Initialize states array with an empty value#2280

Merged
MartinThoma merged 2 commits intopy-pdf:mainfrom
alexey-v-paramonov:main
Nov 5, 2023
Merged

ROB: Initialize states array with an empty value#2280
MartinThoma merged 2 commits intopy-pdf:mainfrom
alexey-v-paramonov:main

Conversation

@alexey-v-paramonov
Copy link
Copy Markdown
Contributor

@alexey-v-paramonov alexey-v-paramonov commented Oct 30, 2023

This is done to prevent dictionary key error below when states are not initialized

… error below when states are not initialized
@stefan6419846
Copy link
Copy Markdown
Collaborator

We should probably have a corresponding test case for this as well to ensure that it indeed does not fail.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5a2dd75) 94.45% compared to head (87d892f) 94.45%.

❗ Current head 87d892f differs from pull request most recent head 61bb49b. Consider uploading reports for the commit 61bb49b to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2280   +/-   ##
=======================================
  Coverage   94.45%   94.45%           
=======================================
  Files          43       43           
  Lines        7650     7651    +1     
  Branches     1511     1511           
=======================================
+ Hits         7226     7227    +1     
  Misses        262      262           
  Partials      162      162           
Files Coverage Δ
pypdf/_reader.py 91.69% <100.00%> (+<0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alexey-v-paramonov
Copy link
Copy Markdown
Contributor Author

CI complains about type hints, but that is not related to my change, should I fix it?

states = []

Should be

states: List[Any] = []

I guess

Co-authored-by: pubpub-zz <4083478+pubpub-zz@users.noreply.github.com>
@MartinThoma MartinThoma changed the title Initialize states array with an empty value to prevent dictionary key… ROB: Initialize states array with an empty value Nov 5, 2023
@MartinThoma MartinThoma merged commit e11c2b6 into py-pdf:main Nov 5, 2023
@MartinThoma
Copy link
Copy Markdown
Member

Thank you for your contribution @alexey-v-paramonov :-)

If you want, I can add you to https://pypdf.readthedocs.io/en/latest/meta/CONTRIBUTORS.html

@MartinThoma
Copy link
Copy Markdown
Member

@pubpub-zz @stefan6419846 Thank you for reviewing the changes 🙏

@alexey-v-paramonov
Copy link
Copy Markdown
Contributor Author

Thank you for your contribution @alexey-v-paramonov :-)

If you want, I can add you to https://pypdf.readthedocs.io/en/latest/meta/CONTRIBUTORS.html

That would be awesome! Thanks!

MartinThoma added a commit that referenced this pull request Nov 14, 2023
## What's new

### Bug Fixes (BUG)
-  Mediabox expansion size when applying non-right angle rotation (#2282) by @MrinalJain17

### Robustness (ROB)
-  MissingWidth is IndirectObject (#2288) by @MartinThoma
-  Initialize states array with an empty value (#2280) by @alexey-v-paramonov

### Documentation (DOC)
-  Typo in example in extract-attachments.md (#2285) by @ageitgey
-  Add Alexey Paramonov as a contributor for #2280 by @MartinThoma

### Maintenance (MAINT)
-  Update sample-files by @MartinThoma

[Full Changelog](3.17.0...3.17.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants