Skip to content

TypeError: must be str, not list when appending subtype of str to a list in uv-managed python installation on linux #13610

Closed
@DetachHead

Description

@DetachHead

Summary

this is a very strange bug because the following code only seems to crash on an uv-managed python installation and only on linux:

class Foo(str): ...

a = []
new_value = Foo("1")
a += new_value
$ uv run python3.13
Python 3.13.3 (main, May 22 2025, 02:00:23) [Clang 20.1.4 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(str): ...
...
... a = []
... new_value = Foo("1")
... a += new_value
...
Traceback (most recent call last):
  File "<python-input-0>", line 5, in <module>
    a += new_value
TypeError: must be str, not list

on the system version of python it works fine:

$ python3.13
Python 3.13.3 (main, Apr  9 2025, 08:55:03) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(str): ...
...
... a = []
... new_value = Foo("1")
... a += new_value
...
>>>

but on windows it works fine even, with the uv-managed python version:

> uv run python
Python 3.13.3 (main, Apr  9 2025, 04:04:49) [MSC v.1943 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(str): ...
... 
>>> a = []
>>> new_value = Foo("1")
>>> a += new_value
>>>

Platform

Linux 5.15.167.4-microsoft-standard-WSL2 x86_64 GNU/Linux

Version

0.7.7

Python version

3.13.3

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions