Skip to content

Commit 23106c0

Browse files
casperisfinebyroot
andauthored
Undefine T_DATA allocators for Ruby 3.2 compatibility (#1236)
Ref: https://bugs.ruby-lang.org/issues/18007 Co-authored-by: Jean Boussier <[email protected]>
1 parent 25c42c7 commit 23106c0

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

ext/mysql2/result.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,7 @@ void init_mysql2_result() {
11741174
rb_global_variable(&cDateTime);
11751175

11761176
cMysql2Result = rb_define_class_under(mMysql2, "Result", rb_cObject);
1177+
rb_undef_alloc_func(cMysql2Result);
11771178
rb_global_variable(&cMysql2Result);
11781179

11791180
rb_define_method(cMysql2Result, "each", rb_mysql_result_each, -1);

ext/mysql2/statement.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ void init_mysql2_statement() {
581581
rb_global_variable(&cBigDecimal);
582582

583583
cMysql2Statement = rb_define_class_under(mMysql2, "Statement", rb_cObject);
584+
rb_undef_alloc_func(cMysql2Statement);
584585
rb_global_variable(&cMysql2Statement);
585586

586587
rb_define_method(cMysql2Statement, "param_count", rb_mysql_stmt_param_count, 0);

spec/mysql2/result_spec.rb

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@
66
end
77

88
it "should raise a TypeError exception when it doesn't wrap a result set" do
9-
if RUBY_VERSION >= "3.1"
10-
expect { Mysql2::Result.new }.to raise_error(TypeError)
11-
expect { Mysql2::Result.allocate }.to raise_error(TypeError)
12-
else
13-
r = Mysql2::Result.new
14-
expect { r.count }.to raise_error(TypeError)
15-
expect { r.fields }.to raise_error(TypeError)
16-
expect { r.field_types }.to raise_error(TypeError)
17-
expect { r.size }.to raise_error(TypeError)
18-
expect { r.each }.to raise_error(TypeError)
19-
end
9+
expect { Mysql2::Result.new }.to raise_error(TypeError)
10+
expect { Mysql2::Result.allocate }.to raise_error(TypeError)
2011
end
2112

2213
it "should have included Enumerable" do

0 commit comments

Comments
 (0)