mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-01-11 03:50:17 +01:00
proto: skip the bitmask check if on old python versions
int.bit_count() requires Python 3.10, so let's skip it where not available.
This commit is contained in:
parent
a95c9e1799
commit
bba921329d
1 changed files with 5 additions and 2 deletions
|
|
@ -277,8 +277,11 @@ class Enum:
|
|||
if self.is_bitfield:
|
||||
if e.value < 0:
|
||||
raise ValueError("Bitmasks must not be less than zero")
|
||||
if e.value.bit_count() > 1:
|
||||
raise ValueError("Bitmasks must have exactly one bit set")
|
||||
try:
|
||||
if e.value.bit_count() > 1:
|
||||
raise ValueError("Bitmasks must have exactly one bit set")
|
||||
except AttributeError:
|
||||
pass # bit_count() requires Python 3.10
|
||||
|
||||
self.entries.append(entry)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue