GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — create_subprocess_exec treats env={} differently than vanilla asyncio · Issue #439 · MagicStack/uvloop

create_subprocess_exec treats env={} differently than vanilla asyncio #439

New issue
Copy link
New issue
Copy link
Closed
#454
Closed
create_subprocess_exec treats env={} differently than vanilla asyncio#439
#454
Copy link

Description

@byllyfish
byllyfish
opened on Aug 21, 2021
Issue body actions
  • uvloop version: 0.16.0
  • Python version: 3.9.6
  • Platform: macOS 11.5.2
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes
  • Does uvloop behave differently from vanilla asyncio? How?: create_subprocess_exec treats env differently.

When I set env={}, uvloop treats this as None and inherits all environment variables, while vanilla asyncio treats {} as an empty environment.

import asyncio
import os

import pytest

if os.environ.get("UVLOOP"):
    # Install uvloop event loop.
    import uvloop

    @pytest.fixture
    def event_loop():
        loop = uvloop.new_event_loop()
        yield loop
        loop.close()


@pytest.mark.asyncio
async def test_env():
    "This test passes under vanilla asyncio but fails under uvloop."
    proc = await asyncio.create_subprocess_exec(
        "/usr/bin/env",
        stdout=asyncio.subprocess.PIPE,
        env={},
    )
    result = await proc.communicate()

    # Under uvloop, stdout contains the full, inherited environment.
    assert result == (b"", None)

Activity

  1. fantix
    closed this as completedin #454on Aug 31, 2022
  2. fantix
    added a commit that references this issue on Aug 31, 2022

    create_subprocess_exec should treat env={} as empty environment (#439) (

    e04637e
  3. fantix
    added 2 commits that reference this issue on Sep 13, 2022

    uvloop v0.17.0

    c4c3f9f

    uvloop v0.17.0

    afb3268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.