phabricator: stringify the argument to `getattr()` stable
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 01 Dec 2023 23:58:12 -0500
branchstable
changeset 51147 4ed9efb25bc7
parent 51146 de9cbc5a1450
child 51148 1dd01023649d
phabricator: stringify the argument to `getattr()` This fixes a "TypeError: getattr(): attribute name must be string" crash and subsequent test spew. This likely broke in 18c8c18993f0 and was missed in CI because `pytest-vcr` is missing.
hgext/phabricator.py
--- a/hgext/phabricator.py	Mon Nov 13 09:19:11 2023 -0800
+++ b/hgext/phabricator.py	Fri Dec 01 23:58:12 2023 -0500
@@ -1926,7 +1926,9 @@
                 raise error.Abort(_(b'unknown symbol: %s') % tree[1])
         elif op in {b'and_', b'add', b'sub'}:
             assert len(tree) == 3
-            return getattr(operator, op)(walk(tree[1]), walk(tree[2]))
+            return getattr(operator, pycompat.sysstr(op))(
+                walk(tree[1]), walk(tree[2])
+            )
         elif op == b'group':
             return walk(tree[1])
         elif op == b'ancestors':