Skip to content
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

fix: prevent overwriting of the warnings by PyPDF2 #20170

Merged
merged 2 commits into from Feb 28, 2023

Conversation

jll-02
Copy link
Contributor

@jll-02 jll-02 commented Feb 27, 2023

When creating an Object of the class PDFFileReader from the package PyPDF2 the global warning function will be overwritten. This definitely happens in version 13, since it uses PyPDF2 in version 1.26.0 where it is done by the standard.

This causes problems e.g. in unit tests when warnings are being thrown since some part of the handling in the PDFFileReader warning is incompatible with other warnings and causes an error.

However, there is a simple solution to this because the constructor of the PDFFileReader accepts an argument to skip the overwriting of the warnings.

This problem is also known to PyPDF2 and also fixed in version 2 of PyPDF. Since frappe version 13 uses version 1.26.0 of PyPDF2 it is necessary to adapt to this problem.

For more information on PyPDF2 site check the following issue in their repository: py-pdf/pypdf#67

In this issue, there is also stated that the argument for the constructor is the correct and best way to solve this problem.

PyPDF2 overwrites the warning function which causes a follow-up problem where warnings can not be displayed
PyPDF2 overwrites the warning function which causes a follow-up problem where warnings can not be displayed
@jll-02 jll-02 requested a review from a team as a code owner February 27, 2023 11:38
@jll-02 jll-02 requested review from phot0n and removed request for a team February 27, 2023 11:38
@ankush ankush merged commit dca7c38 into frappe:version-13-hotfix Feb 28, 2023
frappe-pr-bot pushed a commit that referenced this pull request Feb 28, 2023
# [13.50.0](v13.49.3...v13.50.0) (2023-02-28)

### Bug Fixes

* german translations (backport [#17663](#17663)) ([#20114](#20114)) ([1a38314](1a38314))
* hide invalid filters for 'HTML Editor' and 'Markdown Editor' ([#20119](#20119)) ([#20127](#20127)) ([1c69d43](1c69d43))
* prevent overwriting of the warnings by PyPDF2 ([#20170](#20170)) ([dca7c38](dca7c38))
* raise_exception=False for has_permission in filter_allowed_users ([#20113](#20113)) ([#20122](#20122)) ([23137f2](23137f2))
* Reload frm doc doc_update trigger to avoid timestamp conflict ([df4d3a2](df4d3a2))
* support for different delimiter for timeline email linking (backport [#19751](#19751)) ([#20154](#20154)) ([ea78695](ea78695))
* **UX:** Freeze form while applying workflow ([db93700](db93700))
* **UX:** invalid filters, incorrect std fieldtypes (backport [#19657](#19657)) ([#20118](#20118)) ([a612baa](a612baa))
* **workflow:** move dom unfreeze to `finally` (backport [#20161](#20161)) ([#20176](#20176)) ([14abb0e](14abb0e))

### Features

* Request, Job Hooks {Before/After} (backport [#19971](#19971)) ([#20073](#20073)) ([17adda2](17adda2))
@frappe-pr-bot
Copy link
Collaborator

🎉 This PR is included in version 13.50.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants