CountryNameDict function trying to parse UTF-8 iso3166.tab as US-ASCII
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
Fix Released
|
Undecided
|
Stuart Bishop | ||
python-tz (Debian) |
Fix Released
|
Unknown
|
|||
python-tz (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Precise |
Fix Released
|
Critical
|
Robert C Jennings | ||
Trusty |
Fix Released
|
Critical
|
Robert C Jennings | ||
Vivid |
Fix Released
|
Critical
|
Robert C Jennings |
Bug Description
[Impact]
* The latest tzdata update change the content type for iso3166.tab
and zone.tab to UTF-8 which causes an exception in pytz
[Test Case]
$ apt-get install -y python-tz python3-tz
# These should produce exceptions for country_names. This test
# case also includes a test for country_timezones because the
# tzdata file for zones has changed to use utf-8 but has yet
# to include utf-8 characters. You can hand edit
# /usr/share/
# to force the exception and then test the proposed package.
$ python -c 'import pytz
for item in pytz.country_
pass'
$ python -c 'import pytz
for item in pytz.country_
pass'
$ python3 -c 'from pytz import country_timezones
for item in country_
pass'
$ python3 -c 'from pytz import country_names
for item in country_
pass'
# A recreate will raise an exception like this:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "/usr/lib/
for key in self._mapping:
File "/usr/lib/
self._fill()
File "/usr/lib/
line = line.decode(
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
[Regression Potential]
* Older tzdata releases should be okay (and this has been tested)
[Other Info]
* None
---- Original Description ----
Since tzdata-2015e there are UTF-8 characters in iso3166.tab, see:
http://
http://
pytz/__
zone_tab = open_resource(
try:
for line in zone_tab.
to read it and fails on AX, CI, RE lines, using UTF-8 fixes the issues and should work OK even with older tzdata releases.
Changed in pytz: | |
status: | New → Confirmed |
Changed in pytz: | |
status: | Confirmed → In Progress |
assignee: | nobody → Stuart Bishop (stub) |
Changed in pytz: | |
status: | In Progress → Fix Released |
Changed in python-tz (Debian): | |
status: | Unknown → New |
Changed in python-tz (Ubuntu): | |
importance: | Undecided → High |
status: | New → Fix Committed |
description: | updated |
Changed in python-tz (Ubuntu Precise): | |
assignee: | nobody → Robert C Jennings (rcj) |
Changed in python-tz (Ubuntu Trusty): | |
assignee: | nobody → Robert C Jennings (rcj) |
Changed in python-tz (Ubuntu Vivid): | |
assignee: | nobody → Robert C Jennings (rcj) |
Changed in python-tz (Debian): | |
status: | New → Fix Released |
I note that debian is also tracking this bug and they suggest that the latest version is fixed. Is it possible to get that fix into 12.04 LTS, 14.04 LTS and up please?
https:/ /bugs.debian. org/cgi- bin/bugreport. cgi?bug= 792192