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

Inference of JoinedStr is inconsistent #2621

Open
ericvergnaud opened this issue Oct 22, 2024 · 1 comment · May be fixed by #2622
Open

Inference of JoinedStr is inconsistent #2621

ericvergnaud opened this issue Oct 22, 2024 · 1 comment · May be fixed by #2622

Comments

@ericvergnaud
Copy link
Contributor

Inference of JoinedStr is inconsistent. For example:

f"{unknown}" raises an InferenceError if unknown is not declared
f"{unknown}" returns Uninferable (the instance) if unknown is declared
f"a/{unknown}/b" raises an InferenceError if unknown is not declared
f"a/{unknown}/b" returns "a/Uninferable/b" if unknown is declared

This pushes to the user a lot of unwanted responsibility

Additionally, there are usage scenarios where the user would rather have a composite string (such as the latter case above) than the Uninferable instance.

@ericvergnaud ericvergnaud linked a pull request Oct 22, 2024 that will close this issue
@jacobtylerwalls
Copy link
Member

Thanks for catching that we're not catching exceptions thrown by _infer() inside infer_from_values().

But re: the inconsistencies between raising and returning a partial string seem like something we should resolve in favor of not using partial strings, based on the decision we took in #2459.

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 a pull request may close this issue.

2 participants