[From nobody Sun Jun  7 11:35:06 2026
Received: (at submit) by bugs.debian.org; 9 Jul 2025 22:10:20 +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,FOURLA,HAS_PACKAGE,MD5_SHA1_SUM,RCVD_IN_PBL,
 RDNS_NONE,SPF_SOFTFAIL,XMAILER_REPORTBUG autolearn=ham
 autolearn_force=no version=4.0.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 68; hammy, 150; neutral, 106; spammy,
 0. spammytokens: hammytokens:0.000-+--XDebbugsCc,
 0.000-+--X-Debbugs-Cc, 0.000-+--python3, 0.000-+--trixie,
 0.000-+--cutf8
Return-path: &lt;emanuele.aina@collabora.com&gt;
Received: from [2001:b07:645b:2d8d:806e:938b:790d:db0e] (port=44970
 helo=[127.0.0.1]) by buxtehude.debian.org with esmtp (Exim 4.96)
 (envelope-from &lt;emanuele.aina@collabora.com&gt;) id 1uZczb-00GjS2-2H
 for submit@bugs.debian.org; Wed, 09 Jul 2025 22:10:20 +0000
Content-Type: multipart/mixed; boundary=&quot;===============7193096545115997421==&quot;
MIME-Version: 1.0
From: Emanuele Aina &lt;emanuele.aina@collabora.com&gt;
To: Debian Bug Tracking System &lt;submit@bugs.debian.org&gt;
Subject: python3-debian: Release.copy() fails trying to split multivalued
 fields that have already been split
Message-ID: &lt;175209901846.3665.546435137954585946.reportbug@alcmeone&gt;
X-Mailer: reportbug 13.2.0
Date: Thu, 10 Jul 2025 00:10:18 +0200
Delivered-To: submit@bugs.debian.org

This is a multi-part MIME message sent by reportbug.


--===============7193096545115997421==
Content-Type: text/plain; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: python3-debian
Version: 1.0.1
Severity: normal
X-Debbugs-Cc: emanuele.aina@collabora.com

When trying to copy a `Release` object or any `_multivalued` subclass
the code calls the constructor via `self.__class__(self)` and then the
`_multivalued.__init__()` treats fields in ``_multivalued_fields` as
strings, even though they have already been parsed in the source object.

This leads to the following exception:

    Traceback (most recent call last):
      File &quot;//home/em/deb822-test.py&quot;, line 18, in &lt;module&gt;
        r2 = r1.copy()
      File &quot;/usr/lib/python3.13/site-packages/debian/deb822.py&quot;, line 602, in copy
        copy = self.__class__(self)
      File &quot;/usr/lib/python3.13/site-packages/debian/deb822.py&quot;, line 1761, in __init__
        for line in filter(None, contents.splitlines()):   # type: str
                                 ^^^^^^^^^^^^^^^^^^^
    AttributeError: 'list' object has no attribute 'splitlines'

-- System Information:
Debian Release: trixie/sid
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.15.4-200.fc42.x86_64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages python3-debian depends on:
ii  python3                     3.13.3-1
ii  python3-charset-normalizer  3.4.2-1

python3-debian recommends no packages.

Versions of packages python3-debian suggests:
pn  gpgv         &lt;none&gt;
ii  python3-apt  3.0.0
pn  zstd         &lt;none&gt;

-- no debconf information

--===============7193096545115997421==
Content-Type: text/plain; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=&quot;deb822-test.py&quot;

import debian
from debian.deb822 import Release

txt = &quot;&quot;&quot;
Suite: testing
Codename: trixie
MD5Sum:
 70ddf531b5b7dbd059eb3fdb88566d4b  1963340 contrib/Contents-all
&quot;&quot;&quot;
r1 = Release(txt)
assert &quot;md5sum&quot; in Release._multivalued_fields
assert r1[&quot;MD5Sum&quot;] == [
    {
        &quot;md5sum&quot;: &quot;70ddf531b5b7dbd059eb3fdb88566d4b&quot;,
        &quot;size&quot;: &quot;1963340&quot;,
        &quot;name&quot;: &quot;contrib/Contents-all&quot;,
    }
]
try:
    r2 = r1.copy()
except:
    print(f&quot;BUG: {debian.__version__ = }&quot;)
    raise
# BUG: debian.__version__ = '0.1.51.dev2+g67bda81'
# Traceback (most recent call last):
#   File &quot;//home/em/deb822-test.py&quot;, line 18, in &lt;module&gt;
#     r2 = r1.copy()
#   File &quot;/usr/lib/python3.13/site-packages/debian/deb822.py&quot;, line 602, in copy
#     copy = self.__class__(self)
#   File &quot;/usr/lib/python3.13/site-packages/debian/deb822.py&quot;, line 1761, in __init__
#     for line in filter(None, contents.splitlines()):   # type: str
#                              ^^^^^^^^^^^^^^^^^^^
# AttributeError: 'list' object has no attribute 'splitlines'

--===============7193096545115997421==--
]