From 11314f0db6e57597e3f56351a86fdb36a7a17dd7 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 12 May 2016 18:29:04 +0200 Subject: python: Share generated methods between objects. * lang/python/pyme/util.py (GpgmeWrapper.__getattr__): Monkey-patch the class. * lang/python/tests/t-wrapper.py: Demonstrate the sharing. Signed-off-by: Justus Winter --- lang/python/tests/t-wrapper.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lang/python/tests/t-wrapper.py') diff --git a/lang/python/tests/t-wrapper.py b/lang/python/tests/t-wrapper.py index acc2ecfd..fab0d811 100755 --- a/lang/python/tests/t-wrapper.py +++ b/lang/python/tests/t-wrapper.py @@ -20,4 +20,6 @@ from pyme import core d0 = core.Data() +d0.seek # trigger on-demand-wrapping assert d0.seek == d0.seek, "Generated wrapper functions are not cached" +assert hasattr(core.Data, 'seek'), "Generated wrapper functions are not shared" -- cgit v1.2.3