Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11 breaks f-String cast #9

Closed
fellnerse opened this issue Nov 27, 2023 · 3 comments · Fixed by #10
Closed

Python 3.11 breaks f-String cast #9

fellnerse opened this issue Nov 27, 2023 · 3 comments · Fixed by #10
Assignees
Labels
bug Something isn't working

Comments

@fellnerse
Copy link

When running the auto setup with python 3.11 I get this in the shell:

❯ ai-tdd setup
Tab autocomplete configuration already setup in ~/.config/fish/completions/ai-tdd.ShellType.FISH.
The ~/.ShellType.ZSHrc configuration file does not exist.
The ~/.ShellType.BASHrc configuration file does not exist.

with python 3.10:

❯ ai-tdd setup
Adding tab autocomplete configuration in ~/.config/fish/completions/ai-tdd.fish ...
Restart or create a new shell session for the changes to take effect.
The ~/.bashrc configuration file does not exist.
The ~/.zshrc configuration file does not exist.

I guess the problem is that in 3.11 the automated f string cast changed
and all these lines in the core.py are affected:

f"~/.config/fish/completions/{program_name}.{shell}"

Can I help here?

@KAUTH
Copy link
Owner

KAUTH commented Dec 17, 2023

Hey @fellnerse thanks for reporting this! Yes, I can assign it to you if you want. 😃

@KAUTH
Copy link
Owner

KAUTH commented Dec 17, 2023

From What’s New In Python 3.11

Changed Enum.format() (the default for format(), str.format() and f-strings) to always produce the same result as Enum.str(): for enums inheriting from ReprEnum it will be the member’s value; for all other enums it will be the enum and member name (e.g. Color.RED).

@KAUTH KAUTH added the bug Something isn't working label Dec 17, 2023
@KAUTH
Copy link
Owner

KAUTH commented Dec 17, 2023

We can rebase the fix on top of #10 to verify that it works as expected.

@KAUTH KAUTH assigned KAUTH and unassigned fellnerse Jan 15, 2024
KAUTH added a commit that referenced this issue Jan 15, 2024
From What’s New In Python 3.11:

> Changed Enum.format() (the default for format(), str.format() and f-strings)
to always produce the same result as Enum.str(): for enums inheriting from ReprEnum
it will be the member’s value; __for all other enums it will be the enum and member
name (e.g. Color.RED).__

For this reason we specifically use the enum's value where necessary.

Fixes #9
@KAUTH KAUTH closed this as completed in #10 Jan 15, 2024
KAUTH added a commit that referenced this issue Jan 15, 2024
From What’s New In Python 3.11:

> Changed Enum.format() (the default for format(), str.format() and f-strings)
to always produce the same result as Enum.str(): for enums inheriting from ReprEnum
it will be the member’s value; __for all other enums it will be the enum and member
name (e.g. Color.RED).__

For this reason we specifically use the enum's value where necessary.

Fixes #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants