From 5376af452f55a0853f36da07ad9d009dad5def70 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 5 Nov 2021 15:46:23 -0700 Subject: [PATCH] Added comments to new public functions. --- python/descriptor_containers.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/python/descriptor_containers.h b/python/descriptor_containers.h index 9ce75508cd..6991b2c4ab 100644 --- a/python/descriptor_containers.h +++ b/python/descriptor_containers.h @@ -61,6 +61,10 @@ typedef struct { PyObject *(*get_elem_wrapper)(const void *elem); } PyUpb_GenericSequence_Funcs; +// Returns a new GenericSequence. The vtable `funcs` must outlive this object +// (generally it should be static). The GenericSequence will take a ref on +// `parent_obj`, which must be sufficient to keep `parent` alive. The object +// `parent` will be passed as an argument to the functions in `funcs`. PyObject *PyUpb_GenericSequence_New(const PyUpb_GenericSequence_Funcs *funcs, const void *parent, PyObject *parent_obj); @@ -78,6 +82,10 @@ typedef struct { const char *(*get_elem_name)(const void *elem); } PyUpb_ByNameMap_Funcs; +// Returns a new ByNameMap. The vtable `funcs` must outlive this object +// (generally it should be static). The ByNameMap will take a ref on +// `parent_obj`, which must be sufficient to keep `parent` alive. The object +// `parent` will be passed as an argument to the functions in `funcs`. PyObject *PyUpb_ByNameMap_New(const PyUpb_ByNameMap_Funcs *funcs, const void *parent, PyObject *parent_obj); @@ -95,6 +103,10 @@ typedef struct { int (*get_elem_num)(const void *elem); } PyUpb_ByNumberMap_Funcs; +// Returns a new ByNumberMap. The vtable `funcs` must outlive this object +// (generally it should be static). The ByNumberMap will take a ref on +// `parent_obj`, which must be sufficient to keep `parent` alive. The object +// `parent` will be passed as an argument to the functions in `funcs`. PyObject *PyUpb_ByNumberMap_New(const PyUpb_ByNumberMap_Funcs *funcs, const void *parent, PyObject *parent_obj);