One function

RawCopy in construct/construct

The author described this change as RawCopy fixed missing context value (bug #358). It counts as a record because the check below fails on the code as it stood at 881cc3232 and passes on 5bea0d2e3, with nothing else changed between the two runs.

Fix saved2017-06-01
Sharing licenceMIT · LICENSE
Change size+2 1

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

Returns a dict containing both parsed subcon, the raw bytes that were consumed by it, starting and ending offset in the stream, and the amount of bytes. Builds either from raw bytes or a value used by subcon. Context does contain a dict with data (if built from raw bytes) or with both (if built from value or parsed). Example::

The change

3333 if 'value' in obj:
3434 value = obj['value']
3535 offset1 = stream.tell()
36- value = self.subcon._build(value, stream, context, path)
36+ ret = self.subcon._build(value, stream, context, path)
37+ value = value if ret is None else ret
3738 offset2 = stream.tell()
3839 stream.seek(offset1)
3940 data = _read_stream(stream, offset2-offset1)

The check that tells the two apart

failpass·tests/test_all.py::TestCore::test_rawcopy_issue_358

Check file tests/test_all.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 it881cc323275cf12e368b02c63d1187dbc58ac7de
Broken version dated2017-05-24
Moduleconstruct.core
Units changedRawCopy
Fingerprint9b2b3c0f84a75afe
Checked2026-08-18 by goldset/0.1

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

Other bugs found in construct/construct