Hello,
I work for Red Hat as a member of the Python maintenance team in Fedora. My main scope of work is updating the main Python interpreter. Currently, I am rebuilding 3854 Python packages which we have in Fedora with development versions of Python 3.11 to evaluate the impact and report failures to maintainers and upstreams. We do this very early, usually from alpha 1, to make sure we can use the upcoming version of Python as the main interpreter when its final version is released.
I’d like to present some statistics and the most common breakages caused by changes in CPython we have encountered so far. At the time of writing of this, the latest released version of Python 3.11 is alpha 3. So far 2857 packages (86.2%) were rebuilt successfully and the rest failed for various reasons. Usually, it’s because of a missing dependency or some change in CPython which breaks the package. Let’s look at those I encountered repeatedly.
The most breaking changes:
- removal of unittest aliases (bpo-45162) - 61 packages
- removals from configparser module (bpo-45173) - 28 packages
- removal of asyncio.coroutine decorator (bpo-43216) - 16 packages
- removals from inspect module (bpo-45320) - 14 packages
- Py_TYPE() and Py_SIZE() l-value (bpo-39573) - 7 packages
- remove open() “U” mode (bpo-37330) - 4 packages
By far the most common failures are caused by the removal of unittest aliases, from Python 3.11, What’s new:
- Removed many old deprecated unittest features:
- TestCase method aliases failUnlessEqual, failIfEqual, failUnless, failIf, failUnlessRaises, failUnlessAlmostEqual, failIfAlmostEqual (deprecated in Python 3.1), assertEquals, assertNotEquals, assert_, assertAlmostEquals, assertNotAlmostEquals, assertRegexpMatches, assertRaisesRegexp (deprecated in Python 3.2), and assertNotRegexpMatches (deprecated in Python 3.5).
- Undocumented and broken TestCase method assertDictContainsSubset (deprecated in Python 3.2).
- Undocumented <unittest.TestLoader.loadTestsFromModule>TestLoader.loadTestsFromModule() parameter use_load_tests (deprecated and ignored since Python 3.2).
- An alias of the TextTestResult class: _TextTestResult (deprecated in Python 3.2).
- (Contributed by Serhiy Storchaka in bpo-45162.)
This simple change is affecting 61 packages in Fedora. Fixing them is easy, but it’s tedious to do it for all of them.
Affected packages by this change
css-parser
genshi
gpxpy
logutils
pysrt
libreport
nose2
alarmdecoder
uritemplate
httmock
pycurl
pyicu
pyrad
py-radix
geomet
chai
pycdio
scales
idstools
mygpoclient
pyzor
signedjson
python-etcd
libdnf
pycryptodomex
pyelftools
simplevisor
docker-squash
dirq
testresources
messaging
libsbml
ply
listparser
future
pathspec
netcdf4-python
oauthlib
icalendar
yapf
testtools
ephem
stomper
pycollada
gitdb
elements
flaky
nose
xmlrunner
bsddb3
mock
tornado
satyr
parsel
libmodulemd
javabridge
zim
liblarch
argcomplete
jmespath
fail2ban
Then there is a change regarding configargparse module, it affects 28 packages.
- Removed from the configparser module: the SafeConfigParser class, the filename property of the ParsingError class, the readfp() method of the ConfigParser class, deprecated since Python 3.2.
- (Contributed by Hugo van Kemenade in bpo-45173.)
Affected packages by this change
bokeh
constantly
ecdsa
plotly
click-spinner
quantities
transforms3d
conda-package-handling
offlineimap
stdlib-list
mom
spake2
grabbit
python-jsonrpc-server
libusb1
pytest-mpi
bids-validator
clyent
cvxopt
scripttester
iniparse
subversion
pastedeploy
setroubleshoot
classification-banner
annexremote
onionbalance
sphinx-math-dollar
A third most common problem is regarding the removal of @asyncio.coroutine decorator.
- The @asyncio.coroutine decorator enabling legacy generator-based coroutines to be compatible with async/await code. The function has been deprecated since Python 3.8 and the removal was initially scheduled for Python 3.10. Use async def instead.
- (Contributed by Illia Volochii in bpo-43216.)
Affected packages by this change
pexpect
pycec
rx
aiounittest
pyblackbird
osrf-pycommon
pyduofern
promise
txaio
brother
aiosasl
aioopenssl
aiohttp-cors
pyinsteon
ratelimiter
cached-property
Functions removed from the inspection module are affecting 14 packages.
- Removed from the inspect module:
- the getargspec function, deprecated since Python 3.0; use inspect.signature() or inspect.getfullargspec() instead.
- the formatargspec function, deprecated since Python 3.5; use the inspect.signature() function and Signature object directly.
- the undocumented Signature.from_callable and Signature.from_function functions, deprecated since Python 3.5; use the Signature.from_callable() method instead.
- (Contributed by Hugo van Kemenade in bpo-45320.)
Affected packages by this change
bottle
grammalecte
pluginlib
pycha
easyargs
pycdlib
nyx
reportlab
pocketlint
asttokens
verboselogs
powerline
jwcrypto
wrapt
Changing Py_TYPE() and Py_SIZE() into inline static functions was initially supposed to land in Python 3.10. It got reverted and postponed into Python 3.11. We are down to 7 bugs like this since the last year’s 24 of them.
- Since Py_TYPE() is changed to a inline static function, Py_TYPE(obj) = new_type must be replaced with Py_SET_TYPE(obj, new_type): see the Py_SET_TYPE() function (available since Python 3.9).
- Since Py_SIZE() is changed to a inline static function, Py_SIZE(obj) = new_size must be replaced with Py_SET_SIZE(obj, new_size): see the Py_SET_SIZE() function (available since Python 3.9).
- (Contributed by Victor Stinner in bpo-39573.)
Affected packages by this change
pypam
zstd
rdiff-backup
mercurial
pylibacl
python-snappy
zbar
4 packages are affected by the removal of open() “U” mode.
- open(), io.open(), codecs.open() and fileinput.FileInput no longer accept ‘U’ (“universal newline”) in the file mode. This flag was deprecated since Python 3.3. In Python 3, the “universal newline” is used by default when a file is open in text mode. The newline parameter of open() controls how universal newlines works.
- (Contributed by Victor Stinner in bpo-37330.)
Affected packages by this change
altgraph
sqlobject
pylibmc
apbs