From 5ec5c400ba5a0e1b1b2d85cc9ef0332189ce1030 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Fri, 3 Mar 2023 21:36:43 +0100 Subject: [PATCH] Cleanup: remove old AST code in I18n message extraction Pre-Python 3.8, the string nodes in an AST were of type ast.Str. Post, they are of type ast.Constant. Remove the old naming. --- scripts/modules/bl_i18n_utils/bl_extract_messages.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/scripts/modules/bl_i18n_utils/bl_extract_messages.py index 946cc07951e..8d3645bb9bc 100644 --- a/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -501,9 +501,7 @@ def dump_py_messages_from_files(msgs, reports, files, settings): Recursively get strings, needed in case we have "Blah" + "Blah", passed as an argument in that case it won't evaluate to a string. However, break on some kind of stopper nodes, like e.g. Subscript. """ - # New in py 3.8: all constants are of type 'ast.Constant'. - # 'ast.Str' will have to be removed when we officially switch to this version. - if type(node) in {ast.Str, getattr(ast, "Constant", None)}: + if type(node) == ast.Constant: eval_str = ast.literal_eval(node) if eval_str and type(eval_str) == str: yield (is_split, eval_str, (node,)) -- 2.30.2