IronLanguages / IronLanguages/ironpython3

FileIO, BufferedWriter left unflushed when ipy exits

Open
#938 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

  • Running the following code with ipy, will get an empty file test.txt, while with CPython, the file will have one byte 'a'
import io
out = io.FileIO('test.txt', 'w')
out.write(b'a')
  • Similar case but using BufferedWriter:
import io
out = io.TextIOWrapper(io.BufferedWriter(io.FileIO('test.txt', 'w')))
out.write('a')
  • Case involving stdio:

The following powershell command output nothing,

PS C:\Users\james\proj\ironpython3> .\bin\Debug\netcoreapp3.1\ipy.exe -c "import sys;sys.stdout.write('text')"
PS C:\Users\james\proj\ironpython3>

and the following powershell command could output the "text"

PS C:\Users\james\proj\ironpython3> .\bin\Debug\netcoreapp3.1\ipy.exe -c "import sys;sys.stdout.write('text\n')"
text
PS C:\Users\james\proj\ironpython3>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the FileIO, BufferedWriter/TextIOWrapper, and stdout examples with ipy and compare their behavior with CPython. Trace the process-exit handling for these streams; done means pending file and standard-output data is emitted when ipy exits, including data without a trailing newline.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.