Skip to content

Commit 73d03e8

Browse files
Add docstrings to new functions in public_api.h.
- Move functions to be consistent with reference file comments (i.e. `abstract.h`). - Additionally, add a bit more body to the HPyIter_Next test method.
1 parent 4fd7e7e commit 73d03e8

File tree

10 files changed

+197
-143
lines changed

10 files changed

+197
-143
lines changed

hpy/debug/src/autogen_debug_ctx_init.h

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hpy/debug/src/autogen_debug_wrappers.c

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hpy/devel/include/hpy/cpython/autogen_api_impl.h

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hpy/devel/include/hpy/universal/autogen_trampolines.h

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hpy/tools/autogen/public_api.h

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,56 @@ HPy HPy_Call(HPyContext *ctx, HPy callable, const HPy *args, size_t nargs, HPy k
307307
HPy_ID(262)
308308
HPy HPy_CallMethod(HPyContext *ctx, HPy name, const HPy *args, size_t nargs, HPy kwnames);
309309

310+
/**
311+
* Return a new iterator for iterable object ``obj``. This is the equivalent
312+
* of the Python expression ``iter(obj)``.
313+
*
314+
* :param ctx:
315+
* The execution context.
316+
* :param obj:
317+
* An iterable Python object (must not be ``HPy_NULL``). If the object is
318+
* not iterable, a ``TypeError`` will be raised.
319+
*
320+
* :returns:
321+
* The new iterator, ``obj`` itself if it is already an iterator, or
322+
* ``HPy_NULL`` on failure.
323+
*/
324+
HPy_ID(269)
325+
HPy HPy_GetIter(HPyContext *ctx, HPy obj);
326+
327+
/**
328+
* Return the next value from iterator ``obj``.
329+
*
330+
* :param ctx:
331+
* The execution context.
332+
* :param obj:
333+
* An iterator Python object (must not be ``HPy_NULL``). This can be
334+
* verified with ``HPy_IterCheck``. Otherwise, the behavior is undefined
335+
* (verification of the argument is only done in debug mode).
336+
*
337+
* :returns:
338+
* The new value in iterator ``obj``, or ``HPy_NULL`` on failure. If the
339+
* iterator was exhausted normally, an exception will not be set. In
340+
* case of some other error, one will be set.
341+
*/
342+
HPy_ID(270)
343+
HPy HPyIter_Next(HPyContext *ctx, HPy obj);
344+
345+
/**
346+
* Tests if an object is an instance of a Python iterator.
347+
*
348+
* :param ctx:
349+
* The execution context.
350+
* :param obj:
351+
* A handle to an arbitrary object (must not be ``HPy_NULL``).
352+
*
353+
* :returns:
354+
* Non-zero if object ``h`` provides the ``Iterator`` protocol, and ``0``
355+
* otherwise.
356+
*/
357+
HPy_ID(271)
358+
int HPyIter_Check(HPyContext *ctx, HPy obj);
359+
310360
/* pyerrors.h */
311361
HPy_ID(136)
312362
void HPy_FatalError(HPyContext *ctx, const char *message);
@@ -502,15 +552,6 @@ int HPy_DelItem_s(HPyContext *ctx, HPy obj, const char *utf8_key);
502552
HPy_ID(268)
503553
int HPy_DelSlice(HPyContext *ctx, HPy obj, HPy_ssize_t start, HPy_ssize_t end);
504554

505-
HPy_ID(269)
506-
HPy HPy_GetIter(HPyContext *ctx, HPy obj);
507-
508-
HPy_ID(270)
509-
HPy HPyIter_Next(HPyContext *ctx, HPy obj);
510-
511-
HPy_ID(271)
512-
int HPyIter_Check(HPyContext *ctx, HPy obj);
513-
514555
/**
515556
* Returns the type of the given object ``obj``.
516557
*

hpy/trace/src/autogen_trace_ctx_init.h

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)