Author: troycurtisjr
Date: Sat Dec 23 04:43:26 2017
New Revision: 1819110
URL: http://svn.apache.org/viewvc?rev=1819110&view=rev
Log:
On branch swig-py3: Replace hasattr check for a method with try-except.
* subversion/bindings/swig/include/proxy.swg
(_assert_valid_deep): Replace hasattr check for the 'assert_valid' method
with a try-except block as some class instances can have the method but
return
False to hasattr().
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/include/proxy.swg
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/include/proxy.swg
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/include/proxy.swg?rev=1819110&r1=1819109&r2=1819110&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/include/proxy.swg
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/include/proxy.swg Sat
Dec 23 04:43:26 2017
@@ -57,8 +57,11 @@
_assert_valid_deep(v)
# Ensure that the passed in value isn't a type, which could have an
# assert_valid attribute, but it can not be called without an instance.
- elif type(value) != type and hasattr(value, "assert_valid"):
+ elif type(value) != type:
+ try:
value.assert_valid()
+ except AttributeError:
+ pass
%}
/* Default code for all wrapped proxy classes in Python.