nebius/SWE-bench-extra huggingface dataset:
Repository: chimpler/pyhocon

Issue:
get_list() returns NoneValue's, not None's
Given the following pyhocon file:
```
single_value = null
list_value = [null]
```

And the following code:
```python
from pyhocon import ConfigFactory
config = ConfigFactory.parse_file("test.conf")

single_value = config.get("single_value")
print single_value, single_value is None

list_value = config.get_list("list_value")[0]
print list_value, list_value is None

print single_value == list_value
``` 

You get as output:
```
None True
<pyhocon.config_tree.NoneValue object at 0xe20ad0> False
False
```

I expected both values to be Python's `None`.

Comments:

Patch:
diff --git a/pyhocon/config_tree.py b/pyhocon/config_tree.py
index 075bae1..354bfb6 100644
--- a/pyhocon/config_tree.py
+++ b/pyhocon/config_tree.py
@@ -93,7 +93,7 @@ class ConfigTree(OrderedDict):
                     self._push_history(key_elt, value)
                     self[key_elt] = value
                 elif isinstance(l, list):
-                    l += value
+                    self[key_elt] = l + value
                     self._push_history(key_elt, l)
                 elif l is None:
                     self._push_history(key_elt, value)
@@ -144,6 +144,8 @@ class ConfigTree(OrderedDict):
         if key_index == len(key_path) - 1:
             if isinstance(elt, NoneValue):
                 return None
+            elif isinstance(elt, list):
+                return [None if isinstance(x, NoneValue) else x for x in elt]
             else:
                 return elt
         elif isinstance(elt, ConfigTree):


Test patch:
diff --git a/tests/test_config_parser.py b/tests/test_config_parser.py
index ca08db6..8d9dffd 100644
--- a/tests/test_config_parser.py
+++ b/tests/test_config_parser.py
@@ -212,9 +212,11 @@ class TestConfigParser(object):
         config = ConfigFactory.parse_string(
             """
             a = null
+            b = [null]
             """
         )
         assert config.get('a') is None
+        assert config.get('b')[0] is None
 
     def test_parse_override(self):
         config = ConfigFactory.parse_string(
diff --git a/tests/test_config_tree.py b/tests/test_config_tree.py
index 97a8e17..3d194de 100644
--- a/tests/test_config_tree.py
+++ b/tests/test_config_tree.py
@@ -9,7 +9,7 @@ except ImportError:  # pragma: no cover
     from ordereddict import OrderedDict
 
 
-class TestConfigParser(object):
+class TestConfigTree(object):
 
     def test_config_tree_quoted_string(self):
         config_tree = ConfigTree()
Repository: chimpler/pyhocon

Issue:
NoneValue object in parse result of "a=null" in PyPy
In PyPy, parse result of "a=null" has a NoneValue object which is wrong:
```
Python 2.7.12 (aff251e543859ce4508159dd9f1a82a2f553de00, Nov 25 2016, 00:02:08)
[PyPy 5.6.0 with GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> from pyhocon import ConfigFactory
>>>> ConfigFactory.parse_string('a=null')
ConfigTree([('a', <pyhocon.config_tree.NoneValue object at 0x00000001116cbe18>)])
```

In CPython, it's ok:

```
Python 2.7.13 (default, Dec 18 2016, 07:03:39) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyhocon import ConfigFactory
>>> ConfigFactory.parse_string('a=null')
ConfigTree([('a', None)])
```

Versions:
* pyhocon==0.3.35
* pyparsing==2.1.10
* PyPy and CPython versions are above.

Comments:

Patch:
diff --git a/pyhocon/config_tree.py b/pyhocon/config_tree.py
index 1492793..c39a977 100644
--- a/pyhocon/config_tree.py
+++ b/pyhocon/config_tree.py
@@ -1,7 +1,6 @@
 from collections import OrderedDict
 from pyparsing import lineno
 from pyparsing import col
-
 try:
     basestring
 except NameError:  # pragma: no cover
@@ -364,6 +363,14 @@ class ConfigTree(OrderedDict):
             raise KeyError(item)
         return val
 
+    try:
+        from collections import _OrderedDictItemsView
+    except ImportError:  # pragma: nocover
+        pass
+    else:
+        def items(self):  # pragma: nocover
+            return self._OrderedDictItemsView(self)
+
     def __getattr__(self, item):
         val = self.get(item, NonExistentKey)
         if val is NonExistentKey:


Test patch:
diff --git a/tests/test_config_tree.py b/tests/test_config_tree.py
index fbdee7b..1435cff 100644
--- a/tests/test_config_tree.py
+++ b/tests/test_config_tree.py
@@ -1,6 +1,6 @@
 import pytest
 from collections import OrderedDict
-from pyhocon.config_tree import ConfigTree
+from pyhocon.config_tree import ConfigTree, NoneValue
 from pyhocon.exceptions import (
     ConfigMissingException, ConfigWrongTypeException, ConfigException)
 
@@ -70,6 +70,11 @@ class TestConfigTree(object):
         config_tree.put("a.b.c", None)
         assert config_tree.get("a.b.c") is None
 
+    def test_config_tree_null_items(self):
+        config_tree = ConfigTree()
+        config_tree.put("a", NoneValue())
+        assert list(config_tree.items()) == [("a", None)]
+
     def test_getters(self):
         config_tree = ConfigTree()
         config_tree.put("int", 5)