diff options
author | Eneldo Serrata <eneldoserrata@gmail.com> | 2013-06-12 20:18:20 +0000 |
---|---|---|
committer | Eneldo Serrata <eneldoserrata@gmail.com> | 2013-06-12 20:18:20 +0000 |
commit | aa9fb70b920936b61a4a6c65b680a7bf15d3424f (patch) | |
tree | 61aa74c77c187d7a549b7aefdfcbcdf5db4cefb0 | |
parent | 81bd425e8d2b25ecec5bf9e6874fa9e6823d1234 (diff) | |
download | cherrypy-aa9fb70b920936b61a4a6c65b680a7bf15d3424f.tar.gz |
fix profiler.py bug when runing in python 3.x
-rw-r--r-- | cherrypy/lib/profiler.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cherrypy/lib/profiler.py b/cherrypy/lib/profiler.py index 5ffe3b30..f7bf2eb3 100644 --- a/cherrypy/lib/profiler.py +++ b/cherrypy/lib/profiler.py @@ -53,7 +53,7 @@ import os, os.path import sys import warnings -from cherrypy._cpcompat import BytesIO +from cherrypy._cpcompat import BytesIO, StringIO _count = 0 @@ -85,7 +85,10 @@ class Profiler(object): def stats(self, filename, sortby='cumulative'): """:rtype stats(index): output of print_stats() for the given profile. """ - sio = BytesIO() + if sys.version_info >= (3, 0): + sio = StringIO() + else: + sio = BytesIO() if sys.version_info >= (2, 5): s = pstats.Stats(os.path.join(self.path, filename), stream=sio) s.strip_dirs() |