You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the code, it seems that Context.log_file allows bytes type (at line 1034),
but it raises TypeError: a bytes-like object is required, not 'str' at line 1036 in Python 3.x.
I think it makes sense to either delete bytes type or cast it to string type.
If bytes is for Python 2.x, then it would be nice to replace it to str (because str and bytes are same in Python 2.x).
Thanks for the report. We usually deal with those by implicitly converting string arguments to bytes and only use bytes internally. There is misc.need_bytes for this. Would you be willing to propose a pull request to fix this?
As I understand your comment, you use bytes internally, so you're asking me to ensure that bytes can be used without errors as well. If I've misunderstood, please let me know.
Additionally, I looked up misc.need_bytes, but I found only util.packing._need_bytes function.
I think it is a function that replaces str to bytes, whereas we need the opposite functionality for this issue.
Hence, I will use util.packing._need_text or util.packing._decode to solve this issue.
pwntools/pwnlib/context/__init__.py
Lines 1007 to 1039 in 5981c72
In the code, it seems that
Context.log_file
allows bytes type (at line 1034),but it raises
TypeError: a bytes-like object is required, not 'str'
at line 1036 in Python 3.x.I think it makes sense to either delete bytes type or cast it to string type.
If bytes is for Python 2.x, then it would be nice to replace it to str (because str and bytes are same in Python 2.x).
It is simplified code raising TypeError:
Thank you!
The text was updated successfully, but these errors were encountered: