Skip to content

Commit d3b88b4

Browse files
committed
Rename methods for accessing struct members
1 parent 8d6cc2f commit d3b88b4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ext/pycall/pyptr/pyptr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ pycall_pyptr_is_none(VALUE obj)
262262
}
263263

264264
static VALUE
265-
pycall_pyptr_get_address(VALUE obj)
265+
pycall_pyptr_get_ptr_address(VALUE obj)
266266
{
267267
PyObject* pyobj = get_pyobj_ptr(obj);
268268
return PTR2NUM(pyobj);
269269
}
270270

271271
static VALUE
272-
pycall_pyptr_get_refcnt(VALUE obj)
272+
pycall_pyptr_get_ob_refcnt(VALUE obj)
273273
{
274274
PyObject* pyobj = get_pyobj_ptr(obj);
275275
if (pyobj)
@@ -278,7 +278,7 @@ pycall_pyptr_get_refcnt(VALUE obj)
278278
}
279279

280280
static VALUE
281-
pycall_pyptr_get_type(VALUE obj)
281+
pycall_pyptr_get_ob_type(VALUE obj)
282282
{
283283
PyObject* pyobj = get_pyobj_ptr(obj);
284284
if (pyobj) {
@@ -333,9 +333,9 @@ Init_pyptr(void)
333333
rb_define_singleton_method(cPyPtr, "new", pycall_pyptr_s_new, 1);
334334
rb_define_method(cPyPtr, "null?", pycall_pyptr_is_null, 0);
335335
rb_define_method(cPyPtr, "none?", pycall_pyptr_is_none, 0);
336-
rb_define_method(cPyPtr, "__address__", pycall_pyptr_get_address, 0);
337-
rb_define_method(cPyPtr, "__refcnt__", pycall_pyptr_get_refcnt, 0);
338-
rb_define_method(cPyPtr, "__type__", pycall_pyptr_get_type, 0);
336+
rb_define_method(cPyPtr, "__address__", pycall_pyptr_get_ptr_address, 0);
337+
rb_define_method(cPyPtr, "__ob_refcnt__", pycall_pyptr_get_ob_refcnt, 0);
338+
rb_define_method(cPyPtr, "__ob_type__", pycall_pyptr_get_ob_type, 0);
339339
rb_define_method(cPyPtr, "inspect", pycall_pyptr_inspect, 0);
340340
rb_define_method(cPyPtr, "kind_of?", pycall_pyptr_is_kind_of, 1);
341341
rb_define_method(cPyPtr, "is_a?", pycall_pyptr_is_kind_of, 1);

spec/pycall/pyptr_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ module PyCall
4444
end
4545
end
4646

47-
describe '#__type__' do
47+
describe '#__ob_type__' do
4848
it 'returns a PyPtr for None' do
49-
expect(PyPtr::None.__type__).to be_a(PyPtr)
49+
expect(PyPtr::None.__ob_type__).to be_a(PyPtr)
5050
end
5151
end
5252

0 commit comments

Comments
 (0)