Hi,
We are working on upgrading Python from 3.9 to 3.10 in Fedora and we
are facing many Python 3.10 incompatible changes. Most changes were
planned with a deprecation period, but, as usual, projects are not
tested with DeprecationWarning treated as errors, and so tons of
packages now fail to build.
I'm not here to talk about DeprecationWarning, but how we communicate
on incompatible changes made on purpose. For example, What's New in
Python 3.8 announces: "In asyncio, the explicit passing of a loop
argument has been deprecated and will be removed in version 3.10". As
expected, the parameter was removed in Python 3.10 (bpo-42392), but I
cannot see anything in What's New in Python 3.10. The problem is that
I don't know how to fix projects broken by this change. I'm not
complaining about this specific change, but more generally.
I strongly suggest to well document incompatible changes. The bare
minimum is to mention them in "Porting to Python 3.10" section:
https://docs.python.org/dev/whatsnew/3.10.html#porting-to-python-3-10
A link to the bpo sometimes helps to understand how to port code. But
I would really appreciate if authors of incompatible changes would
explain how to add Python 3.10 support to existing projects, without
losing support for older Python versions. Not just "this function is
now removed, good luck!" :-)
I didn't touch asyncio for at least 1 year, so I don't know what
happens if I remove a loop argument. Does an application remain
compatible with Python 3.6 without passing loop?
I know that I made multiple incompatible changes myself and I'm sure
that the documentation should probably be enhanced, but I also expect
others to help on that! ;-)
Please think about people who have to port 4000 Python projects to Python 3.10!
---
The best would be to ship a tool which adds Python 3.10 support to
existing projects without losing support with Python 3.6. Maybe
something like https://github.com/asottile/pyupgrade could be used for
that? pyupgrade looks more specific to the Python syntax, than the
usage of the stdlib.
I wrote such tool to add Python 3.10 support to C extensions without
losing support with Python 2.7. It relies on a header file
(pythoncapi_compat.h) which provides new C API functions on old Python
versions.
https://github.com/pythoncapi/pythoncapi_compat
For example, it replaces "obj->ob_refcnt = refcnt;" with
"Py_SET_REFCNT(obj, refcnt);" and provides Py_SET_REFCNT() to Python
3.8 and older (function added to Python 3.9)
Victor
--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/O3T7SK3BGMFWMLCQXDODZJSBL42AUWTR/
Code of Conduct: http://python.org/psf/codeofconduct/
We are working on upgrading Python from 3.9 to 3.10 in Fedora and we
are facing many Python 3.10 incompatible changes. Most changes were
planned with a deprecation period, but, as usual, projects are not
tested with DeprecationWarning treated as errors, and so tons of
packages now fail to build.
I'm not here to talk about DeprecationWarning, but how we communicate
on incompatible changes made on purpose. For example, What's New in
Python 3.8 announces: "In asyncio, the explicit passing of a loop
argument has been deprecated and will be removed in version 3.10". As
expected, the parameter was removed in Python 3.10 (bpo-42392), but I
cannot see anything in What's New in Python 3.10. The problem is that
I don't know how to fix projects broken by this change. I'm not
complaining about this specific change, but more generally.
I strongly suggest to well document incompatible changes. The bare
minimum is to mention them in "Porting to Python 3.10" section:
https://docs.python.org/dev/whatsnew/3.10.html#porting-to-python-3-10
A link to the bpo sometimes helps to understand how to port code. But
I would really appreciate if authors of incompatible changes would
explain how to add Python 3.10 support to existing projects, without
losing support for older Python versions. Not just "this function is
now removed, good luck!" :-)
I didn't touch asyncio for at least 1 year, so I don't know what
happens if I remove a loop argument. Does an application remain
compatible with Python 3.6 without passing loop?
I know that I made multiple incompatible changes myself and I'm sure
that the documentation should probably be enhanced, but I also expect
others to help on that! ;-)
Please think about people who have to port 4000 Python projects to Python 3.10!
---
The best would be to ship a tool which adds Python 3.10 support to
existing projects without losing support with Python 3.6. Maybe
something like https://github.com/asottile/pyupgrade could be used for
that? pyupgrade looks more specific to the Python syntax, than the
usage of the stdlib.
I wrote such tool to add Python 3.10 support to C extensions without
losing support with Python 2.7. It relies on a header file
(pythoncapi_compat.h) which provides new C API functions on old Python
versions.
https://github.com/pythoncapi/pythoncapi_compat
For example, it replaces "obj->ob_refcnt = refcnt;" with
"Py_SET_REFCNT(obj, refcnt);" and provides Py_SET_REFCNT() to Python
3.8 and older (function added to Python 3.9)
Victor
--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/O3T7SK3BGMFWMLCQXDODZJSBL42AUWTR/
Code of Conduct: http://python.org/psf/codeofconduct/