From fafc30ac0e94a7d6f37fcb3218ae75279cee7943 Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Sun, 23 Oct 2022 18:45:02 +0000 Subject: [PATCH] argparse drops private method _ensure_value The `argparse` library refactored to improvem performance of common use cases. Handling a list is not a common scenario and the function _ensure_values (which was obviously private) disappeared. This commit simply uses the same strategy that the upstream `argparse` maintainers used. Since this is a subclass of a private object type anyway, this is expected sort of behaviour. --- tldp/config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tldp/config.py b/tldp/config.py index 2428de9..46b796b 100644 --- a/tldp/config.py +++ b/tldp/config.py @@ -8,7 +8,6 @@ from __future__ import unicode_literals import os import argparse -import copy as _copy import logging @@ -30,7 +29,7 @@ class DirectoriesExist(argparse._AppendAction): message = message % (values, option_string) logger.critical(message) raise ValueError(message) - items = _copy.copy(argparse._ensure_value(namespace, self.dest, [])) + items = getattr(namespace, self.dest, []) items.append(values) setattr(namespace, self.dest, items)