-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Encoding failure is not caught and propagated #6784
Comments
but since it re-raises that exception that's not masking anything, surely? Seems plausible that there's a too-broad-except somewhere, but not that one? |
@dimbleby: Yes, it might be somewhere else. That was just some extra info. |
extra, but I think not relevant! poetry/src/poetry/mixology/version_solver.py Line 400 in 0ffe91c
ValueError - that would capture a unicode error.
|
so far as I can see that try-except can simply be removed, which should allow your error to propagate. If you fancy submitting an MR, I reckon that's the way to go |
I'm not that experienced in best-practice in terms of changes like this, but it seems a bit dangerous to just remove a try-except like that - but if you feel confident in doing so I have created PR #6786. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
1.2.1
and1.3.0.dev01
3.9.13
Windows 11 Enterprise (build 22000.856)
-vvv
option) and have included the output below.Additionally
Issue
When adding a secondary, private source and attempting to authenticate via basic-http,
poetry
silently ignores aUnicodeEncodingError
originating from a failed latin1 encoding of astr
.Instead, poetry moves on to the public pypi.org feed and informs the user that the searched package is not available - even if it is available on pypi.org
The error stems from loading in a user/password from Windows Certificate Manager which appears to be corrupted and cannot be encoded with 'latin1'
The source of the encoding error is
poetry
invoking_basic_auth_str
fromauth.py
in therequests
package:https://github.com/psf/requests/blob/7104ad4b135daab0ed19d8e41bd469874702342b/requests/auth.py#L56-L60
The originating call in
poetry
isrequest
inutils.authenticator
.poetry/src/poetry/utils/authenticator.py
Lines 213 to 216 in 0ffe91c
solve()
has a fairly wide try-catch with a baseException
poetry/src/poetry/mixology/version_solver.py
Lines 110 to 123 in 0ffe91c
Reproducing
As this involves a broken
str
that fails to encode reproducibility is a bit hard. I will try and create tests and create a PR if my skills are sufficient enough to create something useful.Running
pipenv lock -vvv
yields:No-where in the stacktrace is a user informed that the underlying issue is an encoding failure of credentials.
Pseduo fix
Wrapping
requests.auth.HTTPBasicAuth
in a try-except can catch theUnicodeEncodeError
and propagate it to the user:The new stacktrace now contains the correct
UnicodeEncodeError
:The text was updated successfully, but these errors were encountered: