Skip to content

Commit af76b7f

Browse files
kddnewtonmatzbot
authored andcommitted
[ruby/prism] Revert "Mark extension as Ractor-safe"
ruby/prism@56eaf53732
1 parent 242e99e commit af76b7f

File tree

4 files changed

+4
-76
lines changed

4 files changed

+4
-76
lines changed

lib/prism/ffi.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
require "rbconfig"
88
require "ffi"
99

10-
# We want to eagerly load this file if there are Ractors so that it does not get
11-
# autoloaded from within a non-main Ractor.
12-
require "prism/serialize" if defined?(Ractor)
13-
1410
module Prism
1511
module LibRubyParser # :nodoc:
1612
extend FFI::Library
@@ -163,9 +159,6 @@ def self.with
163159
class PrismString # :nodoc:
164160
SIZEOF = LibRubyParser.pm_string_sizeof
165161

166-
PLATFORM_EXPECTS_UTF8 =
167-
RbConfig::CONFIG["host_os"].match?(/bccwin|cygwin|djgpp|mingw|mswin|wince|darwin/i)
168-
169162
attr_reader :pointer, :length
170163

171164
def initialize(pointer, length, from_string)
@@ -200,7 +193,8 @@ def self.with_file(filepath)
200193
# On Windows and Mac, it's expected that filepaths will be encoded in
201194
# UTF-8. If they are not, we need to convert them to UTF-8 before
202195
# passing them into pm_string_mapped_init.
203-
if PLATFORM_EXPECTS_UTF8 && (encoding = filepath.encoding) != Encoding::ASCII_8BIT && encoding != Encoding::UTF_8
196+
if RbConfig::CONFIG["host_os"].match?(/bccwin|cygwin|djgpp|mingw|mswin|wince|darwin/i) &&
197+
(encoding = filepath.encoding) != Encoding::ASCII_8BIT && encoding != Encoding::UTF_8
204198
filepath = filepath.encode(Encoding::UTF_8)
205199
end
206200

@@ -229,7 +223,7 @@ def self.with_file(filepath)
229223
private_constant :LibRubyParser
230224

231225
# The version constant is set by reading the result of calling pm_version.
232-
VERSION = LibRubyParser.pm_version.read_string.freeze
226+
VERSION = LibRubyParser.pm_version.read_string
233227

234228
class << self
235229
# Mirror the Prism.dump API by using the serialization API.

prism/extension.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,11 +1331,6 @@ Init_prism(void) {
13311331
);
13321332
}
13331333

1334-
#ifdef HAVE_RB_EXT_RACTOR_SAFE
1335-
// Mark this extension as Ractor-safe.
1336-
rb_ext_ractor_safe(true);
1337-
#endif
1338-
13391334
// Grab up references to all of the constants that we're going to need to
13401335
// reference throughout this extension.
13411336
rb_cPrism = rb_define_module("Prism");

prism/templates/lib/prism/serialize.rb.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ module Prism
592592
<%- tokens.each do |token| -%>
593593
<%= token.name.to_sym.inspect %>,
594594
<%- end -%>
595-
].freeze
595+
]
596596

597597
private_constant :MAJOR_VERSION, :MINOR_VERSION, :PATCH_VERSION
598598
private_constant :ConstantPool, :FastStringIO, :Loader, :TOKEN_TYPES

test/prism/ractor_test.rb

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)