Skip to content

ROB: Initialize states array with an empty value #2280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2023

Conversation

alexey-v-paramonov
Copy link
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
Collaborator

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

@codecov
Copy link

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
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

@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
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
Member

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

@alexey-v-paramonov
Copy link
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