Skip to content

Commit ed05eba

Browse files
committed
Clarify behavior of GET* vs Get*
1 parent e059d66 commit ed05eba

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Doc/c-api/structures.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,29 +524,36 @@ definition with the same method name.
524524
Get the function's flags on *func* as they were passed to
525525
:c:member:`~PyMethodDef.ml_flags`.
526526
527+
If *func* is not a C function object, this fails with a
528+
:class:`SystemError`.
529+
527530
This function returns the function's flags on success, and ``-1`` with an
528531
exception set on failure.
529532
530533
531534
.. c:function:: int PyCFunction_GET_FLAGS(PyObject *func)
532535
533536
This is the same as :c:func:`PyCFunction_GetFlags`, but without error
534-
checking.
537+
or type checking.
535538
536539
537540
.. c:function:: PyCFunction PyCFunction_GetFunction(PyObject *func)
538541
539542
Get the function pointer on *func* as it was passed to
540543
:c:member:`~PyMethodDef.ml_meth`.
541544
545+
If *func* is not a C function object, this fails with a
546+
:class:`SystemError`.
547+
542548
This function returns the function pointer on success, and ``NULL`` with an
543549
exception set on failure.
544550
545551
552+
546553
.. c:function:: int PyCFunction_GET_FUNCTION(PyObject *func)
547554
548555
This is the same as :c:func:`PyCFunction_GetFunction`, but without error
549-
checking.
556+
or type checking.
550557
551558
552559
.. c:function:: PyObject *PyCFunction_GetSelf(PyObject *func)
@@ -555,14 +562,17 @@ definition with the same method name.
555562
to the first argument of a :c:type:`PyCFunction`. In modules, this is the
556563
module object.
557564
565+
If *func* is not a C function object, this fails with a
566+
:class:`SystemError`.
567+
558568
This function returns a :term:`borrowed reference` to the "self" object
559569
on success, and ``NULL`` with an exception set on failure.
560570
561571
562572
.. c:function:: PyObject *PyCFunction_GET_SELF(PyObject *func)
563573
564-
This is the same as :c:func:`PyCFunction_GetSelf`, but without error
565-
checking.
574+
This is the same as :c:func:`PyCFunction_GetSelf`, but without error or
575+
type checking.
566576
567577
568578
Accessing attributes of extension types

0 commit comments

Comments
 (0)