Martin Panter added the comment: Just thinking the first case might get quite a few false positives. Maybe that would still be acceptable, I dunno.
> - the str.encode method is called (redirect to codecs.encode to handle > arbitrary input types in a forward compatible way) I guess you are trying to catch cases like this, which I have come across quite a few times: data.encode("hex") # data is a byte string But I think you would also catch cases that depend on Python 2 “str” objects automatically converting to Unicode. Here are some examples taken from real code: file_name.encode("utf-8") # File name parameter may be str or unicode # Code meant to be compatible with both Python 2 and 3: """<?xml . . . encoding="iso-8859-1"?>""".encode("iso-8859-1") ("data %s\n" % len(...)).encode("ascii") ---------- nosy: +vadmium _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19543> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com