Permalink
Browse files

Add to_long Py2/3k normalization function

  • Loading branch information...
1 parent 0964219 commit 649b698b434e1df47dfd7c7e81b8fcc762144c9a @daviddrysdale committed Nov 26, 2011
Showing with 4 additions and 2 deletions.
  1. +2 −2 python/phonenumbers/phonenumberutil.py
  2. +2 −0 python/phonenumbers/util.py
@@ -31,7 +31,7 @@
import re
from .re_util import fullmatch # Extra regexp function; see README
-from .util import UnicodeMixin, u, prnt
+from .util import UnicodeMixin, u, prnt, to_long
from .unicode_util import digit as unicode_digit
# Data class definitions
@@ -2178,7 +2178,7 @@ def parse(number, region, keep_raw_input=False,
"The string supplied is too long to be a phone number.")
if normalized_national_number[0] == '0':
numobj.italian_leading_zero = True
- numobj.national_number = long(normalized_national_number)
+ numobj.national_number = to_long(normalized_national_number)
return numobj
@@ -27,6 +27,7 @@
u = str
unicode = str
unichr = chr
+ to_long = int
def prnt(*args, **kwargs):
sep = kwargs.get('sep', ' ')
@@ -54,6 +55,7 @@ def u(s):
return us
unichr = unichr
+ to_long = long
def prnt(*args, **kwargs):
sep = kwargs.get('sep', ' ')

0 comments on commit 649b698

Please sign in to comment.