[ruby-dev:48331] [ruby-trunk - Bug #9982] [Closed] Kernel#sprintf: unmbered widht and precision with numbered argument

From: nobu@...
Date: 2014-06-26 18:42:04 UTC
List: ruby-dev #48331
Issue #9982 has been updated by Nobuyoshi Nakada.

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]

----------------------------------------
Bug #9982: Kernel#sprintf: unmbered widht and precision with numbered argument
https://bugs.ruby-lang.org/issues/9982#change-47399

* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: trunk
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
次のコードがエラーにならず、変換対象の引数が幅や精度としても使われています。

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




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next