Title: Python 3.15: `AttributeError` from `argparse` on every `tmuxp` command · Issue #1094 · tmux-python/tmuxp · GitHub
Open Graph Title: Python 3.15: `AttributeError` from `argparse` on every `tmuxp` command · Issue #1094 · tmux-python/tmuxp
X Title: Python 3.15: `AttributeError` from `argparse` on every `tmuxp` command · Issue #1094 · tmux-python/tmuxp
Description: Step 1: Provide a summary of your problem On Python 3.15.0, every tmuxp invocation, including tmuxp --version, fails with AttributeError: 'NoneType' object has no attribute 'reset' while the argument parser is being built. TmuxpHelpForma...
Open Graph Description: Step 1: Provide a summary of your problem On Python 3.15.0, every tmuxp invocation, including tmuxp --version, fails with AttributeError: 'NoneType' object has no attribute 'reset' while the argume...
X Description: Step 1: Provide a summary of your problem On Python 3.15.0, every tmuxp invocation, including tmuxp --version, fails with AttributeError: 'NoneType' object has no attribute 'reset' ...
Opengraph URL: https://github.com/tmux-python/tmuxp/issues/1094
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python 3.15: `AttributeError` from `argparse` on every `tmuxp` command","articleBody":"### Step 1: Provide a summary of your problem\n\nOn Python 3.15.0, every `tmuxp` invocation, including `tmuxp --version`, fails with `AttributeError: 'NoneType' object has no attribute 'reset'` while the argument parser is being built. `TmuxpHelpFormatter` declares a class attribute `_theme` that shadows the `_theme` property of `argparse.HelpFormatter`, which 3.15 added to support coloured help. Much of the test suite fails for the same reason; it passes on Python 3.14.\n\n### Step 2: Provide tmuxp details\n\n`tmuxp debug-info` crashes on 3.15 with the same error, so these versions come from the checkout and `uv.lock`:\n\n\u003cdetails>\n\u003csummary>Environment\u003c/summary>\n\n- tmuxp 1.74.0 at `ddd6cce`, libtmux 0.61.0 (from `uv.lock`)\n- Python 3.15.0\n- uv 0.13.1\n- Linux x86_64\n\n\u003c/details>\n\n### Step 3: Describe the problem:\n\n#### Steps to reproduce:\n\n1. Check out the repository and install the project with all extras and dev dependencies on Python 3.15.\n\n```console\n$ uv sync --python 3.15 --all-extras --dev\n```\n\n2. Run any command.\n\n```console\n$ uv run tmuxp --version\n```\n\n3. Or run a single test.\n\n```console\n$ uv run py.test tests/cli/test_cli.py -k help_long_flag\n```\n\n#### Observed Results:\n\n```\nAttributeError: 'NoneType' object has no attribute 'reset'\n```\n\nWithout colour (no TTY, or `NO_COLOR` set), `create_themed_formatter()` binds `theme = None`, so `argparse` reads `None` for `self._theme` in `_apply_text_markup`. With colour forced (`FORCE_COLOR=1`), the bound `HelpTheme` is read instead and fails with `AttributeError: 'HelpTheme' object has no attribute 'prog_extra'`, because `argparse` expects its own theme object.\n\n\u003cdetails>\n\u003csummary>Traceback from \u003ccode>uv run tmuxp --version\u003c/code>\u003c/summary>\n\n```\nTraceback (most recent call last):\n File \"\u003crepo>/.venv/bin/tmuxp\", line 10, in \u003cmodule>\n sys.exit(cli.cli())\n ~~~~~~~^^\n File \"\u003crepo>/src/tmuxp/cli/__init__.py\", line 297, in cli\n parser = create_parser()\n File \"\u003crepo>/src/tmuxp/cli/__init__.py\", line 169, in create_parser\n parser = argparse.ArgumentParser(\n prog=\"tmuxp\",\n description=CLI_DESCRIPTION,\n formatter_class=formatter_class,\n )\n File \"\u003cstdlib>/argparse.py\", line 2058, in __init__\n self.add_argument(\n File \"\u003cstdlib>/argparse.py\", line 1695, in add_argument\n self._check_help(action)\n File \"\u003cstdlib>/argparse.py\", line 1887, in _check_help\n formatter._expand_help(action)\n File \"\u003cstdlib>/argparse.py\", line 716, in _expand_help\n return self._apply_text_markup(help_string)\n File \"\u003cstdlib>/argparse.py\", line 568, in _apply_text_markup\n if not t.reset:\n ^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'reset'\n```\n\n\u003c/details>\n\n#### Expected Results:\n\n`tmuxp --version` prints the version, and the test suite passes as it does on Python 3.14.\n\n#### Relevant Code:\n\nPython 3.15 added backtick markup to `argparse` help text ([What's New in Python 3.15](https://docs.python.org/3.15/whatsnew/3.15.html), [python/cpython#142389](https://github.com/python/cpython/issues/142389), [python/cpython#149375](https://github.com/python/cpython/issues/149375)). `argparse.HelpFormatter` now computes its colours through a read-only `_theme` property and reads it in `_apply_text_markup`. The excerpt is from [`Lib/argparse.py` at `v3.15.0`](https://github.com/python/cpython/blob/d220409a13b77de7a6c30abe16ea90db01528edc/Lib/argparse.py#L227-L232) and [lines 559-570](https://github.com/python/cpython/blob/d220409a13b77de7a6c30abe16ea90db01528edc/Lib/argparse.py#L559-L570):\n\n```python\n @property\n def _theme(self):\n if self._cached_theme is None:\n self._get_theme_and_decolor()\n return self._cached_theme\n\n def _apply_text_markup(self, text):\n ...\n t = self._theme\n if not t.reset:\n return text\n```\n\ntmuxp's formatter already used `_theme` for its own `HelpTheme`, so it now collides with the stdlib name: the class attribute at [`src/tmuxp/cli/_formatter.py` lines 85-86](https://github.com/tmux-python/tmuxp/blob/ddd6cce/src/tmuxp/cli/_formatter.py#L85-L86) replaces the property, and the instance assignment in [lines 391-396](https://github.com/tmux-python/tmuxp/blob/ddd6cce/src/tmuxp/cli/_formatter.py#L391-L396) sets the value `argparse` then reads. The parser is built at [`src/tmuxp/cli/__init__.py` lines 163-173](https://github.com/tmux-python/tmuxp/blob/ddd6cce/src/tmuxp/cli/__init__.py#L163-L173), and `ArgumentParser.__init__` adds `-h/--help`, whose help text goes through `_apply_text_markup` immediately.\n\n### Proposal\n\nStore tmuxp's theme under a name `argparse` does not use, for example `_help_theme`, in `TmuxpHelpFormatter._fill_text`, `_colorize_example_line`, and `create_themed_formatter`, and leave `_theme` to the standard library.\n\n### References\n\n- [What's New in Python 3.15](https://docs.python.org/3.15/whatsnew/3.15.html)\n- [`argparse` documentation for Python 3.15](https://docs.python.org/3.15/library/argparse.html)\n- [python/cpython#142389](https://github.com/python/cpython/issues/142389): backtick colourisation in `argparse` help text\n- [python/cpython#149375](https://github.com/python/cpython/issues/149375): backtick markup in argument help\n","author":{"url":"https://github.com/tony","@type":"Person","name":"tony"},"datePublished":"2026-10-17T16:28:49Z","url":"https://github.com/tmux-python/tmuxp/issues/1094"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ebf86469-1e2f-8d00-3e4d-1511cfbc6081 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A90C:D4E59:99CC19:C1E3B2:6B021270 |
| html-safe-nonce | 981d6e8622ccd47775420c40b08a9b74b9fb336a520ee9abbf3e4bba3af651b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTBDOkQ0RTU5Ojk5Q0MxOTpDMUUzQjI6NkIwMjEyNzAiLCJ2aXNpdG9yX2lkIjoiNTYwOTczMjMzMTI4MDY2NzI0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 51727820a5ea927ce6fe87041b57dcfe99ff1d0e348c71da9db74150a124b6c0 |
| hovercard-subject-tag | issue:5900577393 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/tmux-python/tmuxp/1094/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7352c83558c071939c7496f5b0e79236333c57e320c473a9f5b527c164494cf8/tmux-python/tmuxp/issues/1094 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7352c83558c071939c7496f5b0e79236333c57e320c473a9f5b527c164494cf8/tmux-python/tmuxp/issues/1094 |
| og:image:alt | Step 1: Provide a summary of your problem On Python 3.15.0, every tmuxp invocation, including tmuxp --version, fails with AttributeError: 'NoneType' object has no attribute 'reset' while the argume... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tony |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/tmux-python/tmuxp git https://github.com/tmux-python/tmuxp.git |
| octolytics-dimension-user_id | 37234308 |
| octolytics-dimension-user_login | tmux-python |
| octolytics-dimension-repository_id | 12398170 |
| octolytics-dimension-repository_nwo | tmux-python/tmuxp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 12398170 |
| octolytics-dimension-repository_network_root_nwo | tmux-python/tmuxp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width