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

Work around pyparsing diagnostic warnings #27685

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

ksunden
Copy link
Member

@ksunden ksunden commented Jan 22, 2024

Closes #25204

PR summary

This feels a bit more "workaround" than I'd really like, but it seems to work.

  • Pyparsing warns when you try to name a forward reference before it is defined
    • As far as I can tell, it actually does work currently, but discussion on Adding a setResultsName() breaks grammar? pyparsing/pyparsing#95
      leads me to believe that we are relying on something that could change
    • When names are given, a copy is produced, and thus in theory the forward references won't get their definitions
      • In practice, they appear to
    • There is a warning which is disabled by default for this behavior.
      • Enabled with python -Wdefault, but not enabled in our test suite
    • The solution I came up with was to wrap it in another layer of forward reference
      • This feels like a hack, but the reference the outer forward holds gets filled out and a copy to that reference is transmitted to the copies.
    • I also considered
      • defining early
        • Can't do completely due to cycles, redefining is possible, but likely to be more fragile
      • Supressing warnings
        • Works for now, but seems not by design
      • Removing names
        • Would require (at least) more extensive code changes, as many test failures result.
      • Not using a Forward
        • Was unable to find something that did not obstruct values used by parsing functions (tried e.g. Group, + Empty(), etc)

The _fontconfig_pattern.py is a compatibility change adding a Group which was suggested by a similar warning.

PR checklist

@tacaswell tacaswell added this to the v3.9.0 milestone Mar 13, 2024
@QuLogic QuLogic merged commit 7fde77e into matplotlib:main Mar 13, 2024
39 of 41 checks passed
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.

[Bug]: Pyparsing warnings emitted in mathtext
3 participants