5067373
setup.py for Python 3 doesn't invoke 2to3 on pct-speedtest.py, which runs
5067373
into problems:
5067373
5067373
Traceback (most recent call last):
5067373
  File "pct-speedtest.py", line 218, in <module>
5067373
    Benchmark().run()
5067373
  File "pct-speedtest.py", line 200, in run
5067373
    self.test_pubkey_setup(pubkey_name, module, key_bytes)
5067373
  File "pct-speedtest.py", line 85, in test_pubkey_setup
5067373
    keys = self.random_keys(key_bytes)[:5]
5067373
  File "pct-speedtest.py", line 49, in random_keys
5067373
    return self.random_blocks(bytes, 10**5)     # 100k
5067373
  File "pct-speedtest.py", line 53, in random_blocks
5067373
    data = self.random_data(bytes)
5067373
  File "pct-speedtest.py", line 62, in random_data
5067373
    self.__random_data = self._random_bytes(bytes)
5067373
  File "pct-speedtest.py", line 73, in _random_bytes
5067373
    return os.urandom(b)
5067373
  File "/usr/lib64/python3.2/os.py", line 777, in urandom
5067373
    bs += read(_urandomfd, n - len(bs))
5067373
TypeError: integer argument expected, got float
5067373
5067373
This is due to the divisions in the pubkey_specs table, which in Python 3 is
5067373
true division, returning a float.
5067373
5067373
As it happens, 2to3 can't convert these divisions, see:
5067373
http://bugs.python.org/issue12831
5067373
5067373
Change them to explicitly be floor divisions (supported in Python 2.2
5067373
onwards; see PEP 0238)
5067373
5067373
--- pycrypto/pct-speedtest.py
5067373
+++ pycrypto/pct-speedtest.py
5067373
@@ -165,9 +165,9 @@
5067373
 
5067373
     def run(self):
5067373
         pubkey_specs = [
5067373
-            ("RSA(1024)", RSA, 1024/8),
5067373
-            ("RSA(2048)", RSA, 2048/8),
5067373
-            ("RSA(4096)", RSA, 4096/8),
5067373
+            ("RSA(1024)", RSA, 1024//8),
5067373
+            ("RSA(2048)", RSA, 2048//8),
5067373
+            ("RSA(4096)", RSA, 4096//8),
5067373
             ]
5067373
         block_specs = [
5067373
             ("DES", DES, 8),