From 9f37496b4c09ecaa178b5f7e8d5c05fe40283f51 Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Mon, 12 Aug 2019 14:48:01 -0700 Subject: [PATCH] Fix parsing "host" and "post" in "attach" request. --- src/ptvsd/common/messaging.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ptvsd/common/messaging.py b/src/ptvsd/common/messaging.py index 085fc7f2..4fa185e7 100644 --- a/src/ptvsd/common/messaging.py +++ b/src/ptvsd/common/messaging.py @@ -357,7 +357,8 @@ class MessageDict(collections.OrderedDict): If validate=False, it's treated as if it were (lambda x: x) - i.e. any value is considered valid, and is returned unchanged. If validate is a type or a - tuple, it's treated as if it were json.of_type(validate). + tuple, it's treated as json.of_type(validate). Otherwise, if validate is not + callable(), it's treated as json.default(validate). If validate() returns successfully, the item is substituted with the value it returns - thus, the validator can e.g. replace () with a suitable default @@ -373,6 +374,8 @@ class MessageDict(collections.OrderedDict): validate = lambda x: x elif isinstance(validate, type) or isinstance(validate, tuple): validate = json.of_type(validate) + elif not callable(validate): + validate = json.default(validate) value = self.get(key, ()) try: