Skip to content

Commit

Permalink
fix #635: [UNIX] crash on module import if 'enum' package is installe…
Browse files Browse the repository at this point in the history
…d on python < 3.4
  • Loading branch information
giampaolo committed Jun 18, 2015
1 parent 2006f27 commit b2a447d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
**Bug fixes**

- #632: [Linux] better error message if cannot parse process UNIX connections.
- #635: [UNIX] crash on module import if 'enum' package is installed on python
< 3.4.


3.0.0 - 2015-06-13
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ install-dev-deps:
mock \
nose \
pep8 \
pyflakes \
sphinx \
sphinx-pypi-upload \
unittest2 \
Expand Down Expand Up @@ -80,7 +81,7 @@ test-memleaks: install
test-by-name: install
@$(PYTHON) -m nose test/test_psutil.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))

# same as above but for test_memory_leaks.py script
# Same as above but for test_memory_leaks.py script.
test-memleaks-by-name: install
@$(PYTHON) -m nose test/test_memory_leaks.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))

Expand All @@ -92,16 +93,13 @@ coverage: install
$(PYTHON) -m coverage html $(COVERAGE_OPTS)
$(PYTHON) -m webbrowser -t htmlcov/index.html

# requires "pip install pep8"
pep8:
@git ls-files | grep \\.py$ | xargs $(PYTHON) -m pep8

# requires "pip install pyflakes"
pyflakes:
@export PYFLAKES_NODOCTEST=1 && \
git ls-files | grep \\.py$ | xargs $(PYTHON) -m pyflakes

# requires "pip install flake8"
flake8:
@git ls-files | grep \\.py$ | xargs $(PYTHON) -m flake8

Expand Down
12 changes: 7 additions & 5 deletions psutil/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
import os
import socket
import stat
import sys
from collections import namedtuple
from socket import AF_INET, SOCK_STREAM, SOCK_DGRAM
try:
import threading
except ImportError:
import dummy_threading as threading
try:
import enum # py >= 3.4
except ImportError:

if sys.version_info >= (3, 4):
import enum
else:
enum = None

from collections import namedtuple
from socket import AF_INET, SOCK_STREAM, SOCK_DGRAM

# --- constants

Expand Down

0 comments on commit b2a447d

Please sign in to comment.