Bug 1906349 - python-aiofiles fails to build with Python 3.10: TypeError: BaseEventLoop.create_server() got an unexpected keyword argument 'loop'
Summary: python-aiofiles fails to build with Python 3.10: TypeError: BaseEventLoop.cre...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-aiofiles
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Igor Raits
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-12-10 10:33 UTC by Tomáš Hrnčiar
Modified: 2021-02-09 16:23 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2020-12-10 10:33:52 UTC
python-aiofiles fails to build with Python 3.10.0a3.

=================================== FAILURES ===================================
________________________ test_serve_small_bin_file_sync ________________________

event_loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
tmpdir = local('/tmp/pytest-of-mockbuild/pytest-0/test_serve_small_bin_file_sync0')
unused_tcp_port = 56965

    @pytest.mark.asyncio
    async def test_serve_small_bin_file_sync(event_loop, tmpdir, unused_tcp_port):
        """Fire up a small simple file server, and fetch a file.
    
        The file is read into memory synchronously, so this test doesn't actually
        test anything except the general test concept.
        """
        # First we'll write a small file.
        filename = "test.bin"
        file_content = b"0123456789"
        file = tmpdir.join(filename)
        file.write_binary(file_content)
    
        async def serve_file(reader, writer):
            full_filename = str(file)
            with open(full_filename, "rb") as f:
                writer.write(f.read())
            writer.close()
    
>       server = await asyncio.start_server(
            serve_file, port=unused_tcp_port, loop=event_loop
        )

tests/test_simple.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

client_connected_cb = <function test_serve_small_bin_file_sync.<locals>.serve_file at 0x7f2790f5b280>
host = None, port = 56965, limit = 65536
kwds = {'loop': <_UnixSelectorEventLoop running=False closed=False debug=False>}
factory = <function start_server.<locals>.factory at 0x7f2790f5b310>

    async def start_server(client_connected_cb, host=None, port=None, *,
                           limit=_DEFAULT_LIMIT, **kwds):
        """Start a socket server, call back for each client connected.
    
        The first parameter, `client_connected_cb`, takes two parameters:
        client_reader, client_writer.  client_reader is a StreamReader
        object, while client_writer is a StreamWriter object.  This
        parameter can either be a plain callback function or a coroutine;
        if it is a coroutine, it will be automatically converted into a
        Task.
    
        The rest of the arguments are all the usual arguments to
        loop.create_server() except protocol_factory; most common are
        positional host and port, with various optional keyword arguments
        following.  The return value is the same as loop.create_server().
    
        Additional optional keyword arguments are loop (to set the event loop
        instance to use) and limit (to set the buffer limit passed to the
        StreamReader).
    
        The return value is the same as loop.create_server(), i.e. a
        Server object which can be used to stop the service.
        """
        loop = events.get_running_loop()
    
        def factory():
            reader = StreamReader(limit=limit, loop=loop)
            protocol = StreamReaderProtocol(reader, client_connected_cb,
                                            loop=loop)
            return protocol
    
>       return await loop.create_server(factory, host, port, **kwds)
E       TypeError: BaseEventLoop.create_server() got an unexpected keyword argument 'loop'

/usr/lib64/python3.10/asyncio/streams.py:84: TypeError
__________________________ test_serve_small_bin_file ___________________________

event_loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
tmpdir = local('/tmp/pytest-of-mockbuild/pytest-0/test_serve_small_bin_file0')
unused_tcp_port = 38719

    @pytest.mark.asyncio
    async def test_serve_small_bin_file(event_loop, tmpdir, unused_tcp_port):
        """Fire up a small simple file server, and fetch a file."""
        # First we'll write a small file.
        filename = "test.bin"
        file_content = b"0123456789"
        file = tmpdir.join(filename)
        file.write_binary(file_content)
    
        async def serve_file(reader, writer):
            full_filename = str(file)
            f = await threadpool.open(full_filename, mode="rb")
            writer.write((await f.read()))
            await f.close()
            writer.close()
    
>       server = await asyncio.start_server(
            serve_file, port=unused_tcp_port, loop=event_loop
        )

tests/test_simple.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

client_connected_cb = <function test_serve_small_bin_file.<locals>.serve_file at 0x7f2790f5b9d0>
host = None, port = 38719, limit = 65536
kwds = {'loop': <_UnixSelectorEventLoop running=False closed=False debug=False>}
factory = <function start_server.<locals>.factory at 0x7f2790f5ba60>

    async def start_server(client_connected_cb, host=None, port=None, *,
                           limit=_DEFAULT_LIMIT, **kwds):
        """Start a socket server, call back for each client connected.
    
        The first parameter, `client_connected_cb`, takes two parameters:
        client_reader, client_writer.  client_reader is a StreamReader
        object, while client_writer is a StreamWriter object.  This
        parameter can either be a plain callback function or a coroutine;
        if it is a coroutine, it will be automatically converted into a
        Task.
    
        The rest of the arguments are all the usual arguments to
        loop.create_server() except protocol_factory; most common are
        positional host and port, with various optional keyword arguments
        following.  The return value is the same as loop.create_server().
    
        Additional optional keyword arguments are loop (to set the event loop
        instance to use) and limit (to set the buffer limit passed to the
        StreamReader).
    
        The return value is the same as loop.create_server(), i.e. a
        Server object which can be used to stop the service.
        """
        loop = events.get_running_loop()
    
        def factory():
            reader = StreamReader(limit=limit, loop=loop)
            protocol = StreamReaderProtocol(reader, client_connected_cb,
                                            loop=loop)
            return protocol
    
>       return await loop.create_server(factory, host, port, **kwds)
E       TypeError: BaseEventLoop.create_server() got an unexpected keyword argument 'loop'

/usr/lib64/python3.10/asyncio/streams.py:84: TypeError
=============================== warnings summary ===============================
/builddir/build/BUILDROOT/python-aiofiles-0.5.0-2.fc34.x86_64/usr/lib/python3.10/site-packages/aiofiles/os.py:10
/builddir/build/BUILDROOT/python-aiofiles-0.5.0-2.fc34.x86_64/usr/lib/python3.10/site-packages/aiofiles/os.py:10
/builddir/build/BUILDROOT/python-aiofiles-0.5.0-2.fc34.x86_64/usr/lib/python3.10/site-packages/aiofiles/os.py:10
/builddir/build/BUILDROOT/python-aiofiles-0.5.0-2.fc34.x86_64/usr/lib/python3.10/site-packages/aiofiles/os.py:10
/builddir/build/BUILDROOT/python-aiofiles-0.5.0-2.fc34.x86_64/usr/lib/python3.10/site-packages/aiofiles/os.py:10
/builddir/build/BUILDROOT/python-aiofiles-0.5.0-2.fc34.x86_64/usr/lib/python3.10/site-packages/aiofiles/os.py:10
  /builddir/build/BUILDROOT/python-aiofiles-0.5.0-2.fc34.x86_64/usr/lib/python3.10/site-packages/aiofiles/os.py:10: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def run(*args, loop=None, executor=None, **kwargs):

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/test_simple.py::test_serve_small_bin_file_sync - TypeError: Base...
FAILED tests/test_simple.py::test_serve_small_bin_file - TypeError: BaseEvent...
================== 2 failed, 135 passed, 6 warnings in 1.75s ===================

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01819231-python-aiofiles/

For all our attempts to build python-aiofiles with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-aiofiles/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Ben Cotton 2021-02-09 15:33:09 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.


Note You need to log in before you can comment on or make changes to this bug.