From 07515ec1c5c4294d61df1064903a60c681c96edd Mon Sep 17 00:00:00 2001 From: Bryan Worrell Date: Tue, 1 Dec 2015 11:58:01 -0500 Subject: [PATCH 1/3] Added explicit relative import to __init__.py for compatibility with Python 3 --- weakrefmethod/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weakrefmethod/__init__.py b/weakrefmethod/__init__.py index 7eacc2f..77e9d8b 100644 --- a/weakrefmethod/__init__.py +++ b/weakrefmethod/__init__.py @@ -1,2 +1,2 @@ -from _version import __version__ -from weakrefmethod import WeakMethod +from ._version import __version__ +from .weakrefmethod import WeakMethod From 1d45da9e85b88b8532eca4e3b89f146c6ca42d69 Mon Sep 17 00:00:00 2001 From: Bryan Worrell Date: Tue, 1 Dec 2015 11:58:23 -0500 Subject: [PATCH 2/3] Fixed Python 2.6 bug in WeakMethod.__ne__() method. --- weakrefmethod/weakrefmethod.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/weakrefmethod/weakrefmethod.py b/weakrefmethod/weakrefmethod.py index 3355129..90e5a01 100644 --- a/weakrefmethod/weakrefmethod.py +++ b/weakrefmethod/weakrefmethod.py @@ -46,10 +46,6 @@ def __eq__(self, other): return False def __ne__(self, other): - if isinstance(other, WeakMethod): - if not self._alive or not other._alive: - return self is not other - return weakref.ref.__ne__(self, other) or self._func_ref != other._func_ref - return True + return not self.__eq__(other) __hash__ = weakref.ref.__hash__ From e1539bff08012ba927e4652ec597dc5a49c602bc Mon Sep 17 00:00:00 2001 From: Bryan Worrell Date: Tue, 1 Dec 2015 12:05:25 -0500 Subject: [PATCH 3/3] Adding tox support for testing across Python versions. --- setup.py | 3 +++ tox.ini | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 tox.ini diff --git a/setup.py b/setup.py index 80849f2..0653a99 100644 --- a/setup.py +++ b/setup.py @@ -31,4 +31,7 @@ keywords='weakref WeakMethod', tests_require=['unittest2'], test_suite='test_weakmethod', + extra_requires={ + 'test': ["tox"] + } ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..de9bc3c --- /dev/null +++ b/tox.ini @@ -0,0 +1,8 @@ +[tox] +envlist = py26, py27, py32, py33 + +[testenv] +commands = + unit2 +deps = + unittest2 \ No newline at end of file