[From nobody Sun Jun 28 18:39:17 2026
Received: (at submit) by bugs.debian.org; 21 Apr 2026 21:01:16 +0000
X-Spam-Checker-Version: SpamAssassin 4.0.1-bugs.debian.org_2005_01_02
 (2024-03-25) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-15.1 required=4.0 tests=BAYES_00,
 BODY_INCLUDES_PACKAGE,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HAS_PACKAGE,
 SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no
 version=4.0.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 47; hammy, 150; neutral, 101; spammy,
 0. spammytokens: hammytokens:0.000-+--python3,
 0.000-+--H*F:D*ubuntu.com, 0.000-+--Salsa, 0.000-+--merge_requests,
 0.000-+--sk:salsad
Return-path: &lt;SRS0=87b0=CV=ubuntu.com=teward@fe-bounces.ubuntu.com&gt;
Received: from smtp.forwardemail.net ([149.28.215.223]:27521)
 by buxtehude.debian.org with esmtps
 (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
 (Exim 4.96)
 (envelope-from &lt;SRS0=87b0=CV=ubuntu.com=teward@fe-bounces.ubuntu.com&gt;)
 id 1wFIDZ-008EBx-1w for submit@bugs.debian.org;
 Tue, 21 Apr 2026 21:01:16 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ubuntu.com;
 h=Content-Transfer-Encoding: Content-Type: Subject: From: To:
 MIME-Version: Date: Message-ID; q=dns/txt; s=fe-953a8a3ca9; t=1776805272;
 bh=XHBSHBVdHDx48F+mtcaBsnq+E17UF0eQV4cWogZB6tE=;
 b=s01t7QEsBBf+HBKOLY39LWkxxhnEJBMwF3pegqHWhF22wZsV2fW/j8nW6XSDpdfA5V8XzyJqh
 +fVhV5kA+qyFdD51GGGuC5Ui9jBu1jgf35+AO0kQECwru47vI+0dW/g1+owMJhz1LlaXSf6wAaU
 KifhxIC3h6MExSnswjqJUOOKLkOi61bjc2KozZd8a9yik2zaNwI+DCfsqNaI0qZoBwQFujZAe8N
 RHVWi/WYLu1JUV27iWanCrZDjMfb+jUF7kAafGn2bxb3fNBodkPy45QYDulM9Ao6HZjEoKPPybG
 FwcFv/8gEMznFohwSQ4xqAH06P3pUjLik/fvqABRVA4Q==
X-Forward-Email-ID: 69e7e59361e433f29d2df52d
X-Forward-Email-Sender: rfc822; teward@ubuntu.com, smtp.forwardemail.net,
 149.28.215.223
X-Forward-Email-Version: 2.7.7
X-Forward-Email-Website: https://forwardemail.net
X-Complaints-To: abuse@forwardemail.net
X-Report-Abuse: abuse@forwardemail.net
X-Report-Abuse-To: abuse@forwardemail.net
Message-ID: &lt;068dce8e-ca9f-4ca5-bb24-f24cc9121889@ubuntu.com&gt;
Date: Tue, 21 Apr 2026 17:01:06 -0400
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: submit &lt;submit@bugs.debian.org&gt;
From: Thomas Ward &lt;teward@ubuntu.com&gt;
Subject: galternatives fails to run with &quot;__annotations__ is not defined&quot;
 errors
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Delivered-To: submit@bugs.debian.org

Package: galternatives
Version: 1.0.10
Severity: normal
Tags: experimental

Note that in Unstable, we use Python 3.13. However, if you install 
Python 3.14 and use that as your system defaults (NOT advised), you will 
replicate this error.

This issue was originally discovered because downstream in Ubuntu for 
Ubuntu 26.04 development cycle, we use Python 3.14 down there. Thus 
showing the Python 3.14 issues here.

---

When trying to run `galternatives` in a Python 3.14 environment, we are 
met with the following crash and failure to execute the software:

Traceback (most recent call last):
   File &quot;/usr/bin/galternatives&quot;, line 6, in &lt;module&gt;
     runpy.run_module('galternatives', run_name='__main__')
     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File &quot;&lt;frozen runpy&gt;&quot;, line 229, in run_module
   File &quot;&lt;frozen runpy&gt;&quot;, line 88, in _run_code
   File &quot;/usr/lib/python3/dist-packages/galternatives/__main__.py&quot;, line 
12, in &lt;module&gt;
     from galternatives.app import GAlternativesApp
   File &quot;/usr/lib/python3/dist-packages/galternatives/app.py&quot;, line 19, 
in &lt;module&gt;
     from .alternative import AltDB, AltGroup, AltOption, CommandResult
   File &quot;/usr/lib/python3/dist-packages/galternatives/alternative.py&quot;, 
line 55, in &lt;module&gt;
     class AltOption(dict[str, str]):
     ...&lt;71 lines&gt;...
                 for i in range(len(group)))
   File &quot;/usr/lib/python3/dist-packages/galternatives/alternative.py&quot;, 
line 65, in AltOption
     __slots__ = tuple(__annotations__)
                       ^^^^^^^^^^^^^^^
NameError: name '__annotations__' is not defined

---

Upon examination of Python Best Practices [1], it is suggested that 
`annotationlib.get_annotations()` be used wherever a direct 
`__annotations__` reference is made.

However, this cannot be done bare, it has to refer to the object itself. 
Additionally, __annotations__ isn't defined by default for classes 
anymore, and thus attempting to set `__slots__` before instantiation 
with `__init__` does not work.

Downstream, and after an hour of poking, changes to set `__slots__` 
during initialization made it capable to fix this issue.

A patch via Merge Request has been made available on Salsa, without 
d/changelog entries. [2]


Thomas


[1]: https://docs.python.org/3/howto/annotations.html

[2]: https://salsa.debian.org/chinese-team/galternatives/-/merge_requests/1
]