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 log message formatting during exception handling #417

Merged
merged 2 commits into from
Dec 24, 2019

Conversation

abn
Copy link
Contributor

@abn abn commented Dec 15, 2019

This fixes the log message by ensuring we only log the EntryPoint name. The root issue can be reproduced independently as shown below.

$ python -c 'from importlib.metadata import EntryPoint; "%s" % EntryPoint(name="name", value="value", group="group")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: not all arguments converted during string formatting

Related to: #411 pypa/twine#552 python-poetry/poetry#1719

The above issues resolved the exception root causes but never fixed the second exception thrown from the exception handling block.

@jaraco
Copy link
Owner

jaraco commented Dec 24, 2019

Thanks for this. This undesirable behavior was an unfortunate consequence of the fact that EntryPoint is iterable (a namedtuple), so %s string formatting tries to iterate it, rather than invoking repr on the object. I'll want to decide if rendering the entire entry point was the intended behavior and should be retained or if rendering just the name is sufficient.

@jaraco
Copy link
Owner

jaraco commented Dec 24, 2019

Seeing as that code didn't change with either entrypoints replacement (a9fe227, 0028d73), I think rendering the whole entrypoint is what's intended here.

@jaraco jaraco merged commit e565632 into jaraco:master Dec 24, 2019
jaraco added a commit that referenced this pull request Dec 24, 2019
@abn abn deleted the fix-plugin-load-exception branch August 15, 2020 17:07
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

Successfully merging this pull request may close these issues.

2 participants