Bug 2193082 - python-aiofiles fails to build with Python 3.12: AttributeError: '_io.TextIOWrapper' object has no attribute 'delete'
Summary: python-aiofiles fails to build with Python 3.12: AttributeError: '_io.TextIOW...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-aiofiles
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ankur Sinha (FranciscoD)
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.12
TreeView+ depends on / blocked
 
Reported: 2023-05-04 09:20 UTC by Tomáš Hrnčiar
Modified: 2023-07-03 09:24 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-07-03 09:24:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github Tinche aiofiles issues 166 0 None open Python 3.12 test failures: FAILED tests/test_tempfile.py::test_named_temporary_file[r+] - AttributeError: '_io.TextIOWra... 2023-06-28 15:31:35 UTC

Description Tomáš Hrnčiar 2023-05-04 09:20:18 UTC
python-aiofiles fails to build with Python 3.12.0a7.

=================================== FAILURES ===================================
________________________ test_named_temporary_file[r+] _________________________

mode = 'r+'

    @pytest.mark.asyncio
    @pytest.mark.parametrize("mode", ["r+", "w+", "rb+", "wb+"])
    async def test_named_temporary_file(mode):
        """Test named temporary file."""
        data = b"Hello World!" if "b" in mode else "Hello World!"
        filename = None
    
>       async with tempfile.NamedTemporaryFile(mode=mode) as f:

tests/test_tempfile.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-aiofiles-23.1.0-1.fc39.x86_64/usr/lib/python3.12/site-packages/aiofiles/base.py:98: in __aenter__
    self._obj = await self._coro
../../BUILDROOT/python-aiofiles-23.1.0-1.fc39.x86_64/usr/lib/python3.12/site-packages/aiofiles/tempfile/__init__.py:177: in _temporary_file
    result.delete = f.delete
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tempfile._TemporaryFileWrapper object at 0x7f6271d370b0>
name = 'delete'

    def __getattr__(self, name):
        # Attribute lookups are delegated to the underlying file
        # and cached for non-numeric results
        # (i.e. methods are cached, closed and friends are not)
        file = self.__dict__['file']
>       a = getattr(file, name)
E       AttributeError: '_io.TextIOWrapper' object has no attribute 'delete'

/usr/lib64/python3.12/tempfile.py:478: AttributeError
________________________ test_named_temporary_file[w+] _________________________

mode = 'w+'

    @pytest.mark.asyncio
    @pytest.mark.parametrize("mode", ["r+", "w+", "rb+", "wb+"])
    async def test_named_temporary_file(mode):
        """Test named temporary file."""
        data = b"Hello World!" if "b" in mode else "Hello World!"
        filename = None
    
>       async with tempfile.NamedTemporaryFile(mode=mode) as f:

tests/test_tempfile.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-aiofiles-23.1.0-1.fc39.x86_64/usr/lib/python3.12/site-packages/aiofiles/base.py:98: in __aenter__
    self._obj = await self._coro
../../BUILDROOT/python-aiofiles-23.1.0-1.fc39.x86_64/usr/lib/python3.12/site-packages/aiofiles/tempfile/__init__.py:177: in _temporary_file
    result.delete = f.delete
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tempfile._TemporaryFileWrapper object at 0x7f6271ba4140>
name = 'delete'

    def __getattr__(self, name):
        # Attribute lookups are delegated to the underlying file
        # and cached for non-numeric results
        # (i.e. methods are cached, closed and friends are not)
        file = self.__dict__['file']
>       a = getattr(file, name)
E       AttributeError: '_io.TextIOWrapper' object has no attribute 'delete'

/usr/lib64/python3.12/tempfile.py:478: AttributeError
________________________ test_named_temporary_file[rb+] ________________________

mode = 'rb+'

    @pytest.mark.asyncio
    @pytest.mark.parametrize("mode", ["r+", "w+", "rb+", "wb+"])
    async def test_named_temporary_file(mode):
        """Test named temporary file."""
        data = b"Hello World!" if "b" in mode else "Hello World!"
        filename = None
    
>       async with tempfile.NamedTemporaryFile(mode=mode) as f:

tests/test_tempfile.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-aiofiles-23.1.0-1.fc39.x86_64/usr/lib/python3.12/site-packages/aiofiles/base.py:98: in __aenter__
    self._obj = await self._coro
../../BUILDROOT/python-aiofiles-23.1.0-1.fc39.x86_64/usr/lib/python3.12/site-packages/aiofiles/tempfile/__init__.py:177: in _temporary_file
    result.delete = f.delete
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tempfile._TemporaryFileWrapper object at 0x7f6271b8b650>
name = 'delete'

    def __getattr__(self, name):
        # Attribute lookups are delegated to the underlying file
        # and cached for non-numeric results
        # (i.e. methods are cached, closed and friends are not)
        file = self.__dict__['file']
>       a = getattr(file, name)
E       AttributeError: '_io.BufferedRandom' object has no attribute 'delete'

/usr/lib64/python3.12/tempfile.py:478: AttributeError
________________________ test_named_temporary_file[wb+] ________________________

mode = 'wb+'

    @pytest.mark.asyncio
    @pytest.mark.parametrize("mode", ["r+", "w+", "rb+", "wb+"])
    async def test_named_temporary_file(mode):
        """Test named temporary file."""
        data = b"Hello World!" if "b" in mode else "Hello World!"
        filename = None
    
>       async with tempfile.NamedTemporaryFile(mode=mode) as f:

tests/test_tempfile.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-aiofiles-23.1.0-1.fc39.x86_64/usr/lib/python3.12/site-packages/aiofiles/base.py:98: in __aenter__
    self._obj = await self._coro
../../BUILDROOT/python-aiofiles-23.1.0-1.fc39.x86_64/usr/lib/python3.12/site-packages/aiofiles/tempfile/__init__.py:177: in _temporary_file
    result.delete = f.delete
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tempfile._TemporaryFileWrapper object at 0x7f6271b8a600>
name = 'delete'

    def __getattr__(self, name):
        # Attribute lookups are delegated to the underlying file
        # and cached for non-numeric results
        # (i.e. methods are cached, closed and friends are not)
        file = self.__dict__['file']
>       a = getattr(file, name)
E       AttributeError: '_io.BufferedRandom' object has no attribute 'delete'

/usr/lib64/python3.12/tempfile.py:478: AttributeError
=========================== short test summary info ============================
FAILED tests/test_tempfile.py::test_named_temporary_file[r+] - AttributeError...
FAILED tests/test_tempfile.py::test_named_temporary_file[w+] - AttributeError...
FAILED tests/test_tempfile.py::test_named_temporary_file[rb+] - AttributeErro...
FAILED tests/test_tempfile.py::test_named_temporary_file[wb+] - AttributeErro...
======================== 4 failed, 197 passed in 1.51s =========================

https://docs.python.org/3.12/whatsnew/3.12.html

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

For all our attempts to build python-aiofiles with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/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.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Beasley 2023-06-28 15:31:35 UTC
Upstream issue: https://github.com/Tinche/aiofiles/issues/166

Comment 3 Ankur Sinha (FranciscoD) 2023-07-03 09:24:18 UTC
Built in the side tag.


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