Skip to content

Commit

Permalink
fix #715: do not print exception on import time in case cpu_times() f…
Browse files Browse the repository at this point in the history
…ails.
  • Loading branch information
giampaolo committed Oct 12, 2018
1 parent 1a0520d commit 2e220c8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ XXXX-XX-XX

**Bug fixes**

- 715_: do not print exception on import time in case cpu_times() fails.
- 1294_: [Windows] psutil.Process().connections() may sometimes fail with
intermittent 0xC0000001. (patch by Sylvain Duchesne)
- 1320_: [AIX] system CPU times (psutil.cpu_times()) were being reported with
Expand Down
3 changes: 0 additions & 3 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import subprocess
import sys
import time
import traceback
try:
import pwd
except ImportError:
Expand Down Expand Up @@ -1609,14 +1608,12 @@ def cpu_times(percpu=False):
except Exception:
# Don't want to crash at import time.
_last_cpu_times = None
traceback.print_exc()

try:
_last_per_cpu_times = cpu_times(percpu=True)
except Exception:
# Don't want to crash at import time.
_last_per_cpu_times = None
traceback.print_exc()


def _cpu_tot_time(times):
Expand Down

0 comments on commit 2e220c8

Please sign in to comment.