Backport #9299

Required keyowrd arguments and arity

Added by Marc-Andre Lafortune 4 months ago. Updated about 1 month ago.

[ruby-core:59314]
Status:Open
Priority:Normal
Assignee:Yukihiro Matsumoto

Description

While fixing #8072, I noticed another bug: a required keyword argument should add 1 to the arity:

proc{|required:|}.arity # => 0, should be 1

Related issues

Related to Backport21 - Backport #8072: Method#arity for keyword arguments Closed 03/11/2013

Associated revisions

Revision 45226
Added by Yui NARUSE about 1 month ago

merge revision(s) 44433: [Backport #9299]

* proc.c: Having any mandatory keyword argument increases min arity
  [#9299]

Revision 45231
Added by Yui NARUSE about 1 month ago

merge revision(s) 44432: [Backport #9299]

* proc.c: Having optional keyword arguments makes maximum arity +1,
  not unlimited [#8072]

History

#1 Updated by Marc-Andre Lafortune 4 months ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport21
  • Category deleted (core)
  • Assignee changed from Marc-Andre Lafortune to Yui NARUSE

#2 Updated by Yui NARUSE about 1 month ago

  • Status changed from Open to Feedback
  • Assignee changed from Yui NARUSE to Marc-Andre Lafortune

Like #8072, this is not a simple backport.
Please get confirmation by matz

#3 Updated by Marc-Andre Lafortune about 1 month ago

  • Assignee changed from Marc-Andre Lafortune to Yukihiro Matsumoto

Please excuse my ignorance, I'm not sure what a simple backport is.

Dear Matz, hopefully you will know.

I always put my bug fixes as backport requests, but I welcome guidelines.

#4 Updated by Yukihiro Matsumoto about 1 month ago

I consider this as a bug. So it should be back-ported to 2.1, I think.

Matz.

#5 Updated by Yui NARUSE about 1 month ago

  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100

Applied in changeset r45226.


merge revision(s) 44433: [Backport #9299]

* proc.c: Having any mandatory keyword argument increases min arity
  [#9299]

#6 Updated by Yui NARUSE about 1 month ago

Thank you for comments.

Marc-Andre Lafortune wrote:

Please excuse my ignorance, I'm not sure what a simple backport is.

Dear Matz, hopefully you will know.

I always put my bug fixes as backport requests, but I welcome guidelines.

yeah, I know you understand backport policy.
What I wanted to say is "I don't understand Proc#arity's keyword argument spec and can't judge whether spec change or bug fix".
(I accidentally backported #8072 related another backport, but the main issue is the spec of arity for keyword arguments)

Therefore could you describe the spec to Proc#arity's rdoc?
I want to backport it to Ruby 2.1.2.

Anyway I had written HowToRequestBackport.
The use of Backport custom field will help you.
https://bugs.ruby-lang.org/projects/ruby/wiki/HowToRequestBackport

#7 Updated by Marc-Andre Lafortune about 1 month ago

  • Status changed from Closed to Open

Naruse-san: You're right, the rdoc of Proc#arity was quite out of date. I've committed r45236-r45238 (04042ec6eb4..47d6a7ee1c8) to address this.

Matz: would you have time to review the rdoc of Proc#arity, especially the part about the different treatment of lambdas vs procs?

Thanks

Also available in: Atom PDF