Repository: omry/omegaconf

Issue:
Error expanding an DictConfig in pycharm debugger
OmegaConf.create(dict(foo={}))

expanding foo results in a stack trace in the debugger.


Discussion:
coveralls: ## Pull Request Test Coverage Report for [Build 170](https://coveralls.io/builds/26881976)

* **2** of **2**   **(100.0%)**  changed or added relevant lines in **1** file are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage increased (+**0.005%**) to **98.063%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/26881976/badge)](https://coveralls.io/builds/26881976) |
| :-- | --: |
| Change from base [Build 163](https://coveralls.io/builds/26881728): |  0.005% |
| Covered Lines: | 810 |
| Relevant Lines: | 826 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Patch:
diff --git a/news/40.bugfix b/news/40.bugfix
new file mode 100644
index 0000000..8163863
--- /dev/null
+++ b/news/40.bugfix
@@ -0,0 +1,1 @@
+Fix an error when expanding an empty dictionary in PyCharm debugger
diff --git a/omegaconf/dictconfig.py b/omegaconf/dictconfig.py
index 5b35776..9f81527 100644
--- a/omegaconf/dictconfig.py
+++ b/omegaconf/dictconfig.py
@@ -68,6 +68,10 @@ class DictConfig(Config):
         :param key:
         :return:
         """
+        # PyCharm is sometimes inspecting __members__. returning None or throwing is
+        # confusing it and it prints an error when inspecting this object.
+        if key == "__members__":
+            return {}
         return self.get(key=key, default_value=None)
 
     def __getitem__(self, key):


Test patch:
diff --git a/tests/test_basic_ops_dict.py b/tests/test_basic_ops_dict.py
index 55af782..d968908 100644
--- a/tests/test_basic_ops_dict.py
+++ b/tests/test_basic_ops_dict.py
@@ -391,3 +391,9 @@ def test_get_with_default_from_struct_not_throwing():
     c = OmegaConf.create(dict(a=10, b=20))
     OmegaConf.set_struct(c, True)
     assert c.get("z", "default") == "default"
+
+
+def test_members():
+    # Make sure accessing __members__ does not return None or throw.
+    c = OmegaConf.create({"foo": {}})
+    assert c.__members__ == {}