Misc #18025
closedrb_iterate is obsolete since 1.9 but is not marked as deprecated for C compilers
Description
Marked as obsolete in https://github.com/ruby/ruby/blob/master/doc/extension.rdoc#label-Control+Structure.
I think it would be a good to mark it as deprecated so the few places still using that migrate to e.g. rb_block_call()
.
These 2 places are still using rb_iterate():
-
ext/openssl/ossl_ssl.c:595: rb_iterate(rb_each, protocols, ssl_npn_encode_protocol_i, encoded);
Should use rb_block_call instead: https://github.com/ruby/openssl/pull/448 -
ext/racc/cparse/cparse.c:302: rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v);
Unintentional, fix in https://github.com/ruby/racc/pull/165
Right now there is special logic inside rb_funcall()/vm_call0_body()
to handle the block magically passed by rb_iterate(), and I think it would be good to clean that up once rb_iterate()
is gone.
FYI, TruffleRuby is recently no longer doing that magic behavior for such an old deprecated method:
https://github.com/oracle/truffleruby/commit/e7ddba79cc64f7beea8a34ef6c14d50d444399f7
Updated by Eregon (Benoit Daloze) about 3 years ago
- Assignee set to Eregon (Benoit Daloze)
Updated by shyouhei (Shyouhei Urabe) about 3 years ago
+1. I want Ko1's opinion.
Updated by Eregon (Benoit Daloze) about 3 years ago
- Status changed from Open to Closed
Applied in changeset git|fd0df9c4fb36597e5e3f500670b29dbd77a14eca.
Emit deprecatation warnings for rb_iterate()
- It is obsolete since 1.9, see
https://github.com/ruby/ruby/blob/master/doc/extension.rdoc#label-Control+Structure
and [Misc #18025]