GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Deprecation warning for non-integer number in gettext is not always accurate · Issue #110519 · python/cpython

Deprecation warning for non-integer number in gettext is not always accurate #110519

New issue
Copy link
New issue
Copy link
Closed
Closed
Deprecation warning for non-integer number in gettext is not always accurate#110519
Copy link
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@serhiy-storchaka
serhiy-storchaka
opened on Oct 8, 2023
Issue body actions

Bug report

gettext functions and methods that consider plural forms (like ngettext()) and directly or indirectly use GNUTranslations emit a deprecation warning if the number is not integer. But it only points to the line where GNUTranslations methods ngettext() or npgettext() 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 the gettext 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 like dngettext()). The PR extends tests.

Linked PRs

  • gh-110519: Improve deprecation warning in the gettext module #110520
  • [3.12] gh-110519: Improve deprecation warning in the gettext module (GH-110520) #110563
  • [3.11] gh-110519: Improve deprecation warning in the gettext module (GH-110520) #110564

Activity

  1. serhiy-storchaka
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.11only security fixesonly security fixes
    3.12only security fixesonly security fixes
    3.13only security fixesonly security fixes
    on Oct 8, 2023
  2. serhiy-storchaka
    added this to Gettext issueson Oct 8, 2023
  3. serhiy-storchaka
    added a commit that references this issue on Oct 8, 2023

    pythongh-110519: Improve deprecation warning in the gettext module

    049bbae
  4. ambv
    added a commit that references this issue on Oct 9, 2023

    gh-110519: Improve deprecation warning in the gettext module (#110520)

    326c6c4
  5. miss-islington
    added 2 commits that reference this issue on Oct 9, 2023

    pythongh-110519: Improve deprecation warning in the gettext module (p…

    5f787d2

    pythongh-110519: Improve deprecation warning in the gettext module (p…

    a2c7160
  6. ambv
    added 2 commits that reference this issue on Oct 9, 2023

    [3.11] gh-110519: Improve deprecation warning in the gettext module (G…

    e913c6f

    [3.12] gh-110519: Improve deprecation warning in the gettext module (G…

    1f43bc2
  7. serhiy-storchaka
    closed this as completedon Oct 9, 2023
  8. github-project-automation
    moved this to Done in Gettext issueson Oct 9, 2023
  9. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-110519: Improve deprecation warning in the gettext module (p…

    809f829
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Gettext issues
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.