Repository: ramonhagenaars/jsons

Issue:
fork_inst not being passed along to element deserializer in default list deserializer
https://github.com/ramonhagenaars/jsons/blob/a5150cdd2704e83fe5f8798822a1c901b54dcb1c/jsons/deserializers/default_list.py#L59

I'm not sure if this is intentional or not.

I've registered my deserializers in a fork_inst, but they are not called in certain circumstances.

I tracked the issue down to the linked line in the default_list_deserializer.

My guess is that the kwargs argument should be extended with the fork_inst parameter, before calling the element deserializer.

For now I will check if my issue can be solved, bei either overwriting default_list_deserializer or by not using a fork_inst at all.

Discussion:
patrickguenther: Those failed checks don't seem to be my fault, are they?
ramonhagenaars: > Those failed checks don't seem to be my fault, are they?

No, it seems that Python3.5 can no longer be installed with Actions on an x64 architecture... Can you maybe turn off the checks for 3.5 to see if the checks at least succeed for recent Python versions?
patrickguenther: It says, "1 workflow awaiting approval". Apparently, you have to sign off on workflow executions, for PRs from first time contributors.
codecov-commenter: # [Codecov](https://codecov.io/gh/ramonhagenaars/jsons/pull/161?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars) Report
> Merging [#161](https://codecov.io/gh/ramonhagenaars/jsons/pull/161?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars) (ab5895c) into [master](https://codecov.io/gh/ramonhagenaars/jsons/commit/a5150cdd2704e83fe5f8798822a1c901b54dcb1c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars) (a5150cd) will **not change** coverage.
> The diff coverage is `100.00%`.

```diff
@@            Coverage Diff            @@
##            master      #161   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           60        60           
  Lines         1488      1488           
=========================================
  Hits          1488      1488           
```


| [Impacted Files](https://codecov.io/gh/ramonhagenaars/jsons/pull/161?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars) | Coverage Δ | |
|---|---|---|
| [jsons/deserializers/default\_list.py](https://codecov.io/gh/ramonhagenaars/jsons/pull/161/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars#diff-anNvbnMvZGVzZXJpYWxpemVycy9kZWZhdWx0X2xpc3QucHk=) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/ramonhagenaars/jsons/pull/161?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/ramonhagenaars/jsons/pull/161?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars). Last update [a5150cd...ab5895c](https://codecov.io/gh/ramonhagenaars/jsons/pull/161?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ramon+Hagenaars).


Patch:
diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml
index 5aadfc3..c0ee5c0 100644
--- a/.github/workflows/pythonapp.yml
+++ b/.github/workflows/pythonapp.yml
@@ -17,14 +17,14 @@ jobs:
         ]
         os: [
             ubuntu-latest,
-#            macOS-latest,  FIXME: seems to not work at the moment.
+            macOS-latest,
             windows-latest
         ]
     name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
     steps:
       - uses: actions/checkout@master
       - name: Setup python
-        uses: actions/setup-python@v1
+        uses: actions/setup-python@v3
         with:
           python-version: ${{ matrix.python-version }}
           architecture: x64
diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html
index 155b876..b78a06e 100644
--- a/docs/_templates/sidebarintro.html
+++ b/docs/_templates/sidebarintro.html
@@ -14,7 +14,7 @@
 <h3>Links</h3>
 <ul>
     <li>
-        <a href="https://ghbtns.com/github-btn.html?user=ramonhagenaars&repo=jsons&type=watch&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px">jsons - Github</a>
+        <a href="https://github.com/ramonhagenaars/jsons/" allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px">jsons - Github</a>
     </li>
     <li>
         <a href="https://pypi.org/project/jsons/">jsons - PyPi</a>
diff --git a/jsons/deserializers/default_list.py b/jsons/deserializers/default_list.py
index f64aeda..6f3a880 100644
--- a/jsons/deserializers/default_list.py
+++ b/jsons/deserializers/default_list.py
@@ -56,7 +56,7 @@ def _do_load(
     result = []
     for index, elem in enumerate(obj):
         try:
-            result.append(load(elem, cls=cls, tasks=1, **kwargs))
+            result.append(load(elem, cls=cls, tasks=1, fork_inst=fork_inst, **kwargs))
         except DeserializationError as err:
             new_msg = ('Could not deserialize element at index %s. %s' %
                        (index, err.message))


Test patch:
diff --git a/tests/test_list.py b/tests/test_list.py
index a5a7286..4dcceb3 100644
--- a/tests/test_list.py
+++ b/tests/test_list.py
@@ -184,3 +184,17 @@ class TestList(TestCase):
 
             self.assertIn('500', warn_msg)
             self.assertEqual(999, len(loaded))
+
+    def test_propagation_of_fork_inst(self):
+        class C:
+            def __init__(self, x: int):
+                self.x = x
+
+        def c_deserializer(obj, *_, **__) -> C:
+            return C(obj['x'] * 2)
+
+        fork = jsons.fork(name='fork_inst_propagation')
+        jsons.set_deserializer(c_deserializer, C, fork_inst=fork)
+        cs = jsons.loads('[{"x":2},{"x":3}]', List[C], fork_inst=fork)
+        self.assertEqual(4, cs[0].x)
+        self.assertEqual(6, cs[1].x)