Avoid deprecation warnings.

This commit is contained in:
Serhiy Storchaka 2015-01-31 11:27:06 +02:00
parent 7ece150395
commit 5312a7f912
7 changed files with 9 additions and 9 deletions

View File

@ -177,7 +177,7 @@ elif os.name == "posix":
res = re.findall(expr, data)
if not res:
return _get_soname(_findLib_gcc(name))
res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
res.sort(key=_num_version)
return res[-1]
elif sys.platform == "sunos5":

View File

@ -84,7 +84,7 @@ def uu_decode(input,errors='strict'):
data = a2b_uu(s)
except binascii.Error, v:
# Workaround for broken uuencoders by /Fredrik Lundh
nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3
nbytes = (((ord(s[0])-32) & 63) * 4 + 5) // 3
data = a2b_uu(s[:nbytes])
#sys.stderr.write("Warning: %s\n" % str(v))
write(data)

View File

@ -2066,7 +2066,7 @@ order (MRO) for bases """
"attr on a property" % attr)
class D(object):
__getitem__ = property(lambda s: 1/0)
__getitem__ = property(lambda s: 1.0/0.0)
d = D()
try:

View File

@ -92,7 +92,7 @@ class ExceptionTests(unittest.TestCase):
self.raise_catch(TabError, "TabError")
# can only be tested under -tt, and is the only test for -tt
#try: compile("try:\n\t1/0\n \t1/0\nfinally:\n pass\n", '<string>', 'exec')
#try: compile("try:\n\t1.0/0.0\n \t1.0/0.0\nfinally:\n pass\n", '<string>', 'exec')
#except TabError: pass
#else: self.fail("TabError not raised")

View File

@ -2954,7 +2954,7 @@ else:
server_context, other_context, client_context = self.sni_contexts()
def cb_raising(ssl_sock, server_name, initial_context):
1/0
1.0/0.0
server_context.set_servername_callback(cb_raising)
with self.assertRaises(ssl.SSLError) as cm, \

View File

@ -797,7 +797,7 @@ class ThreadingExceptionTests(BaseTestCase):
running = True
while running:
time.sleep(0.01)
1/0
1.0/0.0
t = threading.Thread(target=run)
t.start()
while not running:
@ -824,7 +824,7 @@ class ThreadingExceptionTests(BaseTestCase):
running = True
while running:
time.sleep(0.01)
1/0
1.0/0.0
t = threading.Thread(target=run)
t.start()
while not running:
@ -852,7 +852,7 @@ class ThreadingExceptionTests(BaseTestCase):
running = True
while running:
time.sleep(0.01)
1/0
1.0/0.0
sys.stderr = None
t = threading.Thread(target=run)
t.start()

View File

@ -197,7 +197,7 @@ class TestTimeit(unittest.TestCase):
def test_print_exc(self):
s = StringIO()
t = timeit.Timer("1/0")
t = timeit.Timer("1.0/0.0")
try:
t.timeit()
except: