File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Thu Sep 4 00:31:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+ * ext/thread/thread.c (get_array): check instance variables are
4+ initialized properly. [ruby-core:63826][Bug #10062]
5+
16Thu Sep 4 00:29:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
27
38 * io.c (rb_io_initialize): [DOC] fix rdoc of append mode. it does
Original file line number Diff line number Diff line change @@ -11,14 +11,24 @@ enum {
1111 SZQUEUE_MAX = 3
1212};
1313
14- #define GET_CONDVAR_WAITERS (cv ) RSTRUCT_GET ((cv), CONDVAR_WAITERS)
14+ #define GET_CONDVAR_WAITERS (cv ) get_array ((cv), CONDVAR_WAITERS)
1515
16- #define GET_QUEUE_QUE (q ) RSTRUCT_GET ((q), QUEUE_QUE)
17- #define GET_QUEUE_WAITERS (q ) RSTRUCT_GET ((q), QUEUE_WAITERS)
18- #define GET_SZQUEUE_WAITERS (q ) RSTRUCT_GET ((q), SZQUEUE_WAITERS)
16+ #define GET_QUEUE_QUE (q ) get_array ((q), QUEUE_QUE)
17+ #define GET_QUEUE_WAITERS (q ) get_array ((q), QUEUE_WAITERS)
18+ #define GET_SZQUEUE_WAITERS (q ) get_array ((q), SZQUEUE_WAITERS)
1919#define GET_SZQUEUE_MAX (q ) RSTRUCT_GET((q), SZQUEUE_MAX)
2020#define GET_SZQUEUE_ULONGMAX (q ) NUM2ULONG(GET_SZQUEUE_MAX(q))
2121
22+ static VALUE
23+ get_array (VALUE obj , int idx )
24+ {
25+ VALUE ary = RSTRUCT_GET (obj , idx );
26+ if (!RB_TYPE_P (ary , T_ARRAY )) {
27+ rb_raise (rb_eTypeError , "%+" PRIsVALUE " not initialized" , obj );
28+ }
29+ return ary ;
30+ }
31+
2232static VALUE
2333ary_buf_new (void )
2434{
Original file line number Diff line number Diff line change 44require_relative '../ruby/envutil'
55
66class TestConditionVariable < Test ::Unit ::TestCase
7+ def test_initialized
8+ assert_raise ( TypeError ) {
9+ ConditionVariable . allocate . wait ( nil )
10+ }
11+ end
12+
713 def test_condvar_signal_and_wait
814 mutex = Mutex . new
915 condvar = ConditionVariable . new
Original file line number Diff line number Diff line change 55require_relative '../ruby/envutil'
66
77class TestQueue < Test ::Unit ::TestCase
8+ def test_queue_initialized
9+ assert_raise ( TypeError ) {
10+ Queue . allocate . push ( nil )
11+ }
12+ end
13+
14+ def test_sized_queue_initialized
15+ assert_raise ( TypeError ) {
16+ SizedQueue . allocate . push ( nil )
17+ }
18+ end
19+
820 def test_queue
921 grind ( 5 , 1000 , 15 , Queue )
1022 end
Original file line number Diff line number Diff line change 11#define RUBY_VERSION "2.1.2"
22#define RUBY_RELEASE_DATE "2014-09-04"
3- #define RUBY_PATCHLEVEL 221
3+ #define RUBY_PATCHLEVEL 222
44
55#define RUBY_RELEASE_YEAR 2014
66#define RUBY_RELEASE_MONTH 9
You can’t perform that action at this time.
0 commit comments