parameters: (typingctx, l, index, op)
return_statement: return sig, codegen
docstring: Wrap numba_list_getitem and numba_list_pop
  
      Returns 2-tuple of (intp, ?item_type)
  
      This is a helper that is parametrized on the type of operation, which can
      be either 'pop' or 'getitem'. This is because, signature wise, getitem and
      pop and are the same.
docstring_summary: Wrap numba_list_getitem and numba_list_pop
docstring_tokens: Wrap numba_list_getitem and numba_list_pop
function: def _list_getitem_pop_helper(typingctx, l, index, op):
      """Wrap numba_list_getitem and numba_list_pop
  
      Returns 2-tuple of (intp, ?item_type)
  
      This is a helper that is parametrized on the type of operation, which can
      be either 'pop' or 'getitem'. This is because, signature wise, getitem and
      pop and are the same.
      """
      assert(op in ("pop", "getitem"))
      resty = types.Tuple([types.int32, types.Optional(l.item_type)])
      sig = resty(l, index)
  
      def codegen(context, builder, sig, args):
          fnty = ir.FunctionType(
              ll_status,
              [ll_list_type, ll_ssize_t, ll_bytes],
          )
          [tl, tindex] = sig.args
          [l, index] = args
          fn = builder.module.get_or_insert_function(
              fnty, name='numba_list_{}'.format(op))
  
          dm_item = context.data_model_manager[tl.item_type]
          ll_item = context.get_data_type(tl.item_type)
          ptr_item = cgutils.alloca_once(builder, ll_item)
  
          lp = _container_get_data(context, builder, tl, l)
          status = builder.call(
              fn,
              [
                  lp,
                  index,
                  _as_bytes(builder, ptr_item),
              ],
          )
          # Load item if output is available
          found = builder.icmp_signed('>=', status,
                                      status.type(int(ListStatus.LIST_OK)))
  
          out = context.make_optional_none(builder, tl.item_type)
          pout = cgutils.alloca_once_value(builder, out)
  
          with builder.if_then(found):
              item = dm_item.load_from_data_pointer(builder, ptr_item)
              context.nrt.incref(builder, tl.item_type, item)
              loaded = context.make_optional_value(builder, tl.item_type, item)
              builder.store(loaded, pout)
  
          out = builder.load(pout)
          return context.make_tuple(builder, resty, [status, out])
  
      return sig, codegen
function_tokens: def _list_getitem_pop_helper ( typingctx , l , index , op ) : assert ( op in ( "pop" , "getitem" ) ) resty = types . Tuple ( [ types . int32 , types . Optional ( l . item_type ) ] ) sig = resty ( l , index ) def codegen ( context , builder , sig , args ) : fnty = ir . FunctionType ( ll_status , [ ll_list_type , ll_ssize_t , ll_bytes ] , ) [ tl , tindex ] = sig . args [ l , index ] = args fn = builder . module . get_or_insert_function ( fnty , name = 'numba_list_{}' . format ( op ) ) dm_item = context . data_model_manager [ tl . item_type ] ll_item = context . get_data_type ( tl . item_type ) ptr_item = cgutils . alloca_once ( builder , ll_item ) lp = _container_get_data ( context , builder , tl , l ) status = builder . call ( fn , [ lp , index , _as_bytes ( builder , ptr_item ) , ] , ) # Load item if output is available found = builder . icmp_signed ( '>=' , status , status . type ( int ( ListStatus . LIST_OK ) ) ) out = context . make_optional_none ( builder , tl . item_type ) pout = cgutils . alloca_once_value ( builder , out ) with builder . if_then ( found ) : item = dm_item . load_from_data_pointer ( builder , ptr_item ) context . nrt . incref ( builder , tl . item_type , item ) loaded = context . make_optional_value ( builder , tl . item_type , item ) builder . store ( loaded , pout ) out = builder . load ( pout ) return context . make_tuple ( builder , resty , [ status , out ] ) return sig , codegen