Description
in BinOp.conform in pandas.computation,pytables there is this code:
def conform(self, rhs):
""" inplace conform rhs """
if not com.is_list_like(rhs):
rhs = [rhs]
if hasattr(self.rhs, 'ravel'):
rhs = rhs.ravel()
return rhs
I think this is wrong. The first test checks rhs
, but the second checks self.rhs
. They should both check one or the other. I think both should check local rhs
but I'm not really familiar with all the nuts and bolts here so I'm not sure.
This causes failures when doing HDF5 queries making use of a local variable whose value is a single Numpy value (e.g., a float64). Because even a single numpy value has ravel
, but it is not list-like, both if
blocks execute, meaning that it sets rhs
to a list and then tries to call ravel
on it. This leads to a difficult-to-debug error because the exception is caught at a higher level and replaced with an "Invalid query syntax" error message.