Whole file

adafruit/Adafruit_Blinka

The author described this change as Fix generic Linux SPI write_readinto slice. It counts as a record because the check below fails on the code as it stood at ddc468640 and passes on 33f456637, with nothing else changed between the two runs.

Fix saved2026-06-29
Sharing licenceMIT · LICENSE
Change size+2 4

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

Fix generic Linux SPI write_readinto slice

The change

113113 def write_readinto(
114114 self, buffer_out, buffer_in, out_start=0, out_end=None, in_start=0, in_end=None
115115 ):
116- """Perform a half-duplex write from buffer_out and then
117- read data into buffer_in
118- """
116+ """Write to and read from SPI at the same time."""
119117 if buffer_out is None or buffer_in is None:
120118 return
121119 if len(buffer_out) < 1 or len(buffer_in) < 1:
132130 self._spi.max_speed_hz = self.baudrate
133131 self._spi.mode = self.mode
134132 self._spi.bits_per_word = self.bits
135- data = self._spi.transfer(list(buffer_out[out_start : out_end + 1]))
133+ data = self._spi.transfer(list(buffer_out[out_start:out_end]))
136134 for i in range((in_end - in_start)):
137135 buffer_in[i + in_start] = data[i]
138136 # self._spi.close()

The check that tells the two apart

failpass·tests/test_generic_linux_spi.py::test_write_readinto_uses_exclusive_out_end

Check file tests/test_generic_linux_spi.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 itddc4686408315e735feb850ce875e33ad68e118b
Broken version dated2026-06-24
Moduleadafruit_blinka.microcontroller.generic_linux.spi
Units changedSPI
Fingerprintd57a9b84b7e0e0a5
Checked2026-08-18 by goldset/0.1

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