fix signed integer is greater than maximum when call os.major
using python 2.7.5 in Centos 7
Signed-off-by: Song Shun <song.shun3@zte.com.cn>
(cherry picked from commit
f77934b19939796d7ab52daf4dac44846a2ad162)
},
}
+try:
+ # see https://bugs.python.org/issue23098
+ os.major(0x80002b00)
+except OverflowError:
+ os.major = lambda devid: ((devid >> 8) & 0xfff) | ((devid >> 32) & ~0xfff)
+ os.minor = lambda devid: (devid & 0xff) | ((devid >> 12) & ~0xff)
+
class Ptype(object):