Crash report
What happened?
To reproduce:
import argparse
import copy
parser = argparse.ArgumentParser()
copy.deepcopy(parser)
This results in the following exception.
File ~/.local/share/uv/python/cpython-3.15.0b1-linux-x86_64-gnu/lib/python3.15/copy.py:138, in deepcopy(x, memo)
136 copier = getattr(x, "__deepcopy__", None)
137 if copier is not None:
--> 138 y = copier(memo)
139 else:
140 reductor = dispatch_table.get(cls)
TypeError: 'str' object is not callable
The root cause is _ColorlessTheme.__getattr__() in argparse.py.
class _ColorlessTheme:
# A 'fake' theme for no colors
def __getattr__(self, name):
# _colorize's no_color themes are just all empty strings
# by directly using empty strings the import is avoided
return ""
It returns "" for the __deepcopy__ atrribute, which copy.deepcopy() then tries to call.
CPython versions tested on:
3.15, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.15.0b1 (main, May 8 2026, 18:33:09) [Clang 22.1.3 ]
Linked PRs
Crash report
What happened?
To reproduce:
This results in the following exception.
The root cause is
_ColorlessTheme.__getattr__()inargparse.py.It returns
""for the__deepcopy__atrribute, whichcopy.deepcopy()then tries to call.CPython versions tested on:
3.15, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.15.0b1 (main, May 8 2026, 18:33:09) [Clang 22.1.3 ]
Linked PRs