summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/re.c b/re.c
index 96a3cbeaa9..3cf99c1210 100644
--- a/re.c
+++ b/re.c
@@ -1666,7 +1666,7 @@ rb_reg_prepare_re(VALUE re, VALUE str)
RSTRING_GETMEM(unescaped, ptr, len);
/* If there are no other users of this regex, then we can directly overwrite it. */
- if (RREGEXP(re)->usecnt == 0) {
+ if (ruby_single_main_ractor && RREGEXP(re)->usecnt == 0) {
regex_t tmp_reg;
r = onig_new_without_alloc(&tmp_reg, (UChar *)ptr, (UChar *)(ptr + len),
reg->options, enc,