Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#980906: libpython3.9: _collections_abc.py :type 'types.GenericAlias' is not an acceptable base type

314 views
Skip to first unread message

lenny

unread,
Jan 24, 2021, 2:40:04 AM1/24/21
to
Package: libpython3.9
Version: 3.9.1-3
Severity: critical
Justification: breaks the whole system
X-Debbugs-Cc: lenn...@yahoo.de

Dear Maintainer,

after running a normal apt update and apt upgrade I started getting errors from
python3 packages that should also be upgraded:

Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/usr/lib/python3.9/site.py", line 79, in <module>
import os
File "/usr/lib/python3.9/os.py", line 29, in <module>
from _collections_abc import _check_methods
File "/usr/lib/python3.9/_collections_abc.py", line 416, in <module>
class _CallableGenericAlias(GenericAlias):
TypeError: type 'types.GenericAlias' is not an acceptable base type

From the update log it is visible that first the python3.9 packages were
updates which leds to this error.

If you change the line 416 of the /usr/lib/python3.9/_collections_abc.py file
from:

class _CallableGenericAlias(GenericAlias):

to the type the GenerticAlias represents (Defined at the beginning of the file
as: GenericAlias = type(list[int]):

class _CallableGenericAlias(list[int]):


everything works fine again.

I only have python3.9 and python2.7 installed on my system.

Greetings



-- System Information:
Debian Release: bullseye/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-1-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.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 libpython3.9 depends on:
ii libc6 2.31-9
ii libexpat1 2.2.10-1
ii libpython3.9-stdlib 3.9.1-3
ii zlib1g 1:1.2.11.dfsg-2

libpython3.9 recommends no packages.

libpython3.9 suggests no packages.

-- no debconf information

mike_san12

unread,
Jan 25, 2021, 3:30:03 AM1/25/21
to
Package: libpython3.9
Followup-For: Bug #980906


The correct workaround is:

class _CallableGenericAlias(type(list[int])):

i.e. with type(), because GenericAlias = type(list[int]) in _collections_abc.py.
Semantically, it is intended to make a generic type and list[int] be of the same type.



The bug is not in 3.9.1-2.

Antonio Terceiro

unread,
Jan 25, 2021, 9:30:04 AM1/25/21
to
Control: tags -1 + unreproducible moreinfo
Can you please clarify how exactly you run into this? I have just
upgraded to this version, on a fully up to date sid system, and can't
reproduce any of this.

$ dpkg-query --show libpython3.9
libpython3.9:amd64 3.9.1-3
$ python3 -c 'import site'
$ python3 -c 'import os'
$ python3 -c 'from _collections_abc import _check_methods'
$

I tried both on my main system, and on a clean sid container, and it
just works.
signature.asc

mas...@rbmail.net

unread,
Feb 24, 2021, 7:20:03 AM2/24/21
to
Package: libpython3.9
Followup-For: Bug #980906

Hi,

I also can't reproduce this.

Rainer

Matthias Klose

unread,
Mar 1, 2021, 10:00:04 AM3/1/21
to
Control: severity -1 normal

closing as invalid, not reproducible, no feedback
0 new messages