From 45904a0ac01f589d4416f50698010f994c251811 Mon Sep 17 00:00:00 2001 From: Andrew Jewett Date: Wed, 5 Aug 2020 12:32:30 -0700 Subject: [PATCH] fixed a python3-specific bug in ttree.py causing expressions containing ".." (like "@atom:../A") to sometimes cause an uncaught exception --- moltemplate/scripts/moltemplate.sh | 4 ++-- moltemplate/ttree.py | 11 ++++++++--- setup.py | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/moltemplate/scripts/moltemplate.sh b/moltemplate/scripts/moltemplate.sh index 59daf032..97ab74b2 100755 --- a/moltemplate/scripts/moltemplate.sh +++ b/moltemplate/scripts/moltemplate.sh @@ -6,8 +6,8 @@ # Copyright (c) 2013 G_PROGRAM_NAME="moltemplate.sh" -G_VERSION="2.18.3" -G_DATE="2020-7-26" +G_VERSION="2.18.4" +G_DATE="2020-8-05" echo "${G_PROGRAM_NAME} v${G_VERSION} ${G_DATE}" >&2 echo "" >&2 diff --git a/moltemplate/ttree.py b/moltemplate/ttree.py index 741854cb..bc82ce6b 100755 --- a/moltemplate/ttree.py +++ b/moltemplate/ttree.py @@ -102,8 +102,8 @@ g_module_name = g_filename if g_filename.rfind('.py') != -1: g_module_name = g_filename[:g_filename.rfind('.py')] -g_date_str = '2020-7-09' -g_version_str = '0.86.4' +g_date_str = '2020-8-05' +g_version_str = '0.86.5' class ClassReference(object): @@ -4317,7 +4317,12 @@ def AssignStaticVarPtrs(context_node, search_instance_commands=False): AssignTemplateVarPtrs(command.tmpl_list, context_node) # Recursively invoke AssignVarPtrs() on all (non-leaf) child nodes: - for child in context_node.children.values(): + #old code: + # for child in context_node.children.values(): + #new code (make copy before iterating since children are added during loop): + # for child in context_node.children.copy().values(): + #this also works: + for child in list(context_node.children.values()): AssignStaticVarPtrs(child, search_instance_commands) diff --git a/setup.py b/setup.py index ea424880..9fd7c86a 100644 --- a/setup.py +++ b/setup.py @@ -45,9 +45,9 @@ url='https://github.com/jewettaij/moltemplate', - download_url='https://github.com/jewettaij/moltemplate/archive/v2.18.3.zip', + download_url='https://github.com/jewettaij/moltemplate/archive/v2.18.4.zip', - version='2.18.3', + version='2.18.4', keywords=['simulation', 'LAMMPS', 'molecule editor', 'molecule builder', 'ESPResSo'],