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

pygettext: false positives when extracting messages #126807

Closed
tomasr8 opened this issue Nov 13, 2024 · 0 comments
Closed

pygettext: false positives when extracting messages #126807

tomasr8 opened this issue Nov 13, 2024 · 0 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@tomasr8
Copy link
Member

tomasr8 commented Nov 13, 2024

Bug report

Bug description:

Originally came up here: #126755 (comment)

To summarize, pygettext produces a warning for this code:

def _(x):
    pass

The reason is that it confuses the function definition with a function call. I have a PR ready.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

@tomasr8 tomasr8 added the type-bug An unexpected behavior, bug, or error label Nov 13, 2024
@tomasr8 tomasr8 self-assigned this Nov 13, 2024
@picnixz picnixz added the stdlib Python modules in the Lib dir label Nov 14, 2024
serhiy-storchaka pushed a commit that referenced this issue Nov 14, 2024
…n definitions. (GH-126808)

Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 14, 2024
…unction definitions. (pythonGH-126808)

Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
(cherry picked from commit 9a45638)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 14, 2024
…unction definitions. (pythonGH-126808)

Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
(cherry picked from commit 9a45638)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
serhiy-storchaka pushed a commit that referenced this issue Nov 14, 2024
…function definitions. (GH-126808) (GH-126847)

Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
(cherry picked from commit 9a45638)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
serhiy-storchaka pushed a commit that referenced this issue Nov 14, 2024
…function definitions. (GH-126808) (GH-126846)

Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
(cherry picked from commit 9a45638)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
@tomasr8 tomasr8 closed this as completed Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

2 participants