Skip to content

Duplicate file is closed when original file is closed #92

Open
@slide

Description

@slide

From @slozier on October 30, 2016 23:58

This works with CPython. IronPython fails with ValueError: I/O operation on closed file.

import os

with open("temp.txt", "wb+") as f:
    f.write("test")
    f.seek(os.SEEK_SET, 0)
    x = os.dup(f.fileno())
    g = os.fdopen(x, "rb")
assert g.read() == "test"

Copied from original issue: IronLanguages/main#1512

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