-
- def monkeypatch_method_if_not_set(cls):
- def decorator(func):
- print '!!! patching %s with %s' % (cls, func.__name__)
- if not hasattr(cls, func.__name__):
- setattr(cls, func.__name__, func)
- return func
- return decorator
-
- from rpyc.core.netref import builtin_classes_cache
- netref_list = builtin_classes_cache[('list', '__builtin__')]
- print 'got', netref_list
-
- @monkeypatch_method_if_not_set(netref_list)
- def __tojava__(self, java_type):
- print '__tojava__ on', type(self)
- # from PySequence.java in Jython's source code
- if java_type.isArray():
- component = java_type.getComponentType()
- print '... got component as', type(component), repr(component)
- import array
- return array.array(component, self)
- UHOH
-