1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

Change darwin __raw_get() check for list to check it's not the OTHERS

On darwin this comes back with the type `__NSCFArray`, which I can't
find the definition of (in order to test against it).  So instead let's
check that `res` is not-None, and not one of `str` or `int`, because
then it should be (meant to be) `list`.

Yes, this is weird given the pre-rewrite code is:

```python
        def get(self, key: str) -> Union[None, list, str]:
            """Look up a string configuration value."""
            val = self.settings.get(key)
            if val is None:
                return None

            elif isinstance(val, str):
                return str(val)

            elif isinstance(val, list):
                return list(val)  # make writeable

            else:
                return None
```
But maybe something changed since 3.43 was tested and built.
This commit is contained in:
Athanasius 2021-03-13 15:52:41 +00:00
parent 0f83e5b035
commit 1c269e9f4b

View File

@ -581,7 +581,7 @@ class MacConfig(AbstractConfig):
def __raw_get(self, key: str) -> Union[None, list, str, int]:
res = self._settings.get(key)
if isinstance(res, list):
if res and not isinstance(res, str) and not isinstance(res, int):
return list(res)
return res