FYI I'm still affected by this issue on up-to-date buster. I have been using the following workaround in my code to recast the constants as ints but I think we probably want to look at backporting whatever fix is in later (bullseye?) releases:
# Ugly workaround for #938965. Brute force conversion of constants to # ints from their representations: for k, v in alsaseq.__dict__.items(): if k.startswith("SEQ_"): try: alsaseq.__dict__[k] = int(repr(v).split("(")[1][:-1], 16) except: pass On Fri, Jan 08, 2021 at 09:58:12AM +0000, Ben Bell wrote: > Package: python-pyalsa > Version: 1.1.6-1+b1 > Severity: important > > pyalsa version 1.1.6 appears to have introduced a bug when setting > sysex data in events. Rather than the string of bytes provided, it > instead produces an equal length string but containing the last byte > over and over: > > With 1.0.26: > Data set as [240, 126, 127, 6, 1, 247] > Data retrieved as {'ext': [240, 126, 127, 6, 1, 247]} > > With 1.1.6: > Data set as [240, 126, 127, 6, 1, 247] > Data retrieved as {'ext': [247, 247, 247, 247, 247, 247]} > > Reproducer: > #!/usr/bin/python > # > > from __future__ import print_function > import pyalsa.alsaseq as alsaseq > > seq = alsaseq.Sequencer() > ne = alsaseq.SeqEvent(alsaseq.SEQ_EVENT_SYSEX) > > data = [0xf0, 0x7e, 0x7f, 0x06, 0x01, 0xf7] > > ne.set_data({"ext": data}) > print("Data set as", data) > print("Data retrieved as", ne.get_data()) > > This bug is in python-1.1.6-1+b1, which is the latest python2 > version. There appears to be another bug (#938965) affecting buster > which stops me testing with python3: > > bjb@rowlf [96] python3 test-alsa-sysex-event.py > Traceback (most recent call last): > File "test-alsa-sysex-event.py", line 8, in <module> > ne = alsaseq.SeqEvent(alsaseq.SEQ_EVENT_SYSEX) > OverflowError: Python int too large to convert to C long > > ...but if I hack around that it's reproducible in python3 too: > bjb@rowlf [99] python3 test-alsa-sysex-event.py > Data set as [240, 126, 127, 6, 1, 247] > Data retrieved as {'ext': [247, 247, 247, 247, 247, 247]} > > At the least we might need a newer version (from bullseye -- untested by > me) backported to buster. > > bjb > > > -- System Information: > Debian Release: 10.6 > APT prefers stable > APT policy: (500, 'stable') > Architecture: amd64 (x86_64) > Foreign Architectures: i386 > > Kernel: Linux 5.10.0-rc5-rt10-rt (SMP w/4 CPU cores; PREEMPT) > Kernel taint flags: TAINT_UNSIGNED_MODULE > Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), > LANGUAGE=en_GB:en (charmap=UTF-8) > Shell: /bin/sh linked to /bin/dash > Init: systemd (via /run/systemd/system) > LSM: AppArmor: enabled > > Versions of packages python-pyalsa depends on: > ii libasound2 1.1.8-1 > ii libc6 2.28-10 > ii python 2.7.16-1 > > python-pyalsa recommends no packages. > > python-pyalsa suggests no packages. > > -- no debconf information