FIX: interpolate the path and name MPLCONFIGDIR in the temp cache dir warning by rokokol · Pull Request #32252 · matplotlib/matplotlib · GitHub
Skip to content

FIX: interpolate the path and name MPLCONFIGDIR in the temp cache dir warning - #32252

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
rokokol:fix-mplconfigdir-warning
Aug 31, 2026
Merged

QuLogic merged 1 commit into
matplotlib:mainfrom
rokokol:fix-mplconfigdir-warning

Conversation

@rokokol

@rokokol rokokol commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

PR summary

When Matplotlib falls back to a temporary cache directory, the warning has two problems (discussed in #32246):

  1. Since Added handling for undetermined home directory #30454 it prints a literal {configdir}: the message text was refactored into the issue_msg variable and lost its f prefix on the way. The regression ships in releases since 3.11.0.
  2. When MPLCONFIGDIR is set explicitly, the message still blames "the default path", pointing the reader away from the variable they set.

This PR restores the interpolation and names MPLCONFIGDIR in the message when it is the source of the path. test_tmpconfigdir_warning now also asserts that the resolved path appears in the warning — the strengthened test fails against current main and passes with the fix.

The behavioral half of #32246 (honoring a read-only cache dir) is left for a separate PR per the discussion there.

AI Disclosure

AI-assisted: I used Claude (Anthropic) to help analyze the code paths and draft the patch, tests and text. I reviewed and understand every change, and verified the behavior myself: the strengthened test fails against current main (it prints the literal {configdir}) and passes with the fix.

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • New and changed code is tested
  • [n/a] Plotting related features are demonstrated in an example
  • [n/a] New features and API changes have release notes
  • [n/a] Documentation complies with general and docstring guidelines

@github-actions

Copy link
Copy Markdown

The warning announcing the fallback to a temporary cache directory
lost its f-prefix when the message was refactored in matplotlib#30454, so it
prints a literal "{configdir}".  Restore the interpolation, and when
MPLCONFIGDIR is set explicitly, name the variable instead of blaming
"the default path" the user never touched.

Strengthen test_tmpconfigdir_warning to assert that the resolved path
appears in the warning; the strengthened test fails on the unfixed
code.
@rokokol
rokokol force-pushed the fix-mplconfigdir-warning branch from 282f76e to 6bd17d5 Compare August 28, 2026 10:57
@tacaswell tacaswell added this to the v3.11.2 milestone Aug 30, 2026
@QuLogic
QuLogic merged commit ef42921 into matplotlib:main Aug 31, 2026
39 of 41 checks passed
QuLogic added a commit that referenced this pull request Sep 1, 2026
QuLogic added a commit that referenced this pull request Sep 1, 2026
…252-on-v3.11.x

Backport PR #32252 on branch v3.11.x (FIX: interpolate the path and name MPLCONFIGDIR in the temp cache dir warning)
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.

3 participants