Fix pytables expressions with Python 3.9
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Tue, 12 Jan 2021 21:06:04 +0000 (21:06 +0000)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Tue, 12 Jan 2021 21:06:04 +0000 (21:06 +0000)
ast.Index has been replaced by a bare value, so we need to do the
conversion from Constant to int

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Bug-Debian: https://bugs.debian.org/972015
Forwarded: https://github.com/pandas-dev/pandas/issues/37217

Gbp-Pq: Name python39_compat.patch

pandas/core/computation/pytables.py

index a3389a80b017ac04d23b2d54b7f750c24d92721d..1495fe9f616783c4085635ef11d85b2fd2506840 100644 (file)
@@ -425,6 +425,10 @@ class PyTablesExprVisitor(BaseExprVisitor):
             value = value.value
         except AttributeError:
             pass
+        try:
+            slobj = slobj.value
+        except AttributeError:
+            pass
 
         if isinstance(slobj, Term):
             # In py39 np.ndarray lookups with Term containing int raise