# Buggy code
def _deactivate(self):
    if self._gtype in (gl.GL_SAMPLER_2D, GL_SAMPLER_3D):
        # gl.glActiveTexture(gl.GL_TEXTURE0 + self._unit)
        if self.data is not None:
            self.data.deactivate()


# Traceback (TypeError)
WARNING: normal has not been bound
WARNING: color has not been bound
WARNING: Traceback (most recent call last):
File "textured_cube.py", line 102, in <module>
c.show()
File "/home/cyrille/git/vispy/vispy/app/canvas.py", line 320, in show
return self._backend._vispy_set_visible(visible)
File "/home/cyrille/git/vispy/vispy/app/backends/_qt.py", line 288, in _vispy_set_visible
self.showNormal()
File "/home/cyrille/git/vispy/vispy/app/backends/_qt.py", line 322, in initializeGL
self._vispy_canvas.events.initialize()
File "/home/cyrille/git/vispy/vispy/util/event.py", line 418, in __call__
self._invoke_callback(cb, event)
File "/home/cyrille/git/vispy/vispy/util/event.py", line 446, in _invoke_callback
self, cb_event=(cb, event))
<< caught exception here: >>
File "/home/cyrille/git/vispy/vispy/util/event.py", line 435, in _invoke_callback
cb(event)
File "textured_cube.py", line 73, in on_initialize
self.program['texture'] = checkerboard()
File "textured_cube.py", line 45, in checkerboard
row_even = grid_num / 2 * [0, 1]
TypeError: can't multiply sequence by non-int of type 'float'
WARNING: Error invoking callback <bound method Canvas.on_initialize of <Vispy canvas (PyQt4 (qt) backend) at 0x7fe29c5ce0f0>> for event: <Event blocked=False handled=False native=None source=<Vispy canvas (PyQt4 (qt) backend) at 0x7fe29c5ce0f0> sources=[<Vispy canvas (PyQt4 (qt) backend) at 0x7fe29c5ce0f0>] type=initialize>
WARNING: Traceback (most recent call last):
File "textured_cube.py", line 103, in <module>
app.run()
File "/home/cyrille/git/vispy/vispy/app/_default_app.py", line 54, in run
return default_app.run()
File "/home/cyrille/git/vispy/vispy/app/application.py", line 88, in run
return self._backend._vispy_run()
File "/home/cyrille/git/vispy/vispy/app/backends/_qt.py", line 175, in _vispy_run
return app.exec_()
File "/home/cyrille/git/vispy/vispy/app/backends/_qt.py", line 334, in paintGL
self._vispy_canvas.events.draw(region=None)
File "/home/cyrille/git/vispy/vispy/util/event.py", line 418, in __call__
self._invoke_callback(cb, event)
File "/home/cyrille/git/vispy/vispy/util/event.py", line 446, in _invoke_callback
self, cb_event=(cb, event))
<< caught exception here: >>
File "/home/cyrille/git/vispy/vispy/util/event.py", line 435, in _invoke_callback
cb(event)
File "textured_cube.py", line 83, in on_draw
self.program.draw('triangles', self.indices)
File "/home/cyrille/git/vispy/vispy/gloo/program.py", line 526, in draw
self.deactivate()
File "/home/cyrille/git/vispy/vispy/gloo/globject.py", line 61, in deactivate
self._deactivate()
File "/home/cyrille/git/vispy/vispy/gloo/program.py", line 225, in _deactivate
self._deactivate_variables()
File "/home/cyrille/git/vispy/vispy/gloo/program.py", line 324, in _deactivate_variables
uniform.deactivate()
File "/home/cyrille/git/vispy/vispy/gloo/globject.py", line 61, in deactivate
self._deactivate()
File "/home/cyrille/git/vispy/vispy/gloo/variable.py", line 232, in _deactivate
self.data.deactivate()
AttributeError: 'numpy.ndarray' object has no attribute 'deactivate'
WARNING: Error invoking callback <bound method Canvas.on_draw of <Vispy canvas (PyQt4 (qt) backend) at 0x7fe29c5ce0f0>> for event: <DrawEvent blocked=False handled=False native=None region=None source=<Vispy canvas (PyQt4 (qt) backend) at 0x7fe29c5ce0f0> sources=[<Vispy canvas (PyQt4 (qt) backend) at 0x7fe29c5ce0f0>] type=draw>
WARNING: Error invoking callback <bound method Canvas.on_draw of <Vispy canvas (PyQt4 (qt) backend) at 0x7fe29c5ce0f0>> repeat 2
WARNING: Error invoking callback <bound method Canvas.on_draw of <Vispy canvas (PyQt4 (qt) backend) at 0x7fe29c5ce0f0>> repeat 3
`̀``

# Fixed code
def _deactivate(self):
    if self._gtype in (gl.GL_SAMPLER_2D, GL_SAMPLER_3D):
        # gl.glActiveTexture(gl.GL_TEXTURE0 + self._unit)
        if self.data is not None:
            if isinstance(self._data, BaseTexture):
                self.data.deactivate()