From 0f0c5d69e56f66e0ed7788058c31f423c6b08aab Mon Sep 17 00:00:00 2001 From: mara004 Date: Wed, 17 Jan 2024 14:52:12 +0100 Subject: [PATCH] CLI: fix {compile,runtime}_libdirs mutilation (#203) Amends #161 See https://github.com/ctypesgen/ctypesgen/pull/161#discussion_r1438930554 for explanation --- ctypesgen/__main__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ctypesgen/__main__.py b/ctypesgen/__main__.py index 32c2e78c..668a9858 100644 --- a/ctypesgen/__main__.py +++ b/ctypesgen/__main__.py @@ -327,8 +327,10 @@ def main(givenargs=None): parser.set_defaults(**core_options.default_values) args = parser.parse_args(givenargs) - args.compile_libdirs += args.universal_libdirs - args.runtime_libdirs += args.universal_libdirs + # Important: don't use +=, it modifies the original list instead of + # creating a new one. This can be problematic with repeated API calls. + args.compile_libdirs = args.compile_libdirs + args.universal_libdirs + args.runtime_libdirs = args.runtime_libdirs + args.universal_libdirs # Figure out what names will be defined by imported Python modules args.other_known_names = find_names_in_modules(args.modules)