zopefoundation / zope.app.i18n

Persistent translation domains and message catalogs
Other
0 stars 5 forks source link

ImportError: cannot import name 'encodestring' from 'base64' on Python 3.9.0a3 #10

Closed mgedmin closed 4 years ago

mgedmin commented 4 years ago

Python 3.9 removes a bunch of deprecated functions, and base64.encodestring happens to be one of them.

zope.app.i18n.browser.synchronize tries to from base64 import encodestring, which now fails.

mgedmin commented 4 years ago

This will affect a bunch of other zopefoundation projects as well, unless Python 3.9 walks back the deprecations.

$ rg -l base64.*codestring|sort
AccessControl/src/AccessControl/userfolder.py
keas.build/src/keas/build/base.py
keas.build/src/keas/build/build.py
keas.build/src/keas/build/install.py
keas.build/src/keas/build/package.py
Products.CMFCore/Products/CMFCore/CookieCrumbler.py
Products.CMFCore/Products/CMFCore/utils.py
Products.MIMETools/src/Products/MIMETools/tests.py
Products.PluggableAuthService/Products/PluggableAuthService/plugins/CookieAuthHelper.py
Products.PluggableAuthService/Products/PluggableAuthService/plugins/tests/test_CookieAuthHelper.py
z3c.authenticator/src/z3c/authenticator/_compat.py
z3c.json/src/z3c/json/transport.py
z3c.soap/z3c/soap/README.txt
ZODB/src/ZODB/_compat.py
zope2docs/docs/zdgbook/Security.rst
zope.app.i18n/src/zope/app/i18n/browser/synchronize.py
zope.app.testing/src/zope/app/testing/functional.py
Zope/docs/zdgbook/Security.rst
zope.session/src/zope/session/session.py
zope.testbrowser/src/zope/testbrowser/_compat.py
zope.xmlpickle/src/zope/xmlpickle/ppml.py
ZServer/src/webdav/client.py
ZServer/src/webdav/tests/testPUT_factory.py
ZServer/src/ZServer/FCGIServer.py
ZServer/src/ZServer/FTPRequest.py
ZServer/src/ZServer/medusa/http_server.py
ZServer/src/ZServer/Testing/doctest_functional.py
ZServer/src/ZServer/Testing/functional.py
jamadden commented 4 years ago

Reverting is being discussed on python-dev.

  • Removed tostring/fromstring methods in array.array and base64 modules

It's not clear to me if that's supposed to include encodestring though (I'm not fully current on the discussion though).

icemac commented 4 years ago

I'll try to look into this issue this week on Alpine City Sprint.

icemac commented 4 years ago

I did not manage to look into the issue.

tirkarthi commented 4 years ago

I have created a PR #11 for this. The import is not used anywhere so I removed it.

tirkarthi commented 4 years ago

To add more towards reversion the function was removed in python 3.9 which is in rc1 as of now. So the reversion to bring back encodestring was not done.

icemac commented 4 years ago

encodestring is still missing on 3.9, see https://github.com/python/cpython/blob/3.9/Lib/base64.py. So we'll have to fix the packages in the list provided by @mgedmin. (Leaving this issue closed as it is fixed for this particular package.)