[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1032287: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats



Package: python3-qrencode
Version: 1.2-5+b8
Severity: grave
X-Debbugs-Cc: debian-python@lists.debian.org

It looks like the qrencode Python library is currently unusable in
Debian bookworm. Here's a simple example:

anarcat@angela:paperbackup$ python3 -c 'import qrencode ; version, size, data = qrencode.encode(b"test")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/qrencode/__init__.py", line 47, in encode
    version, size, data = _encode(data, version, level, hint, True)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
anarcat@angela:paperbackup[1]$

According to a casual search on the web, it looks like the extension
needs to be recompiled / patched for Python 3.10:

https://stackoverflow.com/a/71019907

Quote:

> On 3.10 any module(s) that use the # variant when parsing arguments
> need to have a #define PY_SSIZE_T_CLEAN before including Python.h.

So this could be as simple as:

--- python-qrencode-1.2.orig/qr_encode.c
+++ python-qrencode-1.2/qr_encode.c
@@ -1,3 +1,4 @@
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <stdlib.h>
 #include <qrencode.h>

Will test this out soon.

-- System Information:
Debian Release: bookworm/sid
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'testing'), (500, 'stable'), (1, 'experimental'), (1, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-5-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=fr_CA.UTF-8, LC_CTYPE=fr_CA.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-qrencode depends on:
ii  libc6         2.36-8
ii  libqrencode4  4.1.1-1
ii  python3       3.11.2-1

python3-qrencode recommends no packages.

python3-qrencode suggests no packages.

-- no debconf information


Reply to: