File tree 3 files changed +51
-28
lines changed
3 files changed +51
-28
lines changed Original file line number Diff line number Diff line change @@ -383,7 +383,7 @@ gc_get_stats_impl(PyObject *module)
383
383
384
384
385
385
/*[clinic input]
386
- gc.is_tracked
386
+ gc.is_tracked -> bool
387
387
388
388
obj: object
389
389
/
@@ -393,36 +393,27 @@ Returns true if the object is tracked by the garbage collector.
393
393
Simple atomic objects will return false.
394
394
[clinic start generated code]*/
395
395
396
- static PyObject *
397
- gc_is_tracked (PyObject * module , PyObject * obj )
398
- /*[clinic end generated code: output=14f0103423b28e31 input=d83057f170ea2723 ]*/
396
+ static int
397
+ gc_is_tracked_impl (PyObject * module , PyObject * obj )
398
+ /*[clinic end generated code: output=91c8d086b7f47a33 input=423b98ec680c3126 ]*/
399
399
{
400
- PyObject * result ;
401
-
402
- if (_PyObject_IS_GC (obj ) && _PyObject_GC_IS_TRACKED (obj ))
403
- result = Py_True ;
404
- else
405
- result = Py_False ;
406
- return Py_NewRef (result );
400
+ return PyObject_GC_IsTracked (obj );
407
401
}
408
402
409
403
/*[clinic input]
410
- gc.is_finalized
404
+ gc.is_finalized -> bool
411
405
412
406
obj: object
413
407
/
414
408
415
409
Returns true if the object has been already finalized by the GC.
416
410
[clinic start generated code]*/
417
411
418
- static PyObject *
419
- gc_is_finalized (PyObject * module , PyObject * obj )
420
- /*[clinic end generated code: output=e1516ac119a918ed input=201d0c58f69ae390 ]*/
412
+ static int
413
+ gc_is_finalized_impl (PyObject * module , PyObject * obj )
414
+ /*[clinic end generated code: output=401ff5d6fc660429 input=ca4d111c8f8c4e3a ]*/
421
415
{
422
- if (_PyObject_IS_GC (obj ) && _PyGC_FINALIZED (obj )) {
423
- Py_RETURN_TRUE ;
424
- }
425
- Py_RETURN_FALSE ;
416
+ return PyObject_GC_IsFinalized (obj );
426
417
}
427
418
428
419
/*[clinic input]
Original file line number Diff line number Diff line change @@ -1693,19 +1693,13 @@ PyObject_GC_Del(void *op)
1693
1693
int
1694
1694
PyObject_GC_IsTracked (PyObject * obj )
1695
1695
{
1696
- if (_PyObject_IS_GC (obj ) && _PyObject_GC_IS_TRACKED (obj )) {
1697
- return 1 ;
1698
- }
1699
- return 0 ;
1696
+ return _PyObject_GC_IS_TRACKED (obj );
1700
1697
}
1701
1698
1702
1699
int
1703
1700
PyObject_GC_IsFinalized (PyObject * obj )
1704
1701
{
1705
- if (_PyObject_IS_GC (obj ) && _PyGC_FINALIZED (obj )) {
1706
- return 1 ;
1707
- }
1708
- return 0 ;
1702
+ return _PyGC_FINALIZED (obj );
1709
1703
}
1710
1704
1711
1705
struct custom_visitor_args {
You can’t perform that action at this time.
0 commit comments