From a40095013025006c2fad0eea2a647f2987ca8965 Mon Sep 17 00:00:00 2001 From: Debian Science Team Date: Mon, 7 Dec 2020 23:06:28 +0000 Subject: [PATCH] Fix pytables expressions with Python 3.9 ast.Index has been replaced by a bare value, so we need to do the conversion from Constant to int Author: Rebecca N. Palmer 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandas/core/computation/pytables.py b/pandas/core/computation/pytables.py index a3389a80..1495fe9f 100644 --- a/pandas/core/computation/pytables.py +++ b/pandas/core/computation/pytables.py @@ -425,6 +425,10 @@ def visit_Subscript(self, node, **kwargs): 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