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

Since 3.1.2, the pre-PEP-8 compat wrapper passes on wrong args #548

Open
eylenburg opened this issue Mar 8, 2024 · 6 comments
Open

Since 3.1.2, the pre-PEP-8 compat wrapper passes on wrong args #548

eylenburg opened this issue Mar 8, 2024 · 6 comments
Assignees

Comments

@eylenburg
Copy link

I came here from puddletag/puddletag#876

I tried running Puddletag but got the error:

Traceback (most recent call last):
  File "/app/bin/puddletag", line 352, in <module>
    from puddlestuff.puddletag import MainWin
  File "/app/lib/python3.11/site-packages/puddlestuff/puddletag.py", line 14, in <module>
    from . import mainwin
  File "/app/lib/python3.11/site-packages/puddlestuff/mainwin/__init__.py", line 4, in <module>
    from . import dirview
  File "/app/lib/python3.11/site-packages/puddlestuff/mainwin/dirview.py", line 12, in <module>
    from ..tagmodel import has_previews
  File "/app/lib/python3.11/site-packages/puddlestuff/tagmodel.py", line 32, in <module>
    from .audio_filter import parse as filter_audio
  File "/app/lib/python3.11/site-packages/puddlestuff/audio_filter.py", line 183, in <module>
    bool_expr.enablePackrat()
  File "/app/lib/python3.11/site-packages/pyparsing/util.py", line 265, in _inner
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/pyparsing/core.py", line 1132, in enable_packrat
    ParserElement.packrat_cache = _FifoCache(cache_size_limit)  # type: ignore[assignment]
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/pyparsing/util.py", line 105, in __init__
    keyring = [object()] * size
              ~~~~~~~~~~~^~~~~~
TypeError: can't multiply sequence by non-int of type 'Forward'

Apparently this is a regression. One of the Puddletag devs said: "This happens with the recently released pyparsing v3.1.2, where their pre-PEP-8 compat wrapper passes on wrong args. Works fine with v3.1.1 though."

@ptmcg
Copy link
Member

ptmcg commented Mar 8, 2024

Wow, this is an interesting one, thanks for submitting!

For now, you can work around this bug by either:

  • using the new function enable_packrat (to bypass the PEP8 compatibility wrapper)
  • call enablePackrat by invoking on the ParserElement class instead of on an instance: pyparsing.ParserElement.enablePackrat()

I'm not sure what other PEP wrappers are affected, probably any that is a class or static method that could be invoked through an instance.

@ptmcg ptmcg self-assigned this Mar 8, 2024
@ptmcg
Copy link
Member

ptmcg commented Mar 8, 2024

Ok, I've figured out a solution. I'll push out a fix this evening.

@ptmcg
Copy link
Member

ptmcg commented Mar 10, 2024

My "fix" broke a few other pieces, but those are fixed now too.

@holzboa
Copy link

holzboa commented Mar 27, 2024

Sure about the fix? I get the same error as eylenburg - downgrading to v3.1.1 fixes the problem

@ptmcg
Copy link
Member

ptmcg commented Mar 27, 2024

I haven't published this change to PyPI yet. Have you tried installing the latest 3.1.3 development commit? Do this using:

pip install git+https://github.com/pyparsing/pyparsing.git@55e57c57cff8f036651752a64f40f918ed762687

If this addresses your issue, I'll push out a 3.1.3 alpha1 release to PyPI.

Note - this revision has the 3.1.3 version, as I'm not use do to handing out development versions. You'll need to manually uninstall this when I finally release the 3.1.3 version.

@holzboa
Copy link

holzboa commented Mar 27, 2024

I used Arch's extra repo to install. I'll wait for v3.1.3 - thanks for the quick reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants