mirror of
https://github.com/beetbox/beets.git
synced 2025-12-09 18:12:19 +01:00
Fix numeric types
This commit is contained in:
parent
1ae6ce04dd
commit
9518f28faa
3 changed files with 5 additions and 3 deletions
|
|
@ -559,7 +559,7 @@ class Item(LibModel):
|
|||
|
||||
for key in self._media_fields:
|
||||
value = getattr(mediafile, key)
|
||||
if isinstance(value, (int, int)):
|
||||
if isinstance(value, (int, long)):
|
||||
if value.bit_length() > 63:
|
||||
value = 0
|
||||
self[key] = value
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ REDACTED_TOMBSTONE = 'REDACTED'
|
|||
PY3 = sys.version_info[0] == 3
|
||||
STRING = str if PY3 else unicode
|
||||
BASESTRING = str if PY3 else basestring
|
||||
NUMERIC_TYPES = (int, float) if PY3 else (int, float, int)
|
||||
NUMERIC_TYPES = (int, float) if PY3 else (int, float, long)
|
||||
|
||||
|
||||
def iter_first(sequence):
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ import ast
|
|||
import dis
|
||||
import types
|
||||
|
||||
from .confit import NUMERIC_TYPES
|
||||
|
||||
SYMBOL_DELIM = u'$'
|
||||
FUNC_DELIM = u'%'
|
||||
GROUP_OPEN = u'{'
|
||||
|
|
@ -72,7 +74,7 @@ def ex_literal(val):
|
|||
"""
|
||||
if val is None:
|
||||
return ast.Name(b'None', ast.Load())
|
||||
elif isinstance(val, (int, float, int)):
|
||||
elif isinstance(val, NUMERIC_TYPES):
|
||||
return ast.Num(val)
|
||||
elif isinstance(val, bool):
|
||||
return ast.Name(bytes(val), ast.Load())
|
||||
|
|
|
|||
Loading…
Reference in a new issue