One function

Stream in dcbaker/jsonstreams

The author described this change as Stream: Fix write method to write commas.. It counts as a record because the check below fails on the code as it stood at 23f01fc3a and passes on cc5966953, with nothing else changed between the two runs.

Fix saved2016-08-17
Sharing licenceMIT · LICENSE
Change size+3 1

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

A JSON stream object. This object is the "root" object for the stream. It handles opening and closing the file, and provides the ability to write into the stream, and to open sub elements. This element can be used as a context manager, which is the recommended way to use it. Arguments: filename -- the name of the file to open jtype -- either 'object' or 'array', this will set the type of the stream's root. Keyword Arguments: indent -- How much to indent each level, if set to 0 no indent will be used and the stream will be written in a single line. Default: 0 encoder -- A json.JSONEncoder instance. This will be used to encode objects passed to the write method of the Stream and all instances returned by the subarray and subobject methods of this instance and it's children. Default: json.JSONEncoder

The change

3939
4040 self.subobject = self.__inst.subobject
4141 self.subarray = self.__inst.subarray
42- self.write = self.__inst.write
42+
43+ def write(self, *args, **kwargs):
44+ self.__inst.write(*args, **kwargs)
4345
4446 def close(self):
4547 """Close the root element and the file."""

The check that tells the two apart

failpass·tests/test_stream.py::TestStream::test_write_two

Check file tests/test_stream.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 it23f01fc3a44c417c22b6fb7b652d19053298d8de
Broken version dated2016-08-17
Modulejsonstreams.__init__
Units changedStream
Fingerprint3c32bc836f5e8d32
Checked2026-08-18 by goldset/0.1

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