diff options
-rw-r--r-- | Lib/asyncio/base_events.py | 5 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_subprocess.py | 11 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-05-28-23-17-35.bpo-35246.oXT21d.rst | 1 |
3 files changed, 12 insertions, 5 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 68105ee..e002539 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -1605,11 +1605,6 @@ class BaseEventLoop(events.AbstractEventLoop): raise ValueError("errors must be None") popen_args = (program,) + args - for arg in popen_args: - if not isinstance(arg, (str, bytes)): - raise TypeError( - f"program arguments must be a bytes or text string, " - f"not {type(arg).__name__}") protocol = protocol_factory() debug_log = None if self._debug: diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index f1ab039..7d72e6c 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -622,6 +622,17 @@ class SubprocessMixin: self.loop.run_until_complete(execute()) + def test_create_subprocess_exec_with_path(self): + async def execute(): + p = await subprocess.create_subprocess_exec( + support.FakePath(sys.executable), '-c', 'pass') + await p.wait() + p = await subprocess.create_subprocess_exec( + sys.executable, '-c', 'pass', support.FakePath('.')) + await p.wait() + + self.assertIsNone(self.loop.run_until_complete(execute())) + if sys.platform != 'win32': # Unix class SubprocessWatcherMixin(SubprocessMixin): diff --git a/Misc/NEWS.d/next/Library/2019-05-28-23-17-35.bpo-35246.oXT21d.rst b/Misc/NEWS.d/next/Library/2019-05-28-23-17-35.bpo-35246.oXT21d.rst new file mode 100644 index 0000000..39d4469 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-28-23-17-35.bpo-35246.oXT21d.rst @@ -0,0 +1 @@ +Make :func:`asyncio.create_subprocess_exec` accept path-like arguments. |