@@ -383,15 +383,15 @@ as calling functions with a fixed number of parameters. On some platforms, and i
383383particular ARM64 for Apple Platforms, the calling convention for variadic functions
384384is different than that for regular functions.
385385
386- On those platforms it is required to specify the :attr: `~_FuncPtr .argtypes `
386+ On those platforms it is required to specify the :attr: `~_CFuncPtr .argtypes `
387387attribute for the regular, non-variadic, function arguments:
388388
389389.. code-block :: python3 
390390
391391   libc.printf.argtypes = [ctypes.c_char_p] 
392392
393393 Because specifying the attribute does not inhibit portability it is advised to always
394- specify :attr: `~_FuncPtr .argtypes ` for all variadic functions.
394+ specify :attr: `~_CFuncPtr .argtypes ` for all variadic functions.
395395
396396
397397.. _ctypes-calling-functions-with-own-custom-data-types :
@@ -426,9 +426,9 @@ Specifying the required argument types (function prototypes)
426426^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
427427
428428It is possible to specify the required argument types of functions exported from
429- DLLs by setting the :attr: `~_FuncPtr .argtypes ` attribute.
429+ DLLs by setting the :attr: `~_CFuncPtr .argtypes ` attribute.
430430
431- :attr: `~_FuncPtr .argtypes ` must be a sequence of C data types (the :func: `!printf ` function is
431+ :attr: `~_CFuncPtr .argtypes ` must be a sequence of C data types (the :func: `!printf ` function is
432432probably not a good example here, because it takes a variable number and
433433different types of parameters depending on the format string, on the other hand
434434this is quite handy to experiment with this feature)::
@@ -453,7 +453,7 @@ prototype for a C function), and tries to convert the arguments to valid types::
453453
454454If you have defined your own classes which you pass to function calls, you have
455455to implement a :meth: `~_CData.from_param ` class method for them to be able to use them
456- in the :attr: `~_FuncPtr .argtypes ` sequence. The :meth: `~_CData.from_param ` class method receives
456+ in the :attr: `~_CFuncPtr .argtypes ` sequence. The :meth: `~_CData.from_param ` class method receives
457457the Python object passed to the function call, it should do a typecheck or
458458whatever is needed to make sure this object is acceptable, and then return the
459459object itself, its :attr: `!_as_parameter_ ` attribute, or whatever you want to
@@ -476,7 +476,7 @@ Return types
476476
477477
478478By default functions are assumed to return the C :c:expr: `int ` type.  Other
479- return types can be specified by setting the :attr: `~_FuncPtr .restype ` attribute of the
479+ return types can be specified by setting the :attr: `~_CFuncPtr .restype ` attribute of the
480480function object.
481481
482482The C prototype of :c:func: `time ` is ``time_t time(time_t *) ``. Because :c:type: `time_t `
@@ -485,7 +485,7 @@ specify the :attr:`!restype` attribute::
485485
486486   >>> libc.time.restype = c_time_t 
487487
488- The argument types can be specified using :attr: `~_FuncPtr .argtypes `::
488+ The argument types can be specified using :attr: `~_CFuncPtr .argtypes `::
489489
490490   >>> libc.time.argtypes = (POINTER(c_time_t),) 
491491
@@ -508,7 +508,7 @@ a string pointer and a char, and returns a pointer to a string::
508508   >>> 
509509
510510If you want to avoid the :func: `ord("x") <ord> ` calls above, you can set the
511- :attr: `~_FuncPtr .argtypes ` attribute, and the second argument will be converted from a
511+ :attr: `~_CFuncPtr .argtypes ` attribute, and the second argument will be converted from a
512512single character Python bytes object into a C char:
513513
514514.. doctest ::
@@ -527,7 +527,7 @@ single character Python bytes object into a C char:
527527   >>>
528528
529529You can also use a callable Python object (a function or a class for example) as
530- the :attr: `~_FuncPtr .restype ` attribute, if the foreign function returns an integer.  The
530+ the :attr: `~_CFuncPtr .restype ` attribute, if the foreign function returns an integer.  The
531531callable will be called with the *integer * the C function returns, and the
532532result of this call will be used as the result of your function call. This is
533533useful to check for error return values and automatically raise an exception::
@@ -555,7 +555,7 @@ get the string representation of an error code, and *returns* an exception.
555555:func: `GetLastError ` to retrieve it.
556556
557557Please note that a much more powerful error checking mechanism is available
558- through the :attr: `~_FuncPtr .errcheck ` attribute;
558+ through the :attr: `~_CFuncPtr .errcheck ` attribute;
559559see the reference manual for details.
560560
561561
@@ -863,7 +863,7 @@ Type conversions
863863^^^^^^^^^^^^^^^^ 
864864
865865Usually, ctypes does strict type checking.  This means, if you have
866- ``POINTER(c_int) `` in the :attr: `~_FuncPtr .argtypes ` list of a function or as the type of
866+ ``POINTER(c_int) `` in the :attr: `~_CFuncPtr .argtypes ` list of a function or as the type of
867867a member field in a structure definition, only instances of exactly the same
868868type are accepted.  There are some exceptions to this rule, where ctypes accepts
869869other objects.  For example, you can pass compatible array instances instead of
@@ -884,7 +884,7 @@ pointer types.  So, for ``POINTER(c_int)``, ctypes accepts an array of c_int::
884884   >>> 
885885
886886In addition, if a function argument is explicitly declared to be a pointer type
887- (such as ``POINTER(c_int) ``) in :attr: `~_FuncPtr .argtypes `, an object of the pointed
887+ (such as ``POINTER(c_int) ``) in :attr: `~_CFuncPtr .argtypes `, an object of the pointed
888888type (``c_int `` in this case) can be passed to the function.  ctypes will apply
889889the required :func: `byref ` conversion in this case automatically.
890890
@@ -1613,10 +1613,20 @@ As explained in the previous section, foreign functions can be accessed as
16131613attributes of loaded shared libraries.  The function objects created in this way
16141614by default accept any number of arguments, accept any ctypes data instances as
16151615arguments, and return the default result type specified by the library loader.
1616- They are instances of a private class:
16171616
1617+ They are instances of a private local class :class: `!_FuncPtr ` (not exposed
1618+ in :mod: `!ctypes `) which inherits from the private :class: `_CFuncPtr ` class:
16181619
1619- .. class :: _FuncPtr 
1620+ .. doctest ::
1621+ 
1622+    >>> import  ctypes
1623+    >>> lib =  ctypes.CDLL(None ) 
1624+    >>> issubclass (lib._FuncPtr, ctypes._CFuncPtr)
1625+    True 
1626+    >>> lib._FuncPtr is  ctypes._CFuncPtr 
1627+    False 
1628+ 
1629+ .. class :: _CFuncPtr 
16201630
16211631   Base class for C callable foreign functions.
16221632
@@ -1782,7 +1792,7 @@ different ways, depending on the type and number of the parameters in the call:
17821792The optional *paramflags * parameter creates foreign function wrappers with much
17831793more functionality than the features described above.
17841794
1785- *paramflags * must be a tuple of the same length as :attr: `~_FuncPtr .argtypes `.
1795+ *paramflags * must be a tuple of the same length as :attr: `~_CFuncPtr .argtypes `.
17861796
17871797Each item in this tuple contains further information about a parameter, it must
17881798be a tuple containing one, two, or three items.
@@ -1853,7 +1863,7 @@ value if there is a single one, or a tuple containing the output parameter
18531863values when there are more than one, so the GetWindowRect function now returns a
18541864RECT instance, when called.
18551865
1856- Output parameters can be combined with the :attr: `~_FuncPtr .errcheck ` protocol to do
1866+ Output parameters can be combined with the :attr: `~_CFuncPtr .errcheck ` protocol to do
18571867further output processing and error checking.  The win32 ``GetWindowRect `` api
18581868function returns a ``BOOL `` to signal success or failure, so this function could
18591869do the error checking, and raises an exception when the api call failed::
@@ -1866,7 +1876,7 @@ do the error checking, and raises an exception when the api call failed::
18661876   >>> GetWindowRect.errcheck = errcheck 
18671877   >>> 
18681878
1869- If the :attr: `~_FuncPtr .errcheck ` function returns the argument tuple it receives
1879+ If the :attr: `~_CFuncPtr .errcheck ` function returns the argument tuple it receives
18701880unchanged, :mod: `ctypes ` continues the normal processing it does on the output
18711881parameters.  If you want to return a tuple of window coordinates instead of a
18721882``RECT `` instance, you can retrieve the fields in the function and return them
@@ -2166,7 +2176,7 @@ Data types
21662176
21672177      This method adapts *obj * to a ctypes type.  It is called with the actual
21682178      object used in a foreign function call when the type is present in the
2169-       foreign function's :attr: `~_FuncPtr .argtypes ` tuple;
2179+       foreign function's :attr: `~_CFuncPtr .argtypes ` tuple;
21702180      it must return an object that can be used as a function call parameter.
21712181
21722182      All ctypes data types have a default implementation of this classmethod
@@ -2232,7 +2242,7 @@ Fundamental data types
22322242Fundamental data types, when returned as foreign function call results, or, for
22332243example, by retrieving structure field members or array items, are transparently
22342244converted to native Python types.  In other words, if a foreign function has a
2235- :attr: `~_FuncPtr .restype ` of :class: `c_char_p `, you will always receive a Python bytes
2245+ :attr: `~_CFuncPtr .restype ` of :class: `c_char_p `, you will always receive a Python bytes
22362246object, *not * a :class: `c_char_p ` instance.
22372247
22382248..  XXX above is false, it actually returns a Unicode string
0 commit comments