Skip to content

Repeating calls to connect_write_pipe with sys.stdout as a stream lead to FileExistsError exception #262

Open
@hh-h

Description

@hh-h
  • uvloop version: 0.11.3, 0.12.2, 0.13.0rc1
  • Python version: 3.6, 3.7
  • Platform: linux, macos
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes

Hello, this example doesn't work with uvloop.

import asyncio
import sys
import uvloop

uvloop.install()
loop = asyncio.get_event_loop()

async def main():
    transport, protocol = await loop.connect_write_pipe(
        asyncio.Protocol, sys.stdout
    )
    print("okay")

    transport2, protocol2 = await loop.connect_write_pipe(
        asyncio.Protocol, sys.stdout
    )
    print("okay")

loop.run_until_complete(main())
okay
Traceback (most recent call last):
  File "uvl.py", line 20, in <module>
    loop.run_until_complete(main())
  File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
  File "uvl.py", line 16, in main
    asyncio.Protocol, sys.stdout
  File "uvloop/loop.pyx", line 2703, in connect_write_pipe
  File "uvloop/loop.pyx", line 2698, in uvloop.loop.Loop.connect_write_pipe
  File "uvloop/handles/pipe.pyx", line 170, in uvloop.loop.WriteUnixTransport._open
  File "uvloop/handles/pipe.pyx", line 29, in uvloop.loop.__pipe_open
FileExistsError: [Errno 17] File exists

please, see discussion here https://github.com/B2W-BIT/aiologger/issues/42#issuecomment-457283504

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions