Issue 15069: Dictionary Creation Fails with integer key (original) (raw)

Attempting to import pyserial. In module serialposix.py a dict declaration starting on line 64;

baudrate_constants = {
    0:       0000000,
    50:      0000001,
    75:      0000002,
   110:      0000003, ...etc

Traceback (most recent call last): File "", line 1, in File "serialposix.py", line 64 50: 0000001, ^ SyntaxError: invalid token

MacOSX 10.6.8 32bit x86 python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:09:56)

And yes, a number with leading zeros is an invalid token in Python3, because in Python2 it was an octal number, and now we spell octal as, eg, 0o0001.