File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -785,16 +785,26 @@ class AtomCListHandler : public AtomListHandler
785785 {
786786 static char *kwlist[] = { " key" , " reverse" , 0 };
787787 // Get a reference to builtins (borrowed ref hence the incref)
788- cppy::ptr builtins ( cppy::incref ( PyImport_AddModule (" builtins" ) ) );
788+ cppy::ptr builtins ( cppy::xincref ( PyImport_AddModule (" builtins" ) ) );
789+ if ( !builtins )
790+ return 0 ;
789791 cppy::ptr super_type ( builtins.getattr ( " super" ) );
792+ if ( !super_type )
793+ return 0 ;
790794 // Create super args (tuple steals references)
791795 cppy::ptr super_args ( PyTuple_New (2 ) );
796+ if ( !super_args )
797+ return 0 ;
792798 PyTuple_SET_ITEM ( super_args.get (), 0 , cppy::incref ( pyobject_cast ( Py_TYPE (m_list.get ()) ) ) );
793799 PyTuple_SET_ITEM ( super_args.get (), 1 , cppy::incref ( m_list.get () ) );
794800
795801 // Get and call super method
796802 cppy::ptr super ( super_type.call ( super_args ) );
803+ if ( !super )
804+ return 0 ;
797805 cppy::ptr meth ( super.getattr ( " sort" ) );
806+ if ( !meth )
807+ return 0 ;
798808 cppy::ptr res ( meth.call (args, kwargs) );
799809 if ( !res )
800810 return 0 ;
You can’t perform that action at this time.
0 commit comments