Project

General

Profile

Bug #9982

Kernel#sprintf: unmbered widht and precision with numbered argument

Added by nobu (Nobuyoshi Nakada) almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
trunk
[ruby-dev:48330]

Description

次のコードがエラーにならず、変換対象の引数が幅や精度としても使われています。

sprintf("%1$*d", 3)  #=> "  3"
sprintf("%1$.*d", 3) #=> "003"

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

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

Applied in changeset r46569.


sprintf.c: unnumbered asterisk with numbered argument

  • sprintf.c (GETASTER): should not use the numbered argument to be formatted, raise ArgumentError instead. [ruby-dev:48330] [Bug #9982]

Updated by nagachika (Tomoyuki Chikanaga) over 5 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE

Backported into ruby_2_1 branch at r47376.

Updated by usa (Usaku NAKAMURA) over 5 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1: DONE

backported into ruby_2_0_0 at r47497.

Also available in: Atom PDF