Fixed ignoring of negative enum values

This commit is contained in:
romamo 2020-03-04 15:02:43 +02:00 committed by GitHub
parent 262ce13f4d
commit 39a812b134
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -414,7 +414,7 @@ class BaseEnumField(Field):
import re
from enum import Enum
members = {}
for match in re.finditer("'(\w+)' = (\d+)", db_type):
for match in re.finditer("'(\w+)' = (-?\d+)", db_type):
members[match.group(1)] = int(match.group(2))
enum_cls = Enum('AdHocEnum', members)
field_class = Enum8Field if db_type.startswith('Enum8') else Enum16Field