Whole file

daggaz/json-stream

The author described this change as re #3 - Fixed bug if first item in a list is another list or dict. It counts as a record because the check below fails on the code as it stood at 2829a5ddf and passes on a1b8c0f99, with nothing else changed between the two runs.

Fix saved2021-07-05
Sharing licenceMIT · LICENSE.txt
Change size+5 1

What the code was meant to do, written into the code itself as a save note

re #3 - Fixed bug if first item in a list is another list or dict

The change

124124 self._done()
125125 if v == ',':
126126 token_type, v = next(self._stream)
127+ elif v in '{[':
128+ pass
127129 else: # pragma: no cover
128130 raise ValueError(f"Expecting value, comma or ], got {v}")
129131 if token_type == TokenType.OPERATOR:
250252 return super()._find_item(k)
251253 except KeyError:
252254 if was_started:
253- raise TransientAccessException(f"{k} not found in transient JSON stream or already passed in this stream")
255+ raise TransientAccessException(
256+ f"{k} not found in transient JSON stream or already passed in this stream",
257+ )
254258 raise
255259
256260 def items(self):

The check that tells the two apart

failpass·src/json_stream/tests/test_loader.py::TestLoader::test_load_nested_transient_first_list_item_list

Check file src/json_stream/tests/test_loader.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it2829a5ddf9a78006c7191a0186c3c811a9107729
Broken version dated2021-07-05
Modulejson_stream.base
Units changedStreamingJSONList, TransientStreamingJSONObject
Fingerprint485f6fd15526669f
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.