Project

General

Profile

Bug #15891

FrozenError when assigning frozen class to constant

Added by flori (Florian Frank) 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-05-31 master 1457ad1ea7) [x86_64-darwin17]
[ruby-core:92911]

Description

This code used to work in Ruby 2.6 and before: C = Class.new.freeze. Now it raises a FrozenError for class and module instances, while other frozen things seem to still work.

I am not sure if this is a bug or an intentional change. A possible workaround is

C = Class.new
C.freeze

which works fine.


Related issues

Related to Ruby master - Feature #15765: [PATCH] Module#name without global constant searchClosedActions

Associated revisions

Revision c1e52997
Added by nobu (Nobuyoshi Nakada) 3 months ago

Fix FrozenError when assigning frozen class to constant

  • variable.c (set_namespace_path): modules/classes can get named by assignment to constant, even if frozen. [Bug #15891]

History

#1

Updated by nobu (Nobuyoshi Nakada) 3 months ago

  • Related to Feature #15765: [PATCH] Module#name without global constant search added
#2

Updated by nobu (Nobuyoshi Nakada) 3 months ago

  • Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONTNEED
  • Description updated (diff)
#3

Updated by nobu (Nobuyoshi Nakada) 3 months ago

  • Status changed from Open to Closed

Applied in changeset git|c1e52997870a63168835fde49562cb3c822c968a.


Fix FrozenError when assigning frozen class to constant

  • variable.c (set_namespace_path): modules/classes can get named by assignment to constant, even if frozen. [Bug #15891]

Also available in: Atom PDF