Skip to content

Commit c23878b

Browse files
committed
Coerce PhoneNumber.national_number to long/int (Py2/3K) type
1 parent b923df3 commit c23878b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

python/phonenumbers/phonenumber.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1717
# See the License for the specific language governing permissions and
1818
# limitations under the License.
19-
from .util import UnicodeMixin, rpr
19+
from .util import UnicodeMixin, rpr, to_long
2020

2121

2222
class CountryCodeSource(object):
@@ -79,7 +79,10 @@ def __init__(self,
7979
# None if not set, of type long otherwise (and so it will never
8080
# contain any formatting (hypens, spaces, parentheses), nor any
8181
# alphanumeric spellings).
82-
self.national_number = national_number # None or long
82+
if national_number is None:
83+
self.national_number = None
84+
else:
85+
self.national_number = to_long(national_number)
8386

8487
# Extension is not standardized in ITU recommendations, except for
8588
# being defined as a series of numbers with a maximum length of 40

0 commit comments

Comments
 (0)