Project

General

Profile

Actions

Bug #985

closed

profile lib + iterator => 'NULL pointer given' (ArgumentError)

Added by brokenoty (Alex Fenton) about 15 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
Backport:
[ruby-core:21161]

Description

=begin
This simple piece of code works as expected:

iter = 'abc'.each_char
p iter.next
=> "a"

However, if the profile library is required before this (either by -rprofile on the command line or require 'profile') it crashes with an unexpected 'NULL pointer given' error:

ruby -rprofile bug.rb
% cumulative self self total
time seconds seconds calls ms/call ms/call name
0.00 0.00 0.00 2 0.00 0.00 IO#set_encoding
0.00 0.00 0.00 1 0.00 0.00 String#each_char
0.00 0.00 0.00 1 0.00 0.00 Kernel.proc
0.00 0.00 0.00 1 0.00 0.00 Exception#backtrace
0.00 0.00 0.00 1 0.00 0.00 Exception#set_backtrace
0.00 0.01 0.00 1 0.00 10.00 #toplevel
bug.rb:2:in next': NULL pointer given (ArgumentError) from bug.rb:2:in '

Thanks.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0