No, you should not treat that warning as exhaustive. The following code behaves differently on python2.x and python3.x but emits no warnings:
from __future__ import print_function
class test(object):
def __nonzero__(self):
return False
t = test()
if t:
print('Hello')
(at least not as of python2.7.10 on OSX). Ok, perhaps this code can be handled by 2to3 (it is) -- though I would still expect a warning based on the official documentation.
Warn about Python 3.x possible incompatibilities by emitting a DeprecationWarning for features that are removed or significantly changed in Python 3.
Here's an example of some code that isn't handled by 2to3 but still no warning is emitted using the -3
option:
from __future__ import print_function
import subprocess
class Pipe(object):
def __init__(self,openstr):
self.gnu_process=subprocess.Popen(openstr.split(),
stdin=subprocess.PIPE)
def put_in_pipe(self,mystr):
print(mystr, file=self.gnu_process.stdin)
if __name__=="__main__":
print("This simple program just echoes what you say (control-d to exit)")
p = Pipe("cat -")
while True:
try:
inpt = raw_input()
except EOFError:
break
print('putting in pipe:%s' % inpt)
p.put_in_pipe(inpt)
The problem with this code is that in python3, my pipe expects a bytes object but it's getting a str
(python2.x's unicode).