Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
GH-128520: pathlib ABCs: raise text encoding warnings at correct stack level#133051
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Ensure that warnings about unspecified text encodings are emitted from`ReadablePath.read_text()`, `WritablePath.write_text()` and `magic_open()`with the correct stack level set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks good. Do we run any tests/buildbots withwarn_default_encoding
on?
An alternative way to write the tests would be to run a subprocess that has the flag on.
barneygale commentedApr 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks! I can't see any indication that any build bots enable FWIW, when I backport this to the pathlib-abc pypi package, I'll add |
I'd prefer if these tests are exercised in some way in CPython's own CI but up to you if you prefer a different approach; feel free to merge as is. |
Thanks Jelle. I'll get these tests running in CPython CI in a follow-up PR, because I suspect the same fix will be useful in the |
fbffd70
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Ensure that warnings about unspecified text encodings are emitted from
ReadablePath.read_text()
,WritablePath.write_text()
andmagic_open()
with the correct stack level set.These classes/functions are still private, so there's no public change of behaviour.