GH-128520: pathlib ABCs: raise text encoding warnings at correct stack level#133051
GH-128520: pathlib ABCs: raise text encoding warnings at correct stack level#133051barneygale merged 2 commits intopython:mainfrom
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.
JelleZijlstra
left a comment
There was a problem hiding this comment.
Looks good. Do we run any tests/buildbots with warn_default_encoding on?
An alternative way to write the tests would be to run a subprocess that has the flag on.
|
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 |
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.