[SRU] python3-qrencode fails with SystemError about PY_SSIZE_T_CLEAN macro

Bug #2056361 reported by Arrigo Marchiori
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-qrencode (Debian)
Fix Released
Unknown
python-qrencode (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned

Bug Description

[ Impact ]

python3-qrencode is completely unusable as it will crash with the following error whenever any user tries to use to generate a QR code:

  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

[ Test Plan ]

Add the following content in a python file:

import qrencode

(version, size, im) = qrencode.encode("This is working")

im.show()

execute the python script. With the fixed package it will display the QR code.

[ Where problems could occur ]

It is only defining 'PY_SSIZE_T_CLEAN' before including Python.h as is suggested by upstream Python docs. There might be some adverse affect for this but the package is already unusable.

[ Other Info ]

The same fix from Debian is in Mantic.
Noble is also affected but I can not mark the bug status as confirmed. The NMU fix was lost with the update to 1.2-6. But I have now done a QA upload in Debian with the fix and also added an autopkgtest which has the same python script as the test plan. So, when 1.2-7 syncs, Noble will be fixed.

[ Original Bug Description ]

Python3 module qrencode does not allow generating QR codes using function encode().

The attached very simple script dies as follows:

$ ./python3-qrencode.py
Traceback (most recent call last):
  File "/home/arrigo/temp/./python3-qrencode.py", line 5, in <module>
    qrencode.encode("Hello world")
  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

Package: python3-qrencode version 1.2-5build6, architecture amd64 on Ubuntu 22.04

Revision history for this message
Arrigo Marchiori (ardovm) wrote :
Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I have tested and can confirm the bug in Jammy. Also tested Focal and Mantic to confirm the issue is not reproduced.

Changed in python-qrencode (Ubuntu):
status: New → Confirmed
Changed in python-qrencode (Ubuntu Jammy):
status: New → Confirmed
Changed in python-qrencode (Ubuntu):
status: Confirmed → Fix Released
Changed in python-qrencode (Ubuntu Jammy):
status: Confirmed → In Progress
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in python-qrencode (Debian):
status: Unknown → Fix Released
Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

debdiff attached for Jammy

summary: - python3-qrencode fails with SystemError about PY_SSIZE_T_CLEAN macro
+ [SRU] python3-qrencode fails with SystemError about PY_SSIZE_T_CLEAN
+ macro
description: updated
Changed in python-qrencode (Ubuntu Jammy):
status: In Progress → Confirmed
assignee: Sudip Mukherjee (sudipmuk) → nobody
Revision history for this message
Dave Jones (waveform) wrote :

Patch looks good, and the test case is well written; sponsoring

Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Arrigo, or anyone else affected,

Accepted python-qrencode into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/python-qrencode/1.2-5ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in python-qrencode (Ubuntu Jammy):
status: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I can confirm that python3-qrencode from jammy-proposed has fixed the bug for me.

Test done:

Install python3-qrencode on a jammy installation.
create the python file with content from test plan.
execute the python script
confirm the issue is seen

Add jammy-proposed to apt sources
update python3-qrencode from jammy-proposed
execute the python script again
cofirm the QR code is generated and displayed

Test result: the issue with python3-qrencode has been fixed.

Package tested:

$ apt-cache policy python3-qrencode
python3-qrencode:
  Installed: 1.2-5ubuntu0.1
  Candidate: 1.2-5ubuntu0.1
  Version table:
 *** 1.2-5ubuntu0.1 500
        500 http://gb.archive.ubuntu.com/ubuntu jammy-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     1.2-5build6 500
        500 http://gb.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

tags: added: verification-done verification-done-jammy
removed: verification-needed verification-needed-jammy
Revision history for this message
Arrigo Marchiori (ardovm) wrote :

I can also confirm that the package for Jammy from the "proposed" repository fixes this issue.

Revision history for this message
Robie Basak (racb) wrote : Update Released

The verification of the Stable Release Update for python-qrencode has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-qrencode - 1.2-5ubuntu0.1

---------------
python-qrencode (1.2-5ubuntu0.1) jammy; urgency=medium

  * Fix crash in Python 3.10 (LP: #2056361)

 -- Sudip Mukherjee <email address hidden> Tue, 12 Mar 2024 21:01:40 +0000

Changed in python-qrencode (Ubuntu Jammy):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.