<div dir="ltr">On Mon, Dec 22, 2014 at 10:35 AM, Steve Spicklemire <<a href="mailto:steve@spvi.com">steve@spvi.com</a>> wrote:<br>><br>> I’m working on visual python (<a href="http://vpython.org">http://vpython.org</a>) which lists numpy among its dependencies.<br>><br>> I recently updated my numpy installation to 1.9.1 and I’m now encountering this error:<br>><br>> /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/VPython-6.10-py2.7-macosx-10.10-x86_64.egg/visual_common/materials.py:70: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.<br>>   self.__setattr__(key, value)<br>><br>> Oddly, the code in question looks like this:<br>><br>><br>>      62 from . import cvisual<br>>      63 from numpy import array, reshape, fromstring, ubyte, ndarray, zeros, asarray<br>>      64 import os.path, math<br>>      65<br>>      66 class raw_texture(cvisual.texture):<br>>      67     def __init__(self, **kwargs):<br>>      68         cvisual.texture.__init__(self)<br>>      69         for key, value in kwargs.items():<br>>      70             self.__setattr__(key, value)<br><br>The answer is in the implementation of cvisual.texture somewhere. This is Boost.Python C++ code, so there's a fair bit of magic going on such that I can't pinpoint the precise line that's causing this, but I suspect that it might be this one:<div><br></div><div><a href="https://github.com/BruceSherwood/vpython-wx/blob/master/src/python/numeric_texture.cpp#L258">https://github.com/BruceSherwood/vpython-wx/blob/master/src/python/numeric_texture.cpp#L258</a></div><div><br></div><div>When `data` is assigned, this line checks if the value is None so that it can raise an error to tell you not to do that (I believe, from the context, that `py::object()` is the Boost.Python idiom for getting the None singleton). I *think*, but am not positive, that Boost.Python converts the C++ == operator into a Python == operation, so that would trigger this FutureWarning.<br><br>So VPython is the code that needs to be fixed to do an identity comparison with None rather than an equality comparison.<br><br>--<br>Robert Kern</div></div>