StringIO#gets should set $_ to nil when it runs out of lines
------------------------------------------------------------

                 Key: JRUBY-2450
                 URL: http://jira.codehaus.org/browse/JRUBY-2450
             Project: JRuby
          Issue Type: Bug
          Components: Extensions
    Affects Versions: JRuby 1.1.1
            Reporter: Charles Oliver Nutter
            Assignee: Charles Oliver Nutter
             Fix For: JRuby 1.1.2


Probably easy to fix, but we need to scan for other cases. This code does not 
leave $_ nil in JRuby but does in MRI:

{noformat}
s = StringIO.new("foo\n", "r")
s.gets
s.gets
{noformat}

Because of this code in RubyStringIO:

{noformat}
    @JRubyMethod(name = "gets", optional = 1)
    public IRubyObject gets(ThreadContext context, IRubyObject[] args) {
        checkReadable();

        IRubyObject result = internalGets(args);
        if (!result.isNil()) {
            context.getCurrentFrame().setLastLine(result);
        }
        
        return result;
    }
{noformat}

There may be others like this as well.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to