Issue #11738 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE

Backported into `ruby_2_2` branch at r52788.

----------------------------------------
Bug #11738: ARGF.readpartial raises a wrong exception
https://bugs.ruby-lang.org/issues/11738#change-55139

* Author: Shugo Maeda
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-11-09 trunk 52500) [x86_64-linux]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE
----------------------------------------
ARGF.readpartial raises a RuntimeError when EOF is detected more than twice:

```
lexington:ruby$ cat t.rb
p ARGF.readpartial(16) rescue nil
p ARGF.readpartial(16)
lexington:ruby$ ruby t.rb /dev/null
t.rb:2:in `readpartial': can't modify frozen NilClass (RuntimeError)
	from t.rb:2:in `<main>'
lexington:ruby$
```

An EOFError is expected.




-- 
https://bugs.ruby-lang.org/