Project

General

Profile

Actions

Bug #6538

closed

Mutability of Rational and Complex

Added by marcandre (Marc-Andre Lafortune) over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Target version:
-
ruby -v:
r35875
Backport:
[ruby-core:45394]

Description

I hesitated to report this, but there is a "hole" in the immutability of Rational & Complex:

r = Rational(0) # Rationals are immutable
r.freeze        # but let's be certain and freeze it!
magic_trick(r)  # r is now changed:
r               # => (1/42)

The same thing occurs with Complex. I've left out the definition of magic_trick for anyone who wants to try and figure it out, but it's here: http://pastie.org/4016117

Is this worth fixing?


Files

0001-compatible-marshal-loader.patch (5.6 KB) 0001-compatible-marshal-loader.patch nobu (Nobuyoshi Nakada), 06/04/2012 10:24 PM

Related issues 1 (0 open1 closed)

Precedes Ruby master - Bug #6541: marshal_load discards frozen objectsClosednobu (Nobuyoshi Nakada)06/04/201206/04/2012Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0