FIX: interpolate the path and name MPLCONFIGDIR in the temp cache dir warning - #32252
FIX: interpolate the path and name MPLCONFIGDIR in the temp cache dir warning#32252rokokol wants to merge 1 commit into
Conversation
|
Thank you for opening your first PR into Matplotlib! If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process. You can also join us on discourse chat for real-time discussion. For details on testing, writing docs, and our review process, please see the developer guide. We strive to be a welcoming and open project. Please follow our Code of Conduct. |
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.
282f76e to
6bd17d5
Compare
PR summary
When Matplotlib falls back to a temporary cache directory, the warning has two problems (discussed in #32246):
{configdir}: the message text was refactored into theissue_msgvariable and lost itsfprefix on the way. The regression ships in releases since 3.11.0.MPLCONFIGDIRis 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
MPLCONFIGDIRin the message when it is the source of the path.test_tmpconfigdir_warningnow 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