Skip to content

Commit 755c869

Browse files
committed
correctly read old pypy profile files
do not fail if the timezone could not be determined, correct property access
1 parent eb942ab commit 755c869

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

vmprof/reader.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ def read_header(self):
163163

164164
lgt = ord(fileobj.read(1))
165165
s.interp_name = fileobj.read(lgt)
166+
if s.interp_name == 'pypy':
167+
s.profile_rpython = True
166168
if PY3:
167169
s.interp_name = s.interp_name.decode()
168170

@@ -237,7 +239,13 @@ def read_timezone(self):
237239
timezone = self.read(8).strip(b'\x00')
238240
timezone = timezone.decode('ascii')
239241
if timezone:
240-
return pytz.timezone(timezone)
242+
try:
243+
# TODO, it seems that all systems use different timezone names,
244+
# this would need some clarification, or we just remove the whole
245+
# feature and ignore the timezone in the log
246+
return pytz.timezone(timezone)
247+
except pytz.exceptions.UnknownTimeZoneError:
248+
return None
241249
return None
242250

243251
def read_all(self):

vmprof/upload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def main():
1414
service = Service(host, auth)
1515
interpname = platform.python_implementation()
1616
service.post({ Service.FILE_CPU_PROFILE: filename,
17-
Service.File_JIT_PROFILE: filename + '.jit',
17+
Service.FILE_JIT_PROFILE: filename + '.jit',
1818
'argv': interpname + ' -m vmprof.upload ' + filename,
1919
'VM': interpname })
2020

0 commit comments

Comments
 (0)