I think a comment in the code here would be very helpful. If I ran across this code, I would have no idea that restoring the original value is an important part of what's going on. If I were testing that assigning 0 to 'value' worked (for example), there's every chance I'd put it at the end, after 'value' was restored to 'x'.
Eric. thomas.heller wrote: > Author: thomas.heller > Date: Wed Dec 12 09:32:02 2007 > New Revision: 59472 > > Modified: > python/branches/py3k/Lib/ctypes/test/test_values.py > Log: > This test checks and modifies the value of an integer stored in a dll. > Restore the original value after modifying it so that subsequent tests > will not fail. Fixes the failure in issue 1597. > > > Modified: python/branches/py3k/Lib/ctypes/test/test_values.py > ============================================================================== > --- python/branches/py3k/Lib/ctypes/test/test_values.py (original) > +++ python/branches/py3k/Lib/ctypes/test/test_values.py Wed Dec 12 > 09:32:02 2007 > @@ -16,6 +16,8 @@ > self.failUnlessEqual(x, ctdll.get_an_integer()) > an_integer.value *= 2 > self.failUnlessEqual(x*2, ctdll.get_an_integer()) > + an_integer.value = x > + self.failUnlessEqual(x, ctdll.get_an_integer()) > > def test_undefined(self): > ctdll = CDLL(_ctypes_test.__file__) > _______________________________________________ > Python-3000-checkins mailing list > Python-3000-checkins@python.org > http://mail.python.org/mailman/listinfo/python-3000-checkins > _______________________________________________ Python-3000-checkins mailing list Python-3000-checkins@python.org http://mail.python.org/mailman/listinfo/python-3000-checkins