Skip to content

Commit 12927b8

Browse files
committed
Do not use private APIs in StringIO
1 parent 130ed60 commit 12927b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/elixir/lib/string_io.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ defmodule StringIO do
366366
defp get_until(encoding, prompt, mod, fun, args, %{input: input} = state) do
367367
case get_until(input, encoding, mod, fun, args, [], 0) do
368368
{result, input, count} ->
369+
# Convert :eof to "" as they are both treated the same
369370
input =
370371
case input do
371372
:eof -> ""
@@ -392,7 +393,7 @@ defmodule StringIO do
392393
defp get_until(chars, encoding, mod, fun, args, continuation, count) do
393394
case bytes_until_eol(chars, encoding, 0) do
394395
{kind, size} when kind in [:split, :replace_split] ->
395-
{line, rest} = :erlang.split_binary(chars, size)
396+
<<line::binary-size(size), rest::binary>> = chars
396397

397398
case apply(mod, fun, [continuation, binary_to_list(line, encoding) | args]) do
398399
{:done, result, :eof} ->

0 commit comments

Comments
 (0)