Commit 6cd98c2
Allow IO#each_codepoint to work with unetc even when encoding conversion active
Using IO#each_codepoint together with IO#ungetc causes an unwanted exception when encoding conversion is active.
C:\>ruby -e "open('NUL', 'rt') { |f| f.ungetc('aa'); f.each_codepoint { |c| p c }}"
97
-e:1:in 'IO#each_codepoint': byte oriented read for character buffered IO (IOError)
from -e:1:in 'block in <main>'
from -e:1:in 'Kernel#open'
from -e:1:in '<main>'
Fixes [Bug #21131]1 parent 85bd3fb commit 6cd98c2
2 files changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4947 | 4947 | | |
4948 | 4948 | | |
4949 | 4949 | | |
4950 | | - | |
| 4950 | + | |
4951 | 4951 | | |
4952 | 4952 | | |
4953 | 4953 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
470 | 488 | | |
471 | 489 | | |
472 | 490 | | |
| |||
0 commit comments