[issue34893] Add 2to3 fixer to change send and recv methods of socket object.

Raymond Hettinger report at bugs.python.org
Sun Oct 7 13:53:29 EDT 2018


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> I have tweaked that fixer to handle the pointed cases 
> and a few additional ones too

Playing whack-a-mole with a few cases will always fall short of being able to guarantee correct transformations and not break existing code that is working correctly.

One possibility is to add a type check to the generated code, "send(x)" -> send(x.encode() if type(x)==bytes else x)" but this has its own issues and isn't satisfying.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34893>
_______________________________________


More information about the Python-bugs-list mailing list