-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Pickletools Default Encoding #126997
Comments
hey @Legoclones I think I can work with this issue ...can you please assign me with this |
I don't think I have permission to assign someone |
So should I start working upon this and thank make a PR.? |
* Fix support of STRING and GLOBAL opcodes with non-ASCII arguments. * dis() now outputs non-ASCII bytes in STRING, BINSTRING and SHORT_BINSTRING arguments as escaped (\xXX).
It is not a problem if
#127062 fixes them. |
@kanishka-coder0809, sorry, I already worked on this issue. It is slightly larger than initially was reported. On other hand, I think that I found a better solution than supporting optional argument for encoding. The latter would require more significant rewriting of the pickletools module and likely could be too complex for backporting. |
That looks great! |
* Fix support of STRING and GLOBAL opcodes with non-ASCII arguments. * dis() now outputs non-ASCII bytes in STRING, BINSTRING and SHORT_BINSTRING arguments as escaped (\xXX).
…honGH-127062) * Fix support of STRING and GLOBAL opcodes with non-ASCII arguments. * dis() now outputs non-ASCII bytes in STRING, BINSTRING and SHORT_BINSTRING arguments as escaped (\xXX). (cherry picked from commit eaf2171) Co-authored-by: Serhiy Storchaka <[email protected]>
…honGH-127062) * Fix support of STRING and GLOBAL opcodes with non-ASCII arguments. * dis() now outputs non-ASCII bytes in STRING, BINSTRING and SHORT_BINSTRING arguments as escaped (\xXX). (cherry picked from commit eaf2171) Co-authored-by: Serhiy Storchaka <[email protected]>
Thank you for your report @Legoclones. |
…-127062) (GH-127095) * Fix support of STRING and GLOBAL opcodes with non-ASCII arguments. * dis() now outputs non-ASCII bytes in STRING, BINSTRING and SHORT_BINSTRING arguments as escaped (\xXX). (cherry picked from commit eaf2171) Co-authored-by: Serhiy Storchaka <[email protected]>
…-127062) (GH-127094) * Fix support of STRING and GLOBAL opcodes with non-ASCII arguments. * dis() now outputs non-ASCII bytes in STRING, BINSTRING and SHORT_BINSTRING arguments as escaped (\xXX). (cherry picked from commit eaf2171) Co-authored-by: Serhiy Storchaka <[email protected]>
Bug report
Bug description:
When unpickling using
_pickle.c
orpickle.py
throughload
/loads
, an encoding can be specified using theencoding
argument, with the default being ASCII. However, pickletools does not support custom encodings and instead makes assumptions about what encoding it uses, which can lead to either incorrect data being displayed or erroring/not erroring when the normal unpickling process would error.The three opcodes that I have found this in are
STRING
,BINSTRING
, andSHORT_BINSTRING
:STRING
latin-1
forBINSTRING
latin-1
forSHORT_BINSTRING
I think the best solution would be to support encodings as an optional argument in
pickletools.py
, with the default being set to ASCII (since that's the default encoding forpickle.py
and_pickle.c
).CPython versions tested on:
3.11
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: