From a3c881ae7877a8061fb671d016ab7d53ae9172af Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 3 Jun 2015 15:08:02 +0100 Subject: [PATCH] support "with Vips.Image" in Python though it doesn't actually do anything, it looks nice --- ChangeLog | 1 + python/Vips.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0af100b6..639c4e8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ - added bandand() bandor() bandeor() convenience funcs to Python - oops, base64 encode could pad by up to two zero bytes - added VipsRefString as a thing that gi bindings can unpack +- support "with Vips.Image as ...:" in Python 7/5/15 started 8.0.3 - dzsave and tif pyr write could fail for some image dimensions, thanks Jonas diff --git a/python/Vips.py b/python/Vips.py index 95e6d0fc..bbce5550 100644 --- a/python/Vips.py +++ b/python/Vips.py @@ -588,6 +588,12 @@ class Image(Vips.Image): # we can use Vips.Image.write_to_memory() directly + # support with in the most trivial way + def __enter__(self): + return self + def __exit__(self, type, value, traceback): + pass + # operator overloads def __getattr__(self, name):