Pylons / pyramid

Pyramid - A Python web framework
https://trypyramid.com/
Other
3.97k stars 887 forks source link

gettext related deprecation warnings #3678

Closed tirkarthi closed 1 year ago

tirkarthi commented 3 years ago

Bug Report

Describe the bug

Several gettext related functions that are from Python 2 were deprecated in Python 3.8 and were set for removal in Python 3.10 . But these were not removed in Python 3.10 but it will be good to fix them. Straightforward replacement is not possible since the pyramid APIs return bytes and the replacements return string.

To Reproduce

PYTHONWARNINGS=always tox -e py39 tests/test_i18n.py
GLOB sdist-make: /home/karthikeyan/stuff/python/pyramid/setup.py
py39 inst-nodeps: /home/karthikeyan/stuff/python/pyramid/.tox/.tmp/package/1/pyramid-2.1.dev0.zip
py39 installed: attrs==21.2.0,beautifulsoup4==4.9.3,coverage==5.5,hupper==1.10.3,iniconfig==1.1.1,packaging==21.0,PasteDeploy==2.1.1,plaster==1.0,plaster-pastedeploy==0.7,pluggy==0.13.1,py==1.10.0,pyparsing==2.4.7,pyramid @ file:///home/karthikeyan/stuff/python/pyramid/.tox/.tmp/package/1/pyramid-2.1.dev0.zip,pytest==6.2.4,pytest-cov==2.12.1,soupsieve==2.2.1,toml==0.10.2,translationstring==1.4,venusian==3.0.0,waitress==2.0.0,WebOb==1.8.7,WebTest==3.0.0,zope.component==5.0.1,zope.deprecation==4.4.0,zope.event==4.5.0,zope.hookable==5.1.0,zope.interface==5.4.0
py39 run-test-pre: PYTHONHASHSEED='2877923452'
py39 run-test: commands[0] | python --version
Python 3.9.5
py39 run-test: commands[1] | pytest tests/test_i18n.py
============================== test session starts ===============================
platform linux -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
cachedir: .tox/py39/.pytest_cache
rootdir: /home/karthikeyan/stuff/python/pyramid, configfile: setup.cfg
plugins: cov-2.12.1
collected 46 items                                                               

tests/test_i18n.py ..............................................          [100%]

================================ warnings summary ================================
tests/test_i18n.py::TestTranslations::test_ldgettext
tests/test_i18n.py::TestTranslations::test_ldgettext
  /home/karthikeyan/stuff/python/pyramid/.tox/py39/lib/python3.9/site-packages/pyramid/i18n.py:342: DeprecationWarning: lgettext() is deprecated, use gettext() instead
    return self._domains.get(domain, self).lgettext(message)

tests/test_i18n.py::TestTranslations::test_ldngettext
tests/test_i18n.py::TestTranslations::test_ldngettext
  /home/karthikeyan/stuff/python/pyramid/.tox/py39/lib/python3.9/site-packages/pyramid/i18n.py:360: DeprecationWarning: lngettext() is deprecated, use ngettext() instead
    return self._domains.get(domain, self).lngettext(singular, plural, num)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================= 46 passed, 4 warnings in 0.27s =========================
____________________________________ summary _____________________________________
  py39: commands succeeded
  congratulations :)

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain the issue.

Additional context

https://github.com/python/cpython/pull/10139

stevepiercy commented 3 years ago

@tirkarthi thank you for the report. I agree. Would you please submit a PR for review?

mmerickel commented 3 years ago

I haven't verified but it feels like this will require changes to translationstring as well.

stevepiercy commented 3 years ago

A quick search indicates that translationstring uses only gettext.

musicinmybrain commented 1 year ago

It looks like these were actually removed in Python 3.11. Fedora Linux has a downstream bug about this.

onjen commented 1 year ago

Debian downstream bug