Description
I've found that the ValueError that the core attempts to raise from here: https://github.com/adafruit/circuitpython/blob/main/shared-bindings/bitmaptools/__init__.c#L369
ends up instead raising a blank RuntimeError when it executes on a PyPortal (tested on 9.2.7, 10.0.0-alpha.2, and build from main)
Traceback (most recent call last):
File "code.py", line 101, in <module>
RuntimeError:
I have this reproducer code that causes the problem that should raise the ValueError:
import gc
import math
import bitmaptools
import supervisor
import displayio
import ulab.numpy as np
import adafruit_imageload
display = supervisor.runtime.display
display.auto_refresh = False
main_group = displayio.Group(scale=16)
display.root_group = main_group
bmp = displayio.Bitmap(33, 32, 2**16-1)
tg = displayio.TileGrid(bmp, pixel_shader=displayio.ColorConverter())
main_group.append(tg)
converter = displayio.ColorConverter()
source_bmp1 = displayio.Bitmap(32,32, 2**16-1)
source_bmp1.fill(converter.convert(0x0000ff))
source_bmp2 = displayio.Bitmap(32,32, 2**16-1)
source_bmp2.fill(converter.convert(0xff0000))
print(f"free: {gc.mem_free()}")
print(f"used: {gc.mem_alloc()}")
bitmaptools.alphablend(bmp, source_bmp1, source_bmp2, displayio.Colorspace.RGB565, 1.0, 0.5)
display.refresh()
while True:
pass
In further testing it seems that the issue may be with specifically the string "Bitmap" in the error message. If I change the message to use a lowercase "b" in the first word then it works and raises the ValueError with message.
If I change the string to "Bitmaq size and bits per value must match"
it also works and raises the ValueError with message.
If I run the exact same code on a Feather TFT S3 Reverse with stock 9.2.7 it works and prints the full ValueError and message including the string "Bitmap" which seems to cause it to break on the PyPortal.