Bug 2303107

Summary: gpgme Python 3.13.0rc1: SystemError: Objects/dictobject.c:3774: bad argument to internal function
Product: [Fedora] Fedora Reporter: Karel Srot <ksrot>
Component: python3.13Assignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: frantisek, igor.raits, jkucera, ksurma, mhlavink, mhroncok, python-maint, python-packagers-sig, vstinner
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: python3.13-3.13.0~rc1-2.fc41 python3.13-3.13.0~rc1-2.fc40 python3.13-3.13.0~rc1-2.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-08-07 16:24:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reproducer none

Description Karel Srot 2024-08-06 11:55:40 UTC
Just observed this on the latest Rawhide.
Before python3 package update things were working fine.

$ rpm -q python3 python3-gpg
python3-3.13.0~b4-3.fc41.x86_64
python3-gpg-1.23.2-5.fc41.x86_64
$ python3
Python 3.13.0b4 (main, Jul 30 2024, 00:00:00) [GCC 14.1.1 20240701 (Red Hat 14.1.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gpg
>>> with open('gpg-key.pub', "rb") as fd:
...     key = fd.read()
...     
>>> with open('signature-gpg-genuine.sig', "rb") as fd:
...     sig = fd.read()
...     
>>> with open('x509_evm.pem', "rb") as fd:
...     body = fd.read()
...     
>>> import tempfile
>>> with tempfile.TemporaryDirectory() as gpg_homedir:
...     ctx = gpg.Context(home_dir=gpg_homedir)
...     result = ctx.key_import(key)
...     _, result = ctx.verify(body, sig)
...     
>>> print(result)
VerifyResult(file_name=None, is_mime=0, signatures=[Signature(chain_model=False, exp_timestamp=0, fpr='2F9995AB27F987B6E9A0F53F3356F5658E67C76B', hash_algo=8, is_de_vs=False, key=None, notations=[], pka_address=None, pka_trust=0, pubkey_algo=1, status=0, summary=0, timestamp=1722944064, validity=0, validity_reason=0, wrong_key_usage=False)])

After the update to the latest python3:

$ rpm -q python3 python3-gpg
python3-3.13.0~rc1-1.fc41.x86_64
python3-gpg-1.23.2-5.fc41.x86_64


>>> with tempfile.TemporaryDirectory() as gpg_homedir:
...     ctx = gpg.Context(home_dir=gpg_homedir)
...     result = ctx.key_import(key)
...     _, result = ctx.verify(body, sig)
...     
Traceback (most recent call last):
  File "<python-input-5>", line 4, in <module>
    _, result = ctx.verify(body, sig)
                ~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib64/python3.13/site-packages/gpg/core.py", line 556, in verify
    results = (self.__read__(sink, data), self.op_verify_result())
                                          ~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/site-packages/gpg/core.py", line 171, in wrapper
    return _funcwrap(self, *args)
  File "/usr/lib64/python3.13/site-packages/gpg/core.py", line 153, in _funcwrap
    result = func(slf.wrapped, *args)
  File "/usr/lib64/python3.13/site-packages/gpg/gpgme.py", line 1381, in gpgme_op_verify_result
    return _gpgme.gpgme_op_verify_result(ctx)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "<frozen importlib._bootstrap>", line 649, in parent
SystemError: /builddir/build/BUILD/python3.13-3.13.0_rc1-build/Python-3.13.0rc1/Objects/dictobject.c:3774: bad argument to internal function


Reproducible: Always

Steps to Reproduce:
See above
Actual Results:  
Traceback

Expected Results:  
No traceback, signature is verified

Comment 1 Karel Srot 2024-08-06 11:56:11 UTC
Created attachment 2043554 [details]
reproducer

Comment 2 Karel Srot 2024-08-06 11:57:03 UTC
Switching to python3.13 per request

Comment 3 Miro Hrončok 2024-08-06 11:58:51 UTC
This is from https://github.com/python/cpython/blob/v3.13.0rc1/Objects/dictobject.c#L3774 -- the line was not added recently (in fact it has been there for years)

Comment 4 Miro Hrončok 2024-08-06 11:59:50 UTC
https://koschei.fedoraproject.org/package/gpgme FTBFS since rc1 with the same error.

Comment 5 Miro Hrončok 2024-08-06 12:00:46 UTC
https://github.com/python/cpython/issues/122728 was reported by our Gentoo friends 3 hours ago.

Comment 6 Victor Stinner 2024-08-06 12:27:52 UTC
I proposed a fix upstream: https://github.com/python/cpython/pull/122735

Comment 7 Fedora Update System 2024-08-07 13:51:30 UTC
FEDORA-2024-9fe1974c0f (python3.13-3.13.0~rc1-2.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-9fe1974c0f

Comment 8 Fedora Update System 2024-08-07 16:24:03 UTC
FEDORA-2024-9fe1974c0f (python3.13-3.13.0~rc1-2.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2024-08-07 17:02:09 UTC
FEDORA-2024-c452738920 (python3.13-3.13.0~rc1-2.fc39) has been submitted as an update to Fedora 39.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-c452738920

Comment 10 Fedora Update System 2024-08-07 17:02:15 UTC
FEDORA-2024-bec5d0df1f (python3.13-3.13.0~rc1-2.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-bec5d0df1f

Comment 11 Fedora Update System 2024-08-08 03:37:03 UTC
FEDORA-2024-c452738920 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-c452738920`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-c452738920

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2024-08-08 04:47:27 UTC
FEDORA-2024-bec5d0df1f has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-bec5d0df1f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-bec5d0df1f

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2024-08-12 01:37:36 UTC
FEDORA-2024-bec5d0df1f (python3.13-3.13.0~rc1-2.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2024-08-16 01:21:25 UTC
FEDORA-2024-c452738920 (python3.13-3.13.0~rc1-2.fc39) has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.