-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Deprecation warning for non-integer number in gettext is not always accurate #110519
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
Comments
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Oct 8, 2023
Deprecation warning about non-integer number in gettext now alwais refers to the line in the user code where gettext function or method is used. Previously it could refer to a line in gettext code. Also, increase test coverage for NullTranslations and domain-aware functions like dngettext().
This was referenced Oct 9, 2023
ambv
pushed a commit
that referenced
this issue
Oct 9, 2023
Deprecation warning about non-integer numbers in gettext now always refers to the line in the user code where gettext function or method is used. Previously, it could refer to a line in gettext code. Also, increase test coverage for NullTranslations and domain-aware functions like dngettext().
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Oct 9, 2023
…ythonGH-110520) Deprecation warning about non-integer numbers in gettext now always refers to the line in the user code where gettext function or method is used. Previously, it could refer to a line in gettext code. Also, increase test coverage for NullTranslations and domain-aware functions like dngettext(). (cherry picked from commit 326c6c4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Oct 9, 2023
…ythonGH-110520) Deprecation warning about non-integer numbers in gettext now always refers to the line in the user code where gettext function or method is used. Previously, it could refer to a line in gettext code. Also, increase test coverage for NullTranslations and domain-aware functions like dngettext(). (cherry picked from commit 326c6c4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ambv
pushed a commit
that referenced
this issue
Oct 9, 2023
…H-110520) (GH-110564) Deprecation warning about non-integer numbers in gettext now always refers to the line in the user code where gettext function or method is used. Previously, it could refer to a line in gettext code. Also, increase test coverage for NullTranslations and domain-aware functions like dngettext(). (cherry picked from commit 326c6c4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ambv
pushed a commit
that referenced
this issue
Oct 9, 2023
…H-110520) (GH-110563) Deprecation warning about non-integer numbers in gettext now always refers to the line in the user code where gettext function or method is used. Previously, it could refer to a line in gettext code. Also, increase test coverage for NullTranslations and domain-aware functions like dngettext(). (cherry picked from commit 326c6c4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this issue
Sep 2, 2024
…ython#110520) Deprecation warning about non-integer numbers in gettext now always refers to the line in the user code where gettext function or method is used. Previously, it could refer to a line in gettext code. Also, increase test coverage for NullTranslations and domain-aware functions like dngettext().
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
gettext
functions and methods that consider plural forms (likengettext()
) and directly or indirectly useGNUTranslations
emit a deprecation warning if the number is not integer. But it only points to the line whereGNUTranslations
methodsngettext()
ornpgettext()
are used directly. Since module level functions use it indirectly, and methods of other classes can use it indirectly as a fallback, the deprecation warning usually points to the line in thegettext
module instead of the line in the user code that uses it. It makes deprecation warnings much less useful.The following PR dynamically calculate the stacklevel for warning, skipping any
gettext
code.Also I have found that many code is not covered by tests (in particular
NullTranslations
and domain-aware functions likedngettext()
). The PR extends tests.Linked PRs
The text was updated successfully, but these errors were encountered: