Skip to content

Fix compatibility with Python 3.13 and up#2271

Merged
PH111P merged 7 commits into
powerline:developfrom
sicherha:fix_python_compatibility
Mar 11, 2026
Merged

Fix compatibility with Python 3.13 and up#2271
PH111P merged 7 commits into
powerline:developfrom
sicherha:fix_python_compatibility

Conversation

@sicherha

@sicherha sicherha commented Jan 10, 2025

Copy link
Copy Markdown
Contributor
  • Fix a TypeError in the Vim statusline that occurs with Python 3.13.
  • Fix a ValueError in powerline-daemon that will occur with Python 3.14 - nesting argument groups has been removed (https://bugzilla.redhat.com/show_bug.cgi?id=2336943).
  • While at it, fix a bunch of typos.
  • Fix the CI pipeline.

…us line

This occurs when opening a file inside a Git repository; the `path`
parameter is of type `bytes` instead of the expected `str`. The above
error message gets printed at the position where the file name and size
would normally be displayed.

The error was observed on Fedora 41 with Python 3.13. The exact root
cause is unclear - but explicitly converting `path` to `str` prevents
the `TypeError`.
Nesting argument groups was deprecated in Python 3.11 and will be
removed in the upcoming Python 3.14:
python/cpython#127133

Trying to add a nested group will trigger a `ValueError`.

To prepare the code for Python 3.14, remove the nested groups and add
all arguments at the top level. The mutual exclusion between `--kill`
and `--foreground`/`--replace` is already checked separately within the
`main()` function in `scripts/powerline-daemon`, so the user-observable
behaviour remains unchanged.
Python 3.7 seems to be no longer available.
> Error: Version 3.7 with arch x64 not found
@badshah400

Copy link
Copy Markdown

Hi, on openSUSE Tumbleweed, which just moved to python 3.13 as the default, we applied your patch to make the vim plugin work again. Many thanks. In addition, we also needed the following patch to fix a test file issue to get powerline building again with its test suite enabled.

Index: powerline-2.8.4/tests/test_python/test_cmdline.py
===================================================================
--- powerline-2.8.4.orig/tests/test_python/test_cmdline.py
+++ powerline-2.8.4/tests/test_python/test_cmdline.py
@@ -52,7 +52,7 @@ class TestParser(TestCase):
 			]:
 				self.assertRaises(SystemExit, parser.parse_args, raising_args)
 				self.assertFalse(out.getvalue())
-				self.assertRegexpMatches(err.getvalue(), raising_reg)
+				self.assertRegex(err.getvalue(), raising_reg)
 				flush()
 
 	def test_main_normal(self):

`assertRegexpMatches()` was renamed to `assertRegex()` in Python 3.2.
@sicherha

Copy link
Copy Markdown
Contributor Author

Thanks! I have added a commit to this PR that applies your diff.

And I'll see to it that Fedora's powerline.spec file, too, gets a %check section.

The undocumented function `glob.glob1()` was deprecated in Python 3.13
and removed in Python 3.15.

Replace it with a call to `glob.glob()` with the `root_dir` argument
set. Note that this requires at least Python 3.10, which was released in
October 2021. This is deemed acceptable as Python 3.9 was declared
end-of-life in October 2025.

Remove two unused imports of `glob1`.
@sicherha

Copy link
Copy Markdown
Contributor Author

I have added a commit that fixes compatibility with Python 3.15. The fix requires at least Python 3.10, which I consider acceptable because Python 3.9 has been EOL since October 2025.

Comment thread .github/workflows/main.yaml Outdated
@sicherha sicherha force-pushed the fix_python_compatibility branch from 8e5940b to 6f8da88 Compare January 2, 2026 17:12
@sabedevops

Copy link
Copy Markdown

The patch on powerline/commands/daemon.py got it running for me on Fedora 43, thank you!

@PH111P PH111P merged commit 11808cb into powerline:develop Mar 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants