summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse.y4
-rw-r--r--ruby.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 311bbba80b..a35b526ab3 100644
--- a/parse.y
+++ b/parse.y
@@ -6015,6 +6015,10 @@ nextline(struct parser_params *p)
if (p->eofp)
return -1;
+ if (p->lex.pend > p->lex.pbeg && *(p->lex.pend-1) != '\n') {
+ goto end_of_input;
+ }
+
if (!p->lex.input || NIL_P(v = lex_getline(p))) {
end_of_input:
p->eofp = 1;
diff --git a/ruby.c b/ruby.c
index 944b6c7f5c..e016197e05 100644
--- a/ruby.c
+++ b/ruby.c
@@ -2011,7 +2011,7 @@ load_file_internal(VALUE argp_v)
else if (!NIL_P(c)) {
rb_io_ungetbyte(f, c);
}
- else {
+ if (NIL_P(c)) {
argp->f = f = Qnil;
}
if (!(opt->dump & ~DUMP_BIT(version_v))) {