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 error generation for missing pgf.texsystem. #26689

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 4, 2023

If pgf.texsystem isn't installed, then self.latex will not be created at all by _setup_latex_process, and we thus cannot access self.latex.args[0], but must instead read the rc value again. To make this clearer, move the error handling into _setup_latex_process, instead of having it outside.

No test because that'd require setting up a test env where pgf.texsystem is explicitly missing (or go through lots of mocks), which seems not worth it.

This is (I think) the origin of the AttributeError in #26551.

PR summary

PR checklist

) from err
except OSError as err:
raise RuntimeError(
f"Error starting process {self.latex.args[0]!r}") from err
Copy link
Member

@timhoffm timhoffm Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? AFAICS, if the try block raises self.latex is not set in this method, i.e. it will be whatever it was before, possibly None?!?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, there was the same bug there as with the FileNotFoundError case; fixed it too.

If pgf.texsystem isn't installed, then self.latex will not be created
*at all* by _setup_latex_process, and we thus cannot access
self.latex.args[0], but must instead read the rc value again.  To make
this clearer, move the error handling into _setup_latex_process, instead
of having it outside.

No test because that'd require setting up a test env where pgf.texsystem
is explicitly *missing* (or go through lots of mocks), which seems not
worth it.
@ksunden ksunden added this to the v3.8.0 milestone Sep 4, 2023
@ksunden ksunden merged commit 5f785e3 into matplotlib:main Sep 4, 2023
39 of 40 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 4, 2023
@anntzer anntzer deleted the pgferr branch September 4, 2023 18:32
oscargus added a commit that referenced this pull request Sep 5, 2023
…689-on-v3.8.x

Backport PR #26689 on branch v3.8.x (Fix error generation for missing pgf.texsystem.)
@ksunden ksunden mentioned this pull request Sep 15, 2023
5 tasks
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Feb 14, 2024
Fix error generation for missing pgf.texsystem.

(cherry picked from commit 5f785e3)
@QuLogic QuLogic mentioned this pull request Feb 14, 2024
1 task
@QuLogic QuLogic modified the milestones: v3.8.0, v3.7.5 Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants