Index: src/org/jruby/RubyObject.java =================================================================== --- src/org/jruby/RubyObject.java (revision 3663) +++ src/org/jruby/RubyObject.java (working copy) @@ -820,11 +820,15 @@ public IRubyObject execute(IRubyObject self, IRubyObject[] args, Block block) { IRubyObject source = args[1]; IRubyObject filename = args[2]; + if (!filename.respondsTo("to_str")) { + throw source.getRuntime().newTypeError("can't convert " + filename.getMetaClass() + " into String"); + } + // FIXME: lineNumber is not supported //IRubyObject lineNumber = args[3]; - return args[0].evalSimple(source.getRuntime().getCurrentContext(), - source, ((RubyString) filename).toString()); + return args[0].evalSimple(source.getRuntime().getCurrentContext(), + source, filename.convertToString().toString()); } public Arity getArity() {