summaryrefslogtreecommitdiff
path: root/subversion/bindings/swig/include/proxy.swg
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/bindings/swig/include/proxy.swg')
-rw-r--r--subversion/bindings/swig/include/proxy.swg48
1 files changed, 4 insertions, 44 deletions
diff --git a/subversion/bindings/swig/include/proxy.swg b/subversion/bindings/swig/include/proxy.swg
index d16afc2..701ba77 100644
--- a/subversion/bindings/swig/include/proxy.swg
+++ b/subversion/bindings/swig/include/proxy.swg
@@ -60,51 +60,11 @@
value.assert_valid()
%}
-/* Default code for all wrapped proxy classes in Python */
+/* Default code for all wrapped proxy classes in Python.
+ * Inline the code from a separate file to avoid issues with
+ * SWIG mis-parsing the comments as preprocessor directives. */
%define %proxy_pythoncode(TYPE)
-%pythoncode {
- def set_parent_pool(self, parent_pool=None):
- """Create a new proxy object for TYPE"""
- import libsvn.core, weakref
- self.__dict__["_parent_pool"] = \
- parent_pool or libsvn.core.application_pool;
- if self.__dict__["_parent_pool"]:
- self.__dict__["_is_valid"] = weakref.ref(
- self.__dict__["_parent_pool"]._is_valid)
-
- def assert_valid(self):
- """Assert that this object is using valid pool memory"""
- if "_is_valid" in self.__dict__:
- assert self.__dict__["_is_valid"](), "Variable has already been deleted"
-
- def __getattr__(self, name):
- """Get an attribute from this object"""
- self.assert_valid()
-
- value = _swig_getattr(self, self.__class__, name)
-
- # If we got back a different object than we have, we need to copy all our
- # metadata into it, so that it looks identical
- members = self.__dict__.get("_members")
- if members is not None:
- _copy_metadata_deep(value, members.get(name))
-
- # Verify that the new object is good
- _assert_valid_deep(value)
-
- return value
-
- def __setattr__(self, name, value):
- """Set an attribute on this object"""
- self.assert_valid()
-
- # Save a copy of the object, so that the garbage
- # collector won't kill the object while it's in
- # SWIG-land
- self.__dict__.setdefault("_members",{})[name] = value
-
- return _swig_setattr(self, self.__class__, name, value)
-}
+%pythoncode "proxy.py"
%enddef
/* Define a proxy for wrapping an existing struct */