bpo-37330: open() no longer accept 'U' in file mode by vstinner · Pull Request #14204 · python/cpython
Sphinx issue comes from docutils:
Exception occurred:
File "/home/vstinner/prog/python/master/Doc/venv/lib/python3.9/site-packages/docutils/io.py", line 245, in __init__
self.source = open(source_path, mode, **kwargs)
ValueError: invalid mode: 'rU'
Extract of the code, it seems to contain a copy of fileinput.FileInput:
class FileInput(Input):
def __init__(self, source=None, source_path=None,
encoding=None, error_handler='strict',
autoclose=True, mode='rU', **kwargs):
...
if source is None:
if source_path:
...
try:
self.source = open(source_path, mode, **kwargs)
except IOError as error:
raise InputError(error.errno, error.strerror, source_path)