@@ -1686,10 +1686,13 @@ def format_out_of_country_keeping_alpha_chars(numobj, region_calling_from):
16861686 region_code = region_code_for_country_code (country_code )
16871687 # Metadata cannot be None because the country calling code is valid.
16881688 metadata_for_region = PhoneMetadata .metadata_for_region_or_calling_code (country_code , region_code )
1689+ # Strip any extension
1690+ extension , stripped_number = _maybe_strip_extension (num_raw_input )
1691+ # Append the formatted extension
16891692 formatted_number = _maybe_append_formatted_extension (numobj ,
16901693 metadata_for_region ,
16911694 PhoneNumberFormat .INTERNATIONAL ,
1692- num_raw_input )
1695+ stripped_number )
16931696 if i18n_prefix_for_formatting :
16941697 formatted_number = (i18n_prefix_for_formatting + U_SPACE +
16951698 unicod (country_code ) + U_SPACE + formatted_number )
@@ -2449,6 +2452,7 @@ def _test_number_length(national_number, metadata, numtype=PhoneNumberType.UNKNO
24492452
24502453
24512454def is_possible_number_with_reason (numobj ):
2455+ """See documentation for is_possible_number_for_type_with_reason"""
24522456 return is_possible_number_for_type_with_reason (numobj , PhoneNumberType .UNKNOWN )
24532457
24542458
@@ -2477,6 +2481,14 @@ def is_possible_number_for_type_with_reason(numobj, numtype):
24772481 area codes for fixed line numbers), it will return false for the
24782482 subscriber-number-only version.
24792483
2484+ There is a known <a
2485+ href="https://issuetracker.google.com/issues/335892662">issue</a> with this
2486+ method: if a number is possible only in a certain region among several
2487+ regions that share the same country calling code, this method will consider
2488+ only the "main" region. For example, +1310xxxx are valid numbers in
2489+ Canada. However, they are not possible in the US. As a result, this method
2490+ will return IS_POSSIBLE_LOCAL_ONLY for +1310xxxx.
2491+
24802492 Arguments:
24812493 numobj -- The number object that needs to be checked
24822494 numtype -- The type we are interested in
0 commit comments