Project

General

Profile

Actions

Bug #112

closed

Rational("355/113") clear $&

Added by Anonymous almost 16 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
Backport:
[ruby-dev:34990]

Description

=begin
以下のように、Rational("355/113") とすると $& が nil になり
ます。

% ./ruby -ve '/a/ =~ "a"
p $&
Rational("355/113")
p $&
'
ruby 1.9.0 (2008-06-07 revision 16875) [i686-linux]
"a"
nil

[田中 哲][たなか あきら][Tanaka Akira]
=end

Actions #1

Updated by matz (Yukihiro Matsumoto) almost 16 years ago

  • Assignee set to matz (Yukihiro Matsumoto)

=begin

=end

Actions #2

Updated by Anonymous almost 16 years ago

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

=begin
Applied in changeset r17147.
=end

Actions #3

Updated by Anonymous almost 16 years ago

=begin
Issue #112 has been updated by Anonymous.

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

Applied in changeset r17147.

Bug #112: Rational("355/113") clear $&
http://redmine.ruby-lang.org/issues/show/112

Author: Anonymous
Status: Closed
Priority: Low
Assigned to: Yukihiro Matsumoto
Category:
Target version:

以下のように、Rational("355/113") とすると $& が nil になり
ます。

% ./ruby -ve '/a/ =~ "a"
p $&
Rational("355/113")
p $&
'
ruby 1.9.0 (2008-06-07 revision 16875) [i686-linux]
"a"
nil

[田中 哲][たなか あきら][Tanaka Akira]


You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://redmine.ruby-lang.org/my/account

=end

Actions #4

Updated by Anonymous almost 16 years ago

=begin

ワナベと申します。

2008/06/09 20:22 Tadayoshi Funaba :

以下のように、Rational("355/113") とすると $& が nil になり
ます。

内部で match をつかってるのが影響していると思いますが、どう対処したら
いいんでしょうね。コンテキストの問題なのか、最初から副作用がないような
手段をとらないといけないのか。

単純に backref を一時保存・復帰するのはどうでしょうか。

Index: rational.c

--- rational.c (revision 17112)
+++ rational.c (working copy)
@@ -1274,13 +1274,15 @@
static VALUE
string_to_r_internal(VALUE self)
{

  • VALUE s, m;
  • VALUE s, m, backref;

    s = f_strip(self);

    if (RSTRING_LEN(s) == 0)
    return rb_assoc_new(Qnil, self);

  • backref = rb_backref_get();

  • rb_match_busy(backref);
    m = f_match(rat_pat, s);

    if (!NIL_P(m)) {
    @@ -1333,8 +1335,10 @@
    if (!NIL_P(de))
    v = f_div(v, f_to_i(de));

  • rb_backref_set(backref);
    return rb_assoc_new(v, re);
    }

  • rb_backref_set(backref);
    return rb_assoc_new(Qnil, self);
    }

--
ワナベ

=end

Actions #5

Updated by matz (Yukihiro Matsumoto) almost 16 years ago

=begin

まつもと ゆきひろです

In message "Re: [ruby-dev:35081] Re: [Bug:1.9] Rational("355/113") clear $&"
on Fri, 13 Jun 2008 00:49:43 +0900, wanabe writes:

|2008/06/09 20:22 Tadayoshi Funaba :
|>> 以下のように、Rational("355/113") とすると $& が nil になり
|>> ます。
|>
|> 内部で match をつかってるのが影響していると思いますが、どう対処したら
|> いいんでしょうね。コンテキストの問題なのか、最初から副作用がないような
|> 手段をとらないといけないのか。
|
|単純に backref を一時保存・復帰するのはどうでしょうか。

正規表現を使わない方法が良いのではないだろうかと考えていまし
たが、ちょっと手間がかかりますから、当面保存・復帰で対処した
方がよいでしょう。

コミットしていただけますか?

ところで、コミットすると自動的にRedmineが行進される仕組みは

ないのかなあ。

=end

Actions #6

Updated by usa (Usaku NAKAMURA) almost 16 years ago

=begin

こんにちは、なかむら(う)です。

In message "[ruby-dev:35083] Re: [Bug:1.9] Rational("355/113") clear $&"
on Jun.13,2008 10:04:54, wrote:

ところで、コミットすると自動的にRedmineが行進される仕組みは

ないのかなあ。

あるそうですよ。

http://redmine.ruby-lang.org/wiki/redmine/VersionControlSystemJa

それでは。

U.Nakamura

=end

Actions #7

Updated by matz (Yukihiro Matsumoto) almost 16 years ago

=begin

まつもと ゆきひろです

In message "Re: [ruby-dev:35085] Re: [Bug:1.9] Rational("355/113") clear $&"
on Fri, 13 Jun 2008 14:03:31 +0900, "U.Nakamura" writes:

|In message "[ruby-dev:35083] Re: [Bug:1.9] Rational("355/113") clear $&"
| on Jun.13,2008 10:04:54, wrote:
|> # ところで、コミットすると自動的にRedmineが行進される仕組みは
|> # ないのかなあ。
|
|あるそうですよ。
|
|http://redmine.ruby-lang.org/wiki/redmine/VersionControlSystemJa

おおっ、

fixed [ruby-dev:35085]

ですね。今後活用させてもらいます。

=end

Actions #8

Updated by ko1 (Koichi Sasada) almost 16 years ago

=begin

 ささだです.

Yukihiro Matsumoto wrote:

おおっ、

fixed [ruby-dev:35085]

ですね。今後活用させてもらいます。

 先日,yugui さんに [ruby-dev:xxxx] でも fix として扱ってもらうよう
に頼みました.従来の ChangeLog フォーマットが,そんなふうになってい
るからです.

 逆に,ref の場合に ref [ruby-dev:xxxx] と書いてもらうようになるよ
うです.

--
// SASADA Koichi at atdot dot net

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0