[vlc-commits] Fix 3.x DeprecationWarning
Olivier Aubert
git at videolan.org
Tue Jul 2 10:37:32 CEST 2013
vlc/python | branch: master | Olivier Aubert <contact at olivieraubert.net> | Tue Jul 2 10:36:08 2013 +0200| [1ca51c17e762b8d91a3712b3f11330724d68f071] | committer: Olivier Aubert
Fix 3.x DeprecationWarning
Define a __hash__ method in addition to the __eq__ method, to match the data model.
See http://stackoverflow.com/questions/15471333/how-to-eliminate-a-python3-deprecation-warning-for-the-equality-operator for details.
> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=1ca51c17e762b8d91a3712b3f11330724d68f071
---
generate.py | 3 +++
generated/vlc.py | 5 ++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/generate.py b/generate.py
index 76548ae..a4ca14d 100755
--- a/generate.py
+++ b/generate.py
@@ -890,6 +890,9 @@ class _Enum(ctypes.c_uint):
n = self._enum_names_.get(self.value, '') or ('FIXME_(%r)' % (self.value,))
return '.'.join((self.__class__.__name__, n))
+ def __hash__(self):
+ return self.value
+
def __repr__(self):
return '.'.join((self.__class__.__module__, self.__str__()))
diff --git a/generated/vlc.py b/generated/vlc.py
index 765afa7..df139ae 100644
--- a/generated/vlc.py
+++ b/generated/vlc.py
@@ -48,7 +48,7 @@ import sys
from inspect import getargspec
__version__ = "N/A"
-build_date = "Mon Apr 29 12:17:29 2013"
+build_date = "Tue Jul 2 10:35:53 2013"
if sys.version_info[0] > 2:
str = str
@@ -327,6 +327,9 @@ class _Enum(ctypes.c_uint):
n = self._enum_names_.get(self.value, '') or ('FIXME_(%r)' % (self.value,))
return '.'.join((self.__class__.__name__, n))
+ def __hash__(self):
+ return self.value
+
def __repr__(self):
return '.'.join((self.__class__.__module__, self.__str__()))
More information about the vlc-commits
mailing list