summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-02-23 19:46:24 +0100
committerDavid Robillard <d@drobilla.net>2020-02-23 19:46:24 +0100
commit499a8f5f75e68befc87b23082292637aad0fcbe5 (patch)
tree3f8da58feeca7ef6a1309a74a343e53697bd6599
parentdb0376206ca92c402f0d4f8d20c96307c41a7d02 (diff)
downloadlilv-499a8f5f75e68befc87b23082292637aad0fcbe5.tar.gz
lilv-499a8f5f75e68befc87b23082292637aad0fcbe5.tar.bz2
lilv-499a8f5f75e68befc87b23082292637aad0fcbe5.zip
Fix namespace add operator with Python 2
In Python 2, a __coerce__ attribute of the Namespace is requested in this case, which ends up producing an error. Work around this by defining a __coerce__ method that does nothing so __getattr__ is not called for it.
-rw-r--r--bindings/python/lilv.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bindings/python/lilv.py b/bindings/python/lilv.py
index ffea115..45b8e05 100644
--- a/bindings/python/lilv.py
+++ b/bindings/python/lilv.py
@@ -1152,6 +1152,9 @@ class Namespace:
def __str__(self):
return self.prefix
+ def __coerce__(self, ignored):
+ return None
+
def __getattr__(self, suffix):
return self.world.new_uri(self.prefix + suffix)