Skip to content

create_subprocess doesn't work with PathLike objects #90

Closed
@JelleZijlstra

Description

@JelleZijlstra
  • uvloop version: 0.8.0
  • Python version: 3.6.1
  • Platform: Ubuntu
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: Yes

The following test script fails as follows:

import asyncio
from pathlib import Path
import uvloop

async def make_process():
    await asyncio.subprocess.create_subprocess_exec('ls', cwd=Path('/tmp'))

asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
asyncio.get_event_loop().run_until_complete(make_process())
  File "uvloop/loop.pyx", line 2164, in __subprocess_run (uvloop/loop.c:39415)
  File "uvloop/handles/process.pyx", line 549, in uvloop.loop.UVProcessTransport.new (uvloop/loop.c:93764)
  File "uvloop/handles/process.pyx", line 49, in uvloop.loop.UVProcess._init (uvloop/loop.c:84744)
  File "uvloop/handles/process.pyx", line 38, in uvloop.loop.UVProcess._init (uvloop/loop.c:84464)
  File "uvloop/handles/process.pyx", line 233, in uvloop.loop.UVProcess._init_options (uvloop/loop.c:87896)
ValueError: cwd must be a str or bytes object

This works fine with vanilla asyncio. Fixing the bug is probably just a matter of calling os.fspath/PyOS_FSPath somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions