chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
77d58b48-a7d4-4b00-825e-41daa0ea3443 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,084 | supabase-export-v2 | f9345b3d7b2ebb37 | collect (from 0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. The sum of collected objects and uncollectable objects is returned.
The free lists maintained for a number of built-in types are cleared
whenever a full collection or collection of the highest generation (2)
is run. Not all item... | trusted_official_docs | CPython Docs | collect (from 0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. The sum of collected objects and uncollectable objects is returned.
The free lists maintained for a number of built-in types are cleared
whenever a full collection or collection of the highest generation (2)
is run. Not all item... | collect (from 0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. The sum of collected objects and uncollectable objects is returned.
The free lists maintained for a number of built-in types are cleared
whenever a full collection or collection of the highest generation (2)
is run. Not all item... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7b730304-3803-498a-80dc-ada4bf8482a2 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,128 | supabase-export-v2 | 7c866ff8ae8ea6cb | .. function:: is_tracked(obj)
Returns ``True`` if the object is currently tracked by the garbage collector,
``False`` otherwise. As a general rule, instances of atomic types aren't
tracked and instances of non-atomic types (containers, user-defined
objects...) are. However, some type-specific optimizations can be pr... | trusted_official_docs | CPython Docs | .. function:: is_tracked(obj)
Returns ``True`` if the object is currently tracked by the garbage collector,
``False`` otherwise. As a general rule, instances of atomic types aren't
tracked and instances of non-atomic types (containers, user-defined
objects...) are. However, some type-specific optimizations can be pr... | .. function:: is_tracked(obj)
Returns ``True`` if the object is currently tracked by the garbage collector,
``False`` otherwise. As a general rule, instances of atomic types aren't
tracked and instances of non-atomic types (containers, user-defined
objects...) are. However, some type-specific optimizations can be pr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c365d26-e7c9-4364-b49f-184c923228b9 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,136 | supabase-export-v2 | 66b9fbcda613d6c1 | Freeze all the objects tracked by the garbage collector; move them to a permanent generation and ignore them in all the future collections.
If a process will ``fork()`` without ``exec()``, avoiding unnecessary
copy-on-write in child processes will maximize memory sharing and reduce
overall memory usage. This requires... | trusted_official_docs | CPython Docs | Freeze all the objects tracked by the garbage collector; move them to a permanent generation and ignore them in all the future collections.
If a process will ``fork()`` without ``exec()``, avoiding unnecessary
copy-on-write in child processes will maximize memory sharing and reduce
overall memory usage. This requires... | Freeze all the objects tracked by the garbage collector; move them to a permanent generation and ignore them in all the future collections.
If a process will ``fork()`` without ``exec()``, avoiding unnecessary
copy-on-write in child processes will maximize memory sharing and reduce
overall memory usage. This requires... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7df47e0e-1e34-4a03-bf4b-e0e7d48b2917 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,109 | supabase-export-v2 | c947e64abed5dddd | Set the garbage collection thresholds (the collection frequency). Setting *threshold0* to zero disables collection.
The GC classifies objects into three generations depending on how many
collection sweeps they have survived. New objects are placed in the youngest
generation (generation ``0``). If an object survives a... | trusted_official_docs | CPython Docs | Set the garbage collection thresholds (the collection frequency). Setting *threshold0* to zero disables collection.
The GC classifies objects into three generations depending on how many
collection sweeps they have survived. New objects are placed in the youngest
generation (generation ``0``). If an object survives a... | Set the garbage collection thresholds (the collection frequency). Setting *threshold0* to zero disables collection.
The GC classifies objects into three generations depending on how many
collection sweeps they have survived. New objects are placed in the youngest
generation (generation ``0``). If an object survives a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7ed9cac8-28c3-4e2f-8e7a-55578f97566a | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,171 | supabase-export-v2 | 5592e07c1eea3597 | .. data:: DEBUG_UNCOLLECTABLE
Print information of uncollectable objects found (objects which are not
reachable but cannot be freed by the collector). These objects will be added
to the ``garbage`` list. | trusted_official_docs | CPython Docs | .. data:: DEBUG_UNCOLLECTABLE
Print information of uncollectable objects found (objects which are not
reachable but cannot be freed by the collector). These objects will be added
to the ``garbage`` list. | .. data:: DEBUG_UNCOLLECTABLE
Print information of uncollectable objects found (objects which are not
reachable but cannot be freed by the collector). These objects will be added
to the ``garbage`` list. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7f2f0d86-d161-49b6-8847-f9bf09d9e4da | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,093 | supabase-export-v2 | 159fd021edf75fc2 | .. function:: get_objects(generation=None)
Returns a list of all objects tracked by the collector, excluding the list
returned. If *generation* is not ``None``, return only the objects tracked by
the collector that are in that generation. | trusted_official_docs | CPython Docs | .. function:: get_objects(generation=None)
Returns a list of all objects tracked by the collector, excluding the list
returned. If *generation* is not ``None``, return only the objects tracked by
the collector that are in that generation. | .. function:: get_objects(generation=None)
Returns a list of all objects tracked by the collector, excluding the list
returned. If *generation* is not ``None``, return only the objects tracked by
the collector that are in that generation. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
800e2d2d-745b-40d7-b392-07a673605d18 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,126 | supabase-export-v2 | 91c61a17d915c001 | cycle. So, for example, if an integer is directly reachable from an argument, that integer object may or may not appear in the result list.
.. audit-event:: gc.get_referents objs gc.get_referents | trusted_official_docs | CPython Docs | cycle. So, for example, if an integer is directly reachable from an argument, that integer object may or may not appear in the result list.
.. audit-event:: gc.get_referents objs gc.get_referents | cycle. So, for example, if an integer is directly reachable from an argument, that integer object may or may not appear in the result list.
.. audit-event:: gc.get_referents objs gc.get_referents | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80ed0a3c-6a68-400d-8dbe-bfa18a964d14 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,103 | supabase-export-v2 | 16d72f1e455f180b | * ``uncollectable`` is the total number of objects which were found to be uncollectable (and were therefore moved to the :data:`garbage` list) inside this generation;
* ``candidates`` is the total number of objects in this generation which were
considered for collection and traversed; | trusted_official_docs | CPython Docs | * ``uncollectable`` is the total number of objects which were found to be uncollectable (and were therefore moved to the :data:`garbage` list) inside this generation;
* ``candidates`` is the total number of objects in this generation which were
considered for collection and traversed; | * ``uncollectable`` is the total number of objects which were found to be uncollectable (and were therefore moved to the :data:`garbage` list) inside this generation;
* ``candidates`` is the total number of objects in this generation which were
considered for collection and traversed; | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89bb1579-027a-43d8-8bab-fe168ec9eeed | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,083 | supabase-export-v2 | ccd78d83ee83bf4f | .. function:: collect(generation=2)
With no arguments, run a full collection. The optional argument *generation*
may be an integer specifying which generation to collect (from 0 to 2). A
:exc:`ValueError` is raised if the generation number is invalid. The sum of
collected objects and uncollectable objects is returne... | trusted_official_docs | CPython Docs | .. function:: collect(generation=2)
With no arguments, run a full collection. The optional argument *generation*
may be an integer specifying which generation to collect (from 0 to 2). A
:exc:`ValueError` is raised if the generation number is invalid. The sum of
collected objects and uncollectable objects is returne... | .. function:: collect(generation=2)
With no arguments, run a full collection. The optional argument *generation*
may be an integer specifying which generation to collect (from 0 to 2). A
:exc:`ValueError` is raised if the generation number is invalid. The sum of
collected objects and uncollectable objects is returne... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
91d6c18b-7f58-479c-ac80-c92dc2522ddd | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,102 | supabase-export-v2 | 95e4670e31fa56cb | * ``collected`` is the total number of objects collected inside this generation;
* ``uncollectable`` is the total number of objects which were found
to be uncollectable (and were therefore moved to the :data:`garbage`
list) inside this generation; | trusted_official_docs | CPython Docs | * ``collected`` is the total number of objects collected inside this generation;
* ``uncollectable`` is the total number of objects which were found
to be uncollectable (and were therefore moved to the :data:`garbage`
list) inside this generation; | * ``collected`` is the total number of objects collected inside this generation;
* ``uncollectable`` is the total number of objects which were found
to be uncollectable (and were therefore moved to the :data:`garbage`
list) inside this generation; | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
95894cde-7bbc-4a03-9036-e74710ed8095 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,111 | supabase-export-v2 | 8bfbfc36e5d967d6 | With the third generation, things are a bit more complicated, see `Collecting the oldest generation <https://github.com/python/cpython/blob/ff0ef0a54bef26fc507fbf9b7a6009eb7d3f17f5/InternalDocs/garbage_collector.md#collecting-the-oldest-generation>`_ for more information.
In the free-threaded build, the increase in pro... | trusted_official_docs | CPython Docs | With the third generation, things are a bit more complicated, see `Collecting the oldest generation <https://github.com/python/cpython/blob/ff0ef0a54bef26fc507fbf9b7a6009eb7d3f17f5/InternalDocs/garbage_collector.md#collecting-the-oldest-generation>`_ for more information.
In the free-threaded build, the increase in pro... | With the third generation, things are a bit more complicated, see `Collecting the oldest generation <https://github.com/python/cpython/blob/ff0ef0a54bef26fc507fbf9b7a6009eb7d3f17f5/InternalDocs/garbage_collector.md#collecting-the-oldest-generation>`_ for more information.
In the free-threaded build, the increase in pro... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a24df1af-4f35-404e-b423-1f8f312c32bd | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,151 | supabase-export-v2 | 8b72c28f00e4a2b5 | of callbacks that will be invoked by the garbage collector before and after collection. The callbacks will be called with two arguments, *phase* and *info*.
*phase* can be one of two values: | trusted_official_docs | CPython Docs | of callbacks that will be invoked by the garbage collector before and after collection. The callbacks will be called with two arguments, *phase* and *info*.
*phase* can be one of two values: | of callbacks that will be invoked by the garbage collector before and after collection. The callbacks will be called with two arguments, *phase* and *info*.
*phase* can be one of two values: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bff078ae-1a53-4892-bee8-e1f6b8f3639f | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,129 | supabase-export-v2 | 3db37f6ea1cedf12 | some type-specific optimizations can be present in order to suppress the garbage collector footprint of simple instances (e.g. dicts containing only atomic keys and values)::
>>> gc.is_tracked(0)
False
>>> gc.is_tracked("a")
False
>>> gc.is_tracked([])
True
>>> gc.is_tracked({})
False
>>> gc.is_tracked({"a": 1}... | trusted_official_docs | CPython Docs | some type-specific optimizations can be present in order to suppress the garbage collector footprint of simple instances (e.g. dicts containing only atomic keys and values)::
>>> gc.is_tracked(0)
False
>>> gc.is_tracked("a")
False
>>> gc.is_tracked([])
True
>>> gc.is_tracked({})
False
>>> gc.is_tracked({"a": 1}... | some type-specific optimizations can be present in order to suppress the garbage collector footprint of simple instances (e.g. dicts containing only atomic keys and values)::
>>> gc.is_tracked(0)
False
>>> gc.is_tracked("a")
False
>>> gc.is_tracked([])
True
>>> gc.is_tracked({})
False
>>> gc.is_tracked({"a": 1}... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d1e9e6b4-abb1-403f-b682-0be2d290c57f | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,075 | supabase-export-v2 | 630b97c81392ad22 | by calling ``gc.disable()``. To debug a leaking program call ``gc.set_debug(gc.DEBUG_LEAK)``. Notice that this includes ``gc.DEBUG_SAVEALL``, causing garbage-collected objects to be saved in gc.garbage for inspection.
The :mod:`!gc` module provides the following functions: | trusted_official_docs | CPython Docs | by calling ``gc.disable()``. To debug a leaking program call ``gc.set_debug(gc.DEBUG_LEAK)``. Notice that this includes ``gc.DEBUG_SAVEALL``, causing garbage-collected objects to be saved in gc.garbage for inspection.
The :mod:`!gc` module provides the following functions: | by calling ``gc.disable()``. To debug a leaking program call ``gc.set_debug(gc.DEBUG_LEAK)``. Notice that this includes ``gc.DEBUG_SAVEALL``, causing garbage-collected objects to be saved in gc.garbage for inspection.
The :mod:`!gc` module provides the following functions: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
de15e52a-65de-4d47-8ba4-f87dfff5eb2d | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,110 | supabase-export-v2 | 8cb2f412c140ccf5 | is examined. If generation ``0`` has been examined more than *threshold1* times since generation ``1`` has been examined, then generation ``1`` is examined as well.
With the third generation, things are a bit more complicated,
see `Collecting the oldest generation <https://github.com/python/cpython/blob/ff0ef0a54bef26... | trusted_official_docs | CPython Docs | is examined. If generation ``0`` has been examined more than *threshold1* times since generation ``1`` has been examined, then generation ``1`` is examined as well.
With the third generation, things are a bit more complicated,
see `Collecting the oldest generation <https://github.com/python/cpython/blob/ff0ef0a54bef26... | is examined. If generation ``0`` has been examined more than *threshold1* times since generation ``1`` has been examined, then generation ``1`` is examined as well.
With the third generation, things are a bit more complicated,
see `Collecting the oldest generation <https://github.com/python/cpython/blob/ff0ef0a54bef26... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e0811de2-bdd3-4b6c-bc15-40b1a799c9e4 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,150 | supabase-export-v2 | 8c6a8b1c7817d763 | .. data:: callbacks
A list of callbacks that will be invoked by the garbage collector before and
after collection. The callbacks will be called with two arguments,
*phase* and *info*. | trusted_official_docs | CPython Docs | .. data:: callbacks
A list of callbacks that will be invoked by the garbage collector before and
after collection. The callbacks will be called with two arguments,
*phase* and *info*. | .. data:: callbacks
A list of callbacks that will be invoked by the garbage collector before and
after collection. The callbacks will be called with two arguments,
*phase* and *info*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e2e87217-776d-4dee-a356-6f6ec7f0f44b | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,120 | supabase-export-v2 | 3a3378a40a3ba276 | .. function:: get_referrers(*objs)
Return the list of objects that directly refer to any of objs. This function
will only locate those containers which support garbage collection; extension
types which do refer to other objects but do not support garbage collection will
not be found. | trusted_official_docs | CPython Docs | .. function:: get_referrers(*objs)
Return the list of objects that directly refer to any of objs. This function
will only locate those containers which support garbage collection; extension
types which do refer to other objects but do not support garbage collection will
not be found. | .. function:: get_referrers(*objs)
Return the list of objects that directly refer to any of objs. This function
will only locate those containers which support garbage collection; extension
types which do refer to other objects but do not support garbage collection will
not be found. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e348210b-b9d3-4274-a9b4-431cff20b8f7 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,100 | supabase-export-v2 | 234657f70678e968 | dictionaries containing collection statistics since interpreter start. The number of keys may change in the future, but currently each dictionary will contain the following items:
* ``collections`` is the number of times this generation was collected; | trusted_official_docs | CPython Docs | dictionaries containing collection statistics since interpreter start. The number of keys may change in the future, but currently each dictionary will contain the following items:
* ``collections`` is the number of times this generation was collected; | dictionaries containing collection statistics since interpreter start. The number of keys may change in the future, but currently each dictionary will contain the following items:
* ``collections`` is the number of times this generation was collected; | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e994b160-76cf-4715-9e10-9d0d87ce4184 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,145 | supabase-export-v2 | f970f9adca7f9e8d | .. data:: garbage
A list of objects which the collector found to be unreachable but could
not be freed (uncollectable objects). Starting with Python 3.4, this
list should be empty most of the time, except when using instances of
C extension types with a non-``NULL`` ``tp_del`` slot. | trusted_official_docs | CPython Docs | .. data:: garbage
A list of objects which the collector found to be unreachable but could
not be freed (uncollectable objects). Starting with Python 3.4, this
list should be empty most of the time, except when using instances of
C extension types with a non-``NULL`` ``tp_del`` slot. | .. data:: garbage
A list of objects which the collector found to be unreachable but could
not be freed (uncollectable objects). Starting with Python 3.4, this
list should be empty most of the time, except when using instances of
C extension types with a non-``NULL`` ``tp_del`` slot. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ec75016b-eade-43bd-a243-7088d5dd97cf | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,094 | supabase-export-v2 | fdea22496a0df6d3 | by the collector, excluding the list returned. If *generation* is not ``None``, return only the objects tracked by the collector that are in that generation.
.. versionchanged:: 3.8
New *generation* parameter. | trusted_official_docs | CPython Docs | by the collector, excluding the list returned. If *generation* is not ``None``, return only the objects tracked by the collector that are in that generation.
.. versionchanged:: 3.8
New *generation* parameter. | by the collector, excluding the list returned. If *generation* is not ``None``, return only the objects tracked by the collector that are in that generation.
.. versionchanged:: 3.8
New *generation* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6ff83b6-21df-45a5-a4cc-5134609d9fe7 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,172 | supabase-export-v2 | ed5d38e961109f26 | of uncollectable objects found (objects which are not reachable but cannot be freed by the collector). These objects will be added to the ``garbage`` list.
.. versionchanged:: 3.2
Also print the contents of the :data:`garbage` list at
:term:`interpreter shutdown`, if it isn't empty. | trusted_official_docs | CPython Docs | of uncollectable objects found (objects which are not reachable but cannot be freed by the collector). These objects will be added to the ``garbage`` list.
.. versionchanged:: 3.2
Also print the contents of the :data:`garbage` list at
:term:`interpreter shutdown`, if it isn't empty. | of uncollectable objects found (objects which are not reachable but cannot be freed by the collector). These objects will be added to the ``garbage`` list.
.. versionchanged:: 3.2
Also print the contents of the :data:`garbage` list at
:term:`interpreter shutdown`, if it isn't empty. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8b5e439-4f74-4d42-a33b-c7e8f6eaa306 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,104 | supabase-export-v2 | 58239ebf2ee15619 | * ``candidates`` is the total number of objects in this generation which were considered for collection and traversed;
* ``duration`` is the total time in seconds spent in collections for this
generation. | trusted_official_docs | CPython Docs | * ``candidates`` is the total number of objects in this generation which were considered for collection and traversed;
* ``duration`` is the total time in seconds spent in collections for this
generation. | * ``candidates`` is the total number of objects in this generation which were considered for collection and traversed;
* ``duration`` is the total time in seconds spent in collections for this
generation. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fa45b593-c8dd-490c-b090-29f68dbbeab1 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,112 | supabase-export-v2 | f7cfd0943e9684d2 | increased by 10% since the last collection and the net number of object allocations has not exceeded 40 times *threshold0*, the collection is not run.
See `Garbage collector design <https://github.com/python/cpython/blob/3.15/InternalDocs/garbage_collector.md>`_ for more information. | trusted_official_docs | CPython Docs | increased by 10% since the last collection and the net number of object allocations has not exceeded 40 times *threshold0*, the collection is not run.
See `Garbage collector design <https://github.com/python/cpython/blob/3.15/InternalDocs/garbage_collector.md>`_ for more information. | increased by 10% since the last collection and the net number of object allocations has not exceeded 40 times *threshold0*, the collection is not run.
See `Garbage collector design <https://github.com/python/cpython/blob/3.15/InternalDocs/garbage_collector.md>`_ for more information. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff68bc77-df0e-4bf4-8d90-47419bace926 | CPython Docs | file://datasets/cpython/Doc/library/gc.rst | unknown | 1fe0607f-d1de-49f4-8e4b-fa885112b691 | 39,122 | supabase-export-v2 | c94b80a06f254335 | yet been collected by the garbage collector can be listed among the resulting referrers. To get only currently live objects, call :func:`collect` before calling :func:`get_referrers`.
.. warning::
Care must be taken when using objects returned by :func:`get_referrers` because
some of them could still be under constru... | trusted_official_docs | CPython Docs | yet been collected by the garbage collector can be listed among the resulting referrers. To get only currently live objects, call :func:`collect` before calling :func:`get_referrers`.
.. warning::
Care must be taken when using objects returned by :func:`get_referrers` because
some of them could still be under constru... | yet been collected by the garbage collector can be listed among the resulting referrers. To get only currently live objects, call :func:`collect` before calling :func:`get_referrers`.
.. warning::
Care must be taken when using objects returned by :func:`get_referrers` because
some of them could still be under constru... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0030dfb0-aecc-486a-95bf-6d86e3cb3388 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,554 | supabase-export-v2 | 79473b270c0f46fa | by default accept any number of arguments, accept any ctypes data instances as arguments, and return the default result type specified by the library loader.
They are instances of a private local class :class:`!_FuncPtr` (not exposed
in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class: | trusted_official_docs | CPython Docs | by default accept any number of arguments, accept any ctypes data instances as arguments, and return the default result type specified by the library loader.
They are instances of a private local class :class:`!_FuncPtr` (not exposed
in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class: | by default accept any number of arguments, accept any ctypes data instances as arguments, and return the default result type specified by the library loader.
They are instances of a private local class :class:`!_FuncPtr` (not exposed
in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
00638369-39e5-443f-bc3b-3c96e5333eca | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,268 | supabase-export-v2 | 8645be2c073004da | >>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double] >>> printf(b"String '%s', Int %d, Double %f\n", b"Hi", 10, 2.2) String 'Hi', Int 10, Double 2.200000 37 >>>
Specifying a format protects against incompatible argument types (just as a
prototype for a C function), and tries to convert the arguments to valid typ... | trusted_official_docs | CPython Docs | >>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double] >>> printf(b"String '%s', Int %d, Double %f\n", b"Hi", 10, 2.2) String 'Hi', Int 10, Double 2.200000 37 >>>
Specifying a format protects against incompatible argument types (just as a
prototype for a C function), and tries to convert the arguments to valid typ... | >>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double] >>> printf(b"String '%s', Int %d, Double %f\n", b"Hi", 10, 2.2) String 'Hi', Int 10, Double 2.200000 37 >>>
Specifying a format protects against incompatible argument types (just as a
prototype for a C function), and tries to convert the arguments to valid typ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
00f16878-21b2-4885-8726-39737173af08 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,539 | supabase-export-v2 | 5490a6738a82e873 | >>> from ctypes.util import find_library >>> find_library("c") '/usr/lib/libc.dylib' >>> find_library("m") '/usr/lib/libm.dylib' >>> find_library("bz2") '/usr/lib/libbz2.dylib' >>> find_library("AGL") '/System/Library/Frameworks/AGL.framework/AGL' >>>
On Windows, :func:`!find_library` searches along the system search p... | trusted_official_docs | CPython Docs | >>> from ctypes.util import find_library >>> find_library("c") '/usr/lib/libc.dylib' >>> find_library("m") '/usr/lib/libm.dylib' >>> find_library("bz2") '/usr/lib/libbz2.dylib' >>> find_library("AGL") '/System/Library/Frameworks/AGL.framework/AGL' >>>
On Windows, :func:`!find_library` searches along the system search p... | >>> from ctypes.util import find_library >>> find_library("c") '/usr/lib/libc.dylib' >>> find_library("m") '/usr/lib/libm.dylib' >>> find_library("bz2") '/usr/lib/libbz2.dylib' >>> find_library("AGL") '/System/Library/Frameworks/AGL.framework/AGL' >>>
On Windows, :func:`!find_library` searches along the system search p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
01659e37-39c1-47a9-8f6d-bc20388f90ef | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,392 | supabase-export-v2 | a4c31ea6bd0e6e04 | types for callback functions using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` factory function creates types for callback functions using the ``stdcall`` calling convention.
Both of these factory functions are called with the result type as first
argument, and the callback functions expected ... | trusted_official_docs | CPython Docs | types for callback functions using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` factory function creates types for callback functions using the ``stdcall`` calling convention.
Both of these factory functions are called with the result type as first
argument, and the callback functions expected ... | types for callback functions using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` factory function creates types for callback functions using the ``stdcall`` calling convention.
Both of these factory functions are called with the result type as first
argument, and the callback functions expected ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
027f503c-d0a4-4900-b4d4-b59682017d11 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,393 | supabase-export-v2 | 01e892dbaff07c62 | Both of these factory functions are called with the result type as first argument, and the callback functions expected argument types as the remaining arguments.
I will present an example here which uses the standard C library's
:c:func:`!qsort` function, that is used to sort items with the help of a callback
function.... | trusted_official_docs | CPython Docs | Both of these factory functions are called with the result type as first argument, and the callback functions expected argument types as the remaining arguments.
I will present an example here which uses the standard C library's
:c:func:`!qsort` function, that is used to sort items with the help of a callback
function.... | Both of these factory functions are called with the result type as first argument, and the callback functions expected argument types as the remaining arguments.
I will present an example here which uses the standard C library's
:c:func:`!qsort` function, that is used to sort items with the help of a callback
function.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
031917ac-e1ac-4448-bab1-fe83d5ccba55 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,634 | supabase-export-v2 | 81bea67bf97b64cb | be an instance of a ctypes type. *offset* defaults to zero, and must be an integer that will be added to the internal pointer value.
``byref(obj, offset)`` corresponds to this C code:: | trusted_official_docs | CPython Docs | be an instance of a ctypes type. *offset* defaults to zero, and must be an integer that will be added to the internal pointer value.
``byref(obj, offset)`` corresponds to this C code:: | be an instance of a ctypes type. *offset* defaults to zero, and must be an integer that will be added to the internal pointer value.
``byref(obj, offset)`` corresponds to this C code:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
053a9f16-c2ad-420b-834d-942ed1f5b41d | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,199 | supabase-export-v2 | fbeee8aca89aceff | On macOS::
>>> cdll.LoadLibrary("libc.dylib") # doctest: +MACOS
<CDLL 'libc.dylib', handle ... at ...>
>>> libc = CDLL("libc.dylib") # doctest: +MACOS
>>> libc # doctest: +MACOS
<CDLL 'libc.dylib', handle ... at ...> | trusted_official_docs | CPython Docs | On macOS::
>>> cdll.LoadLibrary("libc.dylib") # doctest: +MACOS
<CDLL 'libc.dylib', handle ... at ...>
>>> libc = CDLL("libc.dylib") # doctest: +MACOS
>>> libc # doctest: +MACOS
<CDLL 'libc.dylib', handle ... at ...> | On macOS::
>>> cdll.LoadLibrary("libc.dylib") # doctest: +MACOS
<CDLL 'libc.dylib', handle ... at ...>
>>> libc = CDLL("libc.dylib") # doctest: +MACOS
>>> libc # doctest: +MACOS
<CDLL 'libc.dylib', handle ... at ...> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
058e767f-5500-4f0f-a9ee-60251516fed9 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,193 | supabase-export-v2 | 0151f4e6ddf23480 | <WinDLL 'kernel32', handle ... at ...> >>> print(cdll.msvcrt) # doctest: +WINDOWS <CDLL 'msvcrt', handle ... at ...> >>> libc = cdll.msvcrt # doctest: +WINDOWS >>>
Windows appends the usual ``.dll`` file suffix automatically. | trusted_official_docs | CPython Docs | <WinDLL 'kernel32', handle ... at ...> >>> print(cdll.msvcrt) # doctest: +WINDOWS <CDLL 'msvcrt', handle ... at ...> >>> libc = cdll.msvcrt # doctest: +WINDOWS >>>
Windows appends the usual ``.dll`` file suffix automatically. | <WinDLL 'kernel32', handle ... at ...> >>> print(cdll.msvcrt) # doctest: +WINDOWS <CDLL 'msvcrt', handle ... at ...> >>> libc = cdll.msvcrt # doctest: +WINDOWS >>>
Windows appends the usual ``.dll`` file suffix automatically. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
065cf95c-547f-4de7-a76d-5cf16f881001 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,864 | supabase-export-v2 | cdd02b1917239073 | define the :attr:`_fields_` class variable *after* the class statement that defines the Structure subclass, this allows creating data types that directly or indirectly reference themselves::
class List(Structure):
pass
List._fields_ = [("pnext", POINTER(List)),
... ] | trusted_official_docs | CPython Docs | define the :attr:`_fields_` class variable *after* the class statement that defines the Structure subclass, this allows creating data types that directly or indirectly reference themselves::
class List(Structure):
pass
List._fields_ = [("pnext", POINTER(List)),
... ] | define the :attr:`_fields_` class variable *after* the class statement that defines the Structure subclass, this allows creating data types that directly or indirectly reference themselves::
class List(Structure):
pass
List._fields_ = [("pnext", POINTER(List)),
... ] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07f5a40f-3c64-4c53-850a-3f8f9184acc6 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,514 | supabase-export-v2 | 48e190f94d712156 | .. data:: pythonapi
An instance of :class:`PyDLL` that exposes Python C API functions as
attributes. Note that all these functions are assumed to return C
:c:expr:`int`, which is of course not always the truth, so you have to assign
the correct :attr:`!restype` attribute to use these functions. | trusted_official_docs | CPython Docs | .. data:: pythonapi
An instance of :class:`PyDLL` that exposes Python C API functions as
attributes. Note that all these functions are assumed to return C
:c:expr:`int`, which is of course not always the truth, so you have to assign
the correct :attr:`!restype` attribute to use these functions. | .. data:: pythonapi
An instance of :class:`PyDLL` that exposes Python C API functions as
attributes. Note that all these functions are assumed to return C
:c:expr:`int`, which is of course not always the truth, so you have to assign
the correct :attr:`!restype` attribute to use these functions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
086b0c80-5b04-490f-9c97-33729c70033d | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,899 | supabase-export-v2 | 5051b5009a28ab42 | Descriptor for fields of a :class:`Structure` and :class:`Union`. For example::
>>> class Color(Structure):
... _fields_ = (
... ('red', c_uint8),
... ('green', c_uint8),
... ('blue', c_uint8),
... ('intense', c_bool, 1),
... ('blinking', c_bool, 1),
... )
... >>> Color.red
<ctypes.CField 'red' type=c_ubyte, o... | trusted_official_docs | CPython Docs | Descriptor for fields of a :class:`Structure` and :class:`Union`. For example::
>>> class Color(Structure):
... _fields_ = (
... ('red', c_uint8),
... ('green', c_uint8),
... ('blue', c_uint8),
... ('intense', c_bool, 1),
... ('blinking', c_bool, 1),
... )
... >>> Color.red
<ctypes.CField 'red' type=c_ubyte, o... | Descriptor for fields of a :class:`Structure` and :class:`Union`. For example::
>>> class Color(Structure):
... _fields_ = (
... ('red', c_uint8),
... ('green', c_uint8),
... ('blue', c_uint8),
... ('intense', c_bool, 1),
... ('blinking', c_bool, 1),
... )
... >>> Color.red
<ctypes.CField 'red' type=c_ubyte, o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0a733f40-dd00-45cd-8ec0-a877efc07cc4 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,334 | supabase-export-v2 | 6deb1d7305b7c653 | >>> from ctypes import * >>> i = c_int(42) >>> pi = pointer(i) >>>
Pointer instances have a :attr:`~_Pointer.contents` attribute which
returns the object to which the pointer points, the ``i`` object above:: | trusted_official_docs | CPython Docs | >>> from ctypes import * >>> i = c_int(42) >>> pi = pointer(i) >>>
Pointer instances have a :attr:`~_Pointer.contents` attribute which
returns the object to which the pointer points, the ``i`` object above:: | >>> from ctypes import * >>> i = c_int(42) >>> pi = pointer(i) >>>
Pointer instances have a :attr:`~_Pointer.contents` attribute which
returns the object to which the pointer points, the ``i`` object above:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0bfc0766-72bf-43f0-a52f-e537b8edca55 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,504 | supabase-export-v2 | aee4255b3434ba9f | Class which loads shared libraries. *dlltype* should be one of the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types.
:meth:`!__getattr__` has special behavior: It allows loading a shared library by
accessing it as attribute of a library loader instance. The result is cached,
so repeated attrib... | trusted_official_docs | CPython Docs | Class which loads shared libraries. *dlltype* should be one of the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types.
:meth:`!__getattr__` has special behavior: It allows loading a shared library by
accessing it as attribute of a library loader instance. The result is cached,
so repeated attrib... | Class which loads shared libraries. *dlltype* should be one of the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types.
:meth:`!__getattr__` has special behavior: It allows loading a shared library by
accessing it as attribute of a library loader instance. The result is cached,
so repeated attrib... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0c1b0472-3960-4f2d-920b-bb65e3f1bd62 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,883 | supabase-export-v2 | 88f33789c23566e7 | An optional string naming the struct/union layout. It can currently be set to:
- ``"ms"``: the layout used by the Microsoft compiler (MSVC). On GCC and Clang, this layout can be selected with
``__attribute__((ms_struct))``. - ``"gcc-sysv"``: the layout used by GCC with the System V or “SysV-like”
data model, as used ... | trusted_official_docs | CPython Docs | An optional string naming the struct/union layout. It can currently be set to:
- ``"ms"``: the layout used by the Microsoft compiler (MSVC). On GCC and Clang, this layout can be selected with
``__attribute__((ms_struct))``. - ``"gcc-sysv"``: the layout used by GCC with the System V or “SysV-like”
data model, as used ... | An optional string naming the struct/union layout. It can currently be set to:
- ``"ms"``: the layout used by the Microsoft compiler (MSVC). On GCC and Clang, this layout can be selected with
``__attribute__((ms_struct))``. - ``"gcc-sysv"``: the layout used by GCC with the System V or “SysV-like”
data model, as used ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0cb51e73-4fd8-4420-96a4-7ced796c1aec | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,289 | supabase-export-v2 | 1a9d1ff48bf92c66 | an error code, and *returns* an exception. ``WinError`` takes an optional error code parameter, if no one is used, it calls :func:`GetLastError` to retrieve it.
Please note that a much more powerful error checking mechanism is available
through the :attr:`~_CFuncPtr.errcheck` attribute;
see the reference manual for det... | trusted_official_docs | CPython Docs | an error code, and *returns* an exception. ``WinError`` takes an optional error code parameter, if no one is used, it calls :func:`GetLastError` to retrieve it.
Please note that a much more powerful error checking mechanism is available
through the :attr:`~_CFuncPtr.errcheck` attribute;
see the reference manual for det... | an error code, and *returns* an exception. ``WinError`` takes an optional error code parameter, if no one is used, it calls :func:`GetLastError` to retrieve it.
Please note that a much more powerful error checking mechanism is available
through the :attr:`~_CFuncPtr.errcheck` attribute;
see the reference manual for det... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d41bbf2-fb16-4b34-8a29-5a4132bde2e0 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,533 | supabase-export-v2 | 1966052a544d4afe | This function is kept for use in cases where it works, but not expected to be updated for additional platforms and configurations.
On Linux, :func:`!find_library` tries to run external
programs (``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the
library file. If the output of these programs does not corre... | trusted_official_docs | CPython Docs | This function is kept for use in cases where it works, but not expected to be updated for additional platforms and configurations.
On Linux, :func:`!find_library` tries to run external
programs (``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the
library file. If the output of these programs does not corre... | This function is kept for use in cases where it works, but not expected to be updated for additional platforms and configurations.
On Linux, :func:`!find_library` tries to run external
programs (``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the
library file. If the output of these programs does not corre... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ed91c21-2617-4b94-8b65-7a753dd1c2b0 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,828 | supabase-export-v2 | 436eaa986f440e11 | .. class:: c_wchar
Represents the C :c:type:`wchar_t` datatype, and interprets the value as a
single character unicode string. The constructor accepts an optional string
initializer, the length of the string must be exactly one character. | trusted_official_docs | CPython Docs | .. class:: c_wchar
Represents the C :c:type:`wchar_t` datatype, and interprets the value as a
single character unicode string. The constructor accepts an optional string
initializer, the length of the string must be exactly one character. | .. class:: c_wchar
Represents the C :c:type:`wchar_t` datatype, and interprets the value as a
single character unicode string. The constructor accepts an optional string
initializer, the length of the string must be exactly one character. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
102f312d-5b8e-441e-93db-735e39b10fb0 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,485 | supabase-export-v2 | b4501ccc40ccb9d2 | See :py:class:`~ctypes.CDLL`, the superclass, for common information.
Functions in this library use the ``stdcall`` calling convention, and are
assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT`
values contain information specifying whether the function call failed or
succeeded, together ... | trusted_official_docs | CPython Docs | See :py:class:`~ctypes.CDLL`, the superclass, for common information.
Functions in this library use the ``stdcall`` calling convention, and are
assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT`
values contain information specifying whether the function call failed or
succeeded, together ... | See :py:class:`~ctypes.CDLL`, the superclass, for common information.
Functions in this library use the ``stdcall`` calling convention, and are
assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT`
values contain information specifying whether the function call failed or
succeeded, together ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
11117fe6-1d2c-4e75-8d09-5fa0e6aea8c8 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,763 | supabase-export-v2 | d137b6de1aa48d48 | types. In other words, if a foreign function has a :attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you will always receive a Python bytes object, *not* a :class:`c_char_p` instance.
.. XXX above is false, it actually returns a Unicode string | trusted_official_docs | CPython Docs | types. In other words, if a foreign function has a :attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you will always receive a Python bytes object, *not* a :class:`c_char_p` instance.
.. XXX above is false, it actually returns a Unicode string | types. In other words, if a foreign function has a :attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you will always receive a Python bytes object, *not* a :class:`c_char_p` instance.
.. XXX above is false, it actually returns a Unicode string | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
11baf599-2e3e-4e2a-98a2-566dd7c1303a | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,769 | supabase-export-v2 | 62fcc44846c66076 | .. class:: c_char
Represents the C :c:expr:`char` datatype, and interprets the value as a single
character. The constructor accepts an optional string initializer, the
length of the string must be exactly one character. | trusted_official_docs | CPython Docs | .. class:: c_char
Represents the C :c:expr:`char` datatype, and interprets the value as a single
character. The constructor accepts an optional string initializer, the
length of the string must be exactly one character. | .. class:: c_char
Represents the C :c:expr:`char` datatype, and interprets the value as a single
character. The constructor accepts an optional string initializer, the
length of the string must be exactly one character. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
131c8b6e-1f53-41f6-bbc1-b54b7ceb75a3 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,459 | supabase-export-v2 | 911c3f0758bf77e6 | and suffixes (for example, ``lib``, ``.so``, ``.dylib``, or version numbers) must be present in *name*; they are not added automatically. See :ref:`ctypes-finding-shared-libraries` for more information.
On non-Windows systems, *name* can be ``None``. In this case,
:c:func:`!dlopen` is called with ``NULL``, which opens... | trusted_official_docs | CPython Docs | and suffixes (for example, ``lib``, ``.so``, ``.dylib``, or version numbers) must be present in *name*; they are not added automatically. See :ref:`ctypes-finding-shared-libraries` for more information.
On non-Windows systems, *name* can be ``None``. In this case,
:c:func:`!dlopen` is called with ``NULL``, which opens... | and suffixes (for example, ``lib``, ``.so``, ``.dylib``, or version numbers) must be present in *name*; they are not added automatically. See :ref:`ctypes-finding-shared-libraries` for more information.
On non-Windows systems, *name* can be ``None``. In this case,
:c:func:`!dlopen` is called with ``NULL``, which opens... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13ee93b5-2fd3-4eea-8ef7-1b1346a65163 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,737 | supabase-export-v2 | b44e014c59603c4a | ctypes type instance exported by a shared library. *name* is the name of the symbol that exports the data, *library* is the loaded shared library.
Common class variables of ctypes data types: | trusted_official_docs | CPython Docs | ctypes type instance exported by a shared library. *name* is the name of the symbol that exports the data, *library* is the loaded shared library.
Common class variables of ctypes data types: | ctypes type instance exported by a shared library. *name* is the name of the symbol that exports the data, *library* is the loaded shared library.
Common class variables of ctypes data types: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
14443449-eac5-484f-98a3-c4e6abee3ddf | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,406 | supabase-export-v2 | 895abb91eef73185 | >>> for i in ia: print(i, end=" ") ... 1 5 7 33 99 >>>
The function factories can be used as decorator factories, so we may as well
write:: | trusted_official_docs | CPython Docs | >>> for i in ia: print(i, end=" ") ... 1 5 7 33 99 >>>
The function factories can be used as decorator factories, so we may as well
write:: | >>> for i in ia: print(i, end=" ") ... 1 5 7 33 99 >>>
The function factories can be used as decorator factories, so we may as well
write:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
14f9feff-3322-4203-a992-a4f8cf0aca46 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,423 | supabase-export-v2 | ccb7afbbd8894fe7 | >>> FrozenTable = POINTER(struct_frozen) >>> table = FrozenTable.in_dll(pythonapi, "_PyImport_FrozenBootstrap") >>>
Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, we
can iterate over it, but we just have to make sure that our loop terminates,
because pointers have no size. Sooner or later i... | trusted_official_docs | CPython Docs | >>> FrozenTable = POINTER(struct_frozen) >>> table = FrozenTable.in_dll(pythonapi, "_PyImport_FrozenBootstrap") >>>
Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, we
can iterate over it, but we just have to make sure that our loop terminates,
because pointers have no size. Sooner or later i... | >>> FrozenTable = POINTER(struct_frozen) >>> table = FrozenTable.in_dll(pythonapi, "_PyImport_FrozenBootstrap") >>>
Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, we
can iterate over it, but we just have to make sure that our loop terminates,
because pointers have no size. Sooner or later i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
17148cb2-d636-4ca3-bac8-bbd6426487f4 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,454 | supabase-export-v2 | 978a4fd3d7da8e95 | Represents a loaded shared library.
Functions in this library use the standard C calling convention, and are
assumed to return :c:expr:`int`. The Python :term:`global interpreter lock` is released before calling any
function exported by these libraries, and reacquired afterwards. For different function behavior, use ... | trusted_official_docs | CPython Docs | Represents a loaded shared library.
Functions in this library use the standard C calling convention, and are
assumed to return :c:expr:`int`. The Python :term:`global interpreter lock` is released before calling any
function exported by these libraries, and reacquired afterwards. For different function behavior, use ... | Represents a loaded shared library.
Functions in this library use the standard C calling convention, and are
assumed to return :c:expr:`int`. The Python :term:`global interpreter lock` is released before calling any
function exported by these libraries, and reacquired afterwards. For different function behavior, use ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
199a3221-9ae7-4bdb-b4eb-f2c8c28aa18c | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,576 | supabase-export-v2 | 1ad83e20ae8e232d | .. audit-event:: ctypes.set_exception code foreign-functions
On Windows, when a foreign function call raises a system exception (for
example, due to an access violation), it will be captured and replaced with
a suitable Python exception. Further, an auditing event
``ctypes.set_exception`` with argument ``code`` will... | trusted_official_docs | CPython Docs | .. audit-event:: ctypes.set_exception code foreign-functions
On Windows, when a foreign function call raises a system exception (for
example, due to an access violation), it will be captured and replaced with
a suitable Python exception. Further, an auditing event
``ctypes.set_exception`` with argument ``code`` will... | .. audit-event:: ctypes.set_exception code foreign-functions
On Windows, when a foreign function call raises a system exception (for
example, due to an access violation), it will be captured and replaced with
a suitable Python exception. Further, an auditing event
``ctypes.set_exception`` with argument ``code`` will... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
199c0429-5985-4b48-a06b-10d68ec7cb48 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,894 | supabase-export-v2 | ad735633095e0c23 | off the TYPEDESC instance. ``td.lptdesc`` and ``td.u.lptdesc`` are equivalent, but the former is faster since it does not need to create a temporary union instance::
td = TYPEDESC()
td.vt = VT_PTR
td.lptdesc = POINTER(some_type)
td.u.lptdesc = POINTER(some_type) | trusted_official_docs | CPython Docs | off the TYPEDESC instance. ``td.lptdesc`` and ``td.u.lptdesc`` are equivalent, but the former is faster since it does not need to create a temporary union instance::
td = TYPEDESC()
td.vt = VT_PTR
td.lptdesc = POINTER(some_type)
td.u.lptdesc = POINTER(some_type) | off the TYPEDESC instance. ``td.lptdesc`` and ``td.u.lptdesc`` are equivalent, but the former is faster since it does not need to create a temporary union instance::
td = TYPEDESC()
td.vt = VT_PTR
td.lptdesc = POINTER(some_type)
td.u.lptdesc = POINTER(some_type) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a02e290-b896-4be8-bfb4-471a080f703b | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,243 | supabase-export-v2 | c89e259129cf7a52 | block contents can be accessed (or changed) with the ``raw`` property; if you want to access it as NUL terminated string, use the ``value`` property::
>>> from ctypes import *
>>> p = create_string_buffer(3) # create a 3 byte buffer, initialized to NUL bytes
>>> print(sizeof(p), repr(p.raw))
3 b'\x00\x00\x00'
>>> p... | trusted_official_docs | CPython Docs | block contents can be accessed (or changed) with the ``raw`` property; if you want to access it as NUL terminated string, use the ``value`` property::
>>> from ctypes import *
>>> p = create_string_buffer(3) # create a 3 byte buffer, initialized to NUL bytes
>>> print(sizeof(p), repr(p.raw))
3 b'\x00\x00\x00'
>>> p... | block contents can be accessed (or changed) with the ``raw`` property; if you want to access it as NUL terminated string, use the ``value`` property::
>>> from ctypes import *
>>> p = create_string_buffer(3) # create a 3 byte buffer, initialized to NUL bytes
>>> print(sizeof(p), repr(p.raw))
3 b'\x00\x00\x00'
>>> p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a70d7d8-7903-417a-a499-8d12d260a81d | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,241 | supabase-export-v2 | 7292074592c70d5f | and :class:`c_void_p` changes the *memory location* they point to, *not the contents* of the memory block (of course not, because Python string objects are immutable)::
>>> s = "Hello, World"
>>> c_s = c_wchar_p(s)
>>> print(c_s)
c_wchar_p(139966785747344)
>>> print(c_s.value)
Hello World
>>> c_s.value = "Hi, the... | trusted_official_docs | CPython Docs | and :class:`c_void_p` changes the *memory location* they point to, *not the contents* of the memory block (of course not, because Python string objects are immutable)::
>>> s = "Hello, World"
>>> c_s = c_wchar_p(s)
>>> print(c_s)
c_wchar_p(139966785747344)
>>> print(c_s.value)
Hello World
>>> c_s.value = "Hi, the... | and :class:`c_void_p` changes the *memory location* they point to, *not the contents* of the memory block (of course not, because Python string objects are immutable)::
>>> s = "Hello, World"
>>> c_s = c_wchar_p(s)
>>> print(c_s)
c_wchar_p(139966785747344)
>>> print(c_s.value)
Hello World
>>> c_s.value = "Hi, the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b38c3d3-146b-44b1-93ad-bcdcf428dcbf | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,275 | supabase-export-v2 | bca1f10a41f59010 | default functions are assumed to return the C :c:expr:`int` type. Other return types can be specified by setting the :attr:`~_CFuncPtr.restype` attribute of the function object.
The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:type:`time_t`
might be of a different type than the default return ... | trusted_official_docs | CPython Docs | default functions are assumed to return the C :c:expr:`int` type. Other return types can be specified by setting the :attr:`~_CFuncPtr.restype` attribute of the function object.
The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:type:`time_t`
might be of a different type than the default return ... | default functions are assumed to return the C :c:expr:`int` type. Other return types can be specified by setting the :attr:`~_CFuncPtr.restype` attribute of the function object.
The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:type:`time_t`
might be of a different type than the default return ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1beb8840-ee11-450b-b4f1-6ac8124b9556 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,765 | supabase-export-v2 | b346365510519486 | receive an instance of this subclass from the function call. Of course, you can get the value of the pointer by accessing the ``value`` attribute.
These are the fundamental ctypes data types: | trusted_official_docs | CPython Docs | receive an instance of this subclass from the function call. Of course, you can get the value of the pointer by accessing the ``value`` attribute.
These are the fundamental ctypes data types: | receive an instance of this subclass from the function call. Of course, you can get the value of the pointer by accessing the ``value`` attribute.
These are the fundamental ctypes data types: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d45e1e8-0e1b-40e4-ac30-3d5a27fe0967 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,687 | supabase-export-v2 | 2137bd1bba033b7b | .. function:: POINTER(type, /)
Create or return a ctypes pointer type. Pointer types are cached and
reused internally, so calling this function repeatedly is cheap. *type* must be a ctypes type. | trusted_official_docs | CPython Docs | .. function:: POINTER(type, /)
Create or return a ctypes pointer type. Pointer types are cached and
reused internally, so calling this function repeatedly is cheap. *type* must be a ctypes type. | .. function:: POINTER(type, /)
Create or return a ctypes pointer type. Pointer types are cached and
reused internally, so calling this function repeatedly is cheap. *type* must be a ctypes type. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e22cec0-e65b-45e2-9e35-e5335a594886 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,457 | supabase-export-v2 | 445b7ef5a07c5981 | is ``None``, the underlying platform's :manpage:`dlopen(3)` or `LoadLibraryExW`_ function is used to load the library into the process, and to get a handle to it.
*name* is the pathname of the shared library to open. If *name* does not contain a path separator, the library is found
in a platform-specific way. | trusted_official_docs | CPython Docs | is ``None``, the underlying platform's :manpage:`dlopen(3)` or `LoadLibraryExW`_ function is used to load the library into the process, and to get a handle to it.
*name* is the pathname of the shared library to open. If *name* does not contain a path separator, the library is found
in a platform-specific way. | is ``None``, the underlying platform's :manpage:`dlopen(3)` or `LoadLibraryExW`_ function is used to load the library into the process, and to get a handle to it.
*name* is the pathname of the shared library to open. If *name* does not contain a path separator, the library is found
in a platform-specific way. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1fba30c6-09e3-4c05-b3e2-17879c0ee52d | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,322 | supabase-export-v2 | 274088d7a7322f76 | Arrays are sequences, containing a fixed number of instances of the same type.
The recommended way to create array types is by multiplying a data type with a
positive integer:: | trusted_official_docs | CPython Docs | Arrays are sequences, containing a fixed number of instances of the same type.
The recommended way to create array types is by multiplying a data type with a
positive integer:: | Arrays are sequences, containing a fixed number of instances of the same type.
The recommended way to create array types is by multiplying a data type with a
positive integer:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2133b177-b540-4ddc-af9f-47c3ab7c65c3 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,292 | supabase-export-v2 | 9ae1c6635fcd734d | Passing pointers (or: passing parameters by reference) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sometimes a C api function expects a *pointer* to a data type as parameter,
probably to write into the corresponding location, or if the data is too large
to be passed by value. This is also known as *passing p... | trusted_official_docs | CPython Docs | Passing pointers (or: passing parameters by reference) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sometimes a C api function expects a *pointer* to a data type as parameter,
probably to write into the corresponding location, or if the data is too large
to be passed by value. This is also known as *passing p... | Passing pointers (or: passing parameters by reference) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sometimes a C api function expects a *pointer* to a data type as parameter,
probably to write into the corresponding location, or if the data is too large
to be passed by value. This is also known as *passing p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
215b544e-a2e1-4c2c-840e-e25a8383e1ea | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,348 | supabase-export-v2 | d7bae07b37ba6d36 | PI(42) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: expected c_long instead of int >>> PI(c_int(42)) <ctypes.LP_c_long object at 0x...> >>>
Calling the pointer type without an argument creates a ``NULL`` pointer. ``NULL`` pointers have a ``False`` boolean value:: | trusted_official_docs | CPython Docs | PI(42) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: expected c_long instead of int >>> PI(c_int(42)) <ctypes.LP_c_long object at 0x...> >>>
Calling the pointer type without an argument creates a ``NULL`` pointer. ``NULL`` pointers have a ``False`` boolean value:: | PI(42) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: expected c_long instead of int >>> PI(c_int(42)) <ctypes.LP_c_long object at 0x...> >>>
Calling the pointer type without an argument creates a ``NULL`` pointer. ``NULL`` pointers have a ``False`` boolean value:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21640afd-0753-4151-b72f-347436a32f2d | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,538 | supabase-export-v2 | 9c2128ebb5652d0c | On macOS and Android, :func:`!find_library` uses the system's standard naming schemes and paths to locate the library, and returns a full pathname if successful::
>>> from ctypes.util import find_library
>>> find_library("c")
'/usr/lib/libc.dylib'
>>> find_library("m")
'/usr/lib/libm.dylib'
>>> find_library("bz2")... | trusted_official_docs | CPython Docs | On macOS and Android, :func:`!find_library` uses the system's standard naming schemes and paths to locate the library, and returns a full pathname if successful::
>>> from ctypes.util import find_library
>>> find_library("c")
'/usr/lib/libc.dylib'
>>> find_library("m")
'/usr/lib/libm.dylib'
>>> find_library("bz2")... | On macOS and Android, :func:`!find_library` uses the system's standard naming schemes and paths to locate the library, and returns a full pathname if successful::
>>> from ctypes.util import find_library
>>> find_library("c")
'/usr/lib/libc.dylib'
>>> find_library("m")
'/usr/lib/libm.dylib'
>>> find_library("bz2")... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21a13e51-b5e3-4567-90fe-c07e675a8384 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,524 | supabase-export-v2 | 71593aa55e122f93 | short name; the C compiler, linker, and runtime dynamic library loader then interact in system-specific ways to find the filename of the library to load.
While the mapping from short names to filenames is not consistently exposed
by platforms, the :mod:`!ctypes.util` module provides a function,
:func:`!find_library`, t... | trusted_official_docs | CPython Docs | short name; the C compiler, linker, and runtime dynamic library loader then interact in system-specific ways to find the filename of the library to load.
While the mapping from short names to filenames is not consistently exposed
by platforms, the :mod:`!ctypes.util` module provides a function,
:func:`!find_library`, t... | short name; the C compiler, linker, and runtime dynamic library loader then interact in system-specific ways to find the filename of the library to load.
While the mapping from short names to filenames is not consistently exposed
by platforms, the :mod:`!ctypes.util` module provides a function,
:func:`!find_library`, t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21a98f3b-aed3-4419-aae8-a854baae749b | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,604 | supabase-export-v2 | a175ea9d0880893c | Each item in this tuple contains further information about a parameter, it must be a tuple containing one, two, or three items.
The first item is an integer containing a combination of direction
flags for the parameter: | trusted_official_docs | CPython Docs | Each item in this tuple contains further information about a parameter, it must be a tuple containing one, two, or three items.
The first item is an integer containing a combination of direction
flags for the parameter: | Each item in this tuple contains further information about a parameter, it must be a tuple containing one, two, or three items.
The first item is an integer containing a combination of direction
flags for the parameter: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
21ac415c-32a1-40c2-bdf1-a081564642e6 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,233 | supabase-export-v2 | ba345cac6a8e22e6 | .. list-table:: :header-rows: 1
* - ctypes type
- C type
- Python type
- :py:attr:`~_SimpleCData._type_`
* - :class:`c_float_complex`
- :c:expr:`float complex`
- :py:class:`complex`
- ``'F'``
* - :class:`c_double_complex`
- :c:expr:`double complex`
- :py:class:`complex`
- ``'D'``
* - :class:`c_longdouble_co... | trusted_official_docs | CPython Docs | .. list-table:: :header-rows: 1
* - ctypes type
- C type
- Python type
- :py:attr:`~_SimpleCData._type_`
* - :class:`c_float_complex`
- :c:expr:`float complex`
- :py:class:`complex`
- ``'F'``
* - :class:`c_double_complex`
- :c:expr:`double complex`
- :py:class:`complex`
- ``'D'``
* - :class:`c_longdouble_co... | .. list-table:: :header-rows: 1
* - ctypes type
- C type
- Python type
- :py:attr:`~_SimpleCData._type_`
* - :class:`c_float_complex`
- :c:expr:`float complex`
- :py:class:`complex`
- ``'F'``
* - :class:`c_double_complex`
- :c:expr:`double complex`
- :py:class:`complex`
- ``'D'``
* - :class:`c_longdouble_co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
22df8017-b0e9-4dd7-a0e6-6fa4e752ee0f | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,247 | supabase-export-v2 | 8ab639b8ad241eff | Calling functions, continued ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note that printf prints to the real standard output channel, *not* to
:data:`sys.stdout`, so these examples will only work at the console prompt, not
from within *IDLE* or *PythonWin*:: | trusted_official_docs | CPython Docs | Calling functions, continued ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note that printf prints to the real standard output channel, *not* to
:data:`sys.stdout`, so these examples will only work at the console prompt, not
from within *IDLE* or *PythonWin*:: | Calling functions, continued ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note that printf prints to the real standard output channel, *not* to
:data:`sys.stdout`, so these examples will only work at the console prompt, not
from within *IDLE* or *PythonWin*:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2311da3a-c24f-4e75-a8e6-77aec92a5bf3 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,614 | supabase-export-v2 | b69df914ef01f99a | LPCWSTR, UINT) >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", "Hello from ctypes"), (1, "flags", 0) >>> MessageBox = prototype(("MessageBoxW", windll.user32), paramflags)
The ``MessageBox`` foreign function can now be called in these ways:: | trusted_official_docs | CPython Docs | LPCWSTR, UINT) >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", "Hello from ctypes"), (1, "flags", 0) >>> MessageBox = prototype(("MessageBoxW", windll.user32), paramflags)
The ``MessageBox`` foreign function can now be called in these ways:: | LPCWSTR, UINT) >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", "Hello from ctypes"), (1, "flags", 0) >>> MessageBox = prototype(("MessageBoxW", windll.user32), paramflags)
The ``MessageBox`` foreign function can now be called in these ways:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24606061-1357-4655-a0a2-c9001f2f8d0d | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,404 | supabase-export-v2 | 0524c27d0f6d24d4 | >>> >>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) # doctest: +LINUX py_cmp_func 5 1 py_cmp_func 33 99 py_cmp_func 7 33 py_cmp_func 1 7 py_cmp_func 5 7 >>>
As we can easily check, our array is sorted now:: | trusted_official_docs | CPython Docs | >>> >>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) # doctest: +LINUX py_cmp_func 5 1 py_cmp_func 33 99 py_cmp_func 7 33 py_cmp_func 1 7 py_cmp_func 5 7 >>>
As we can easily check, our array is sorted now:: | >>> >>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) # doctest: +LINUX py_cmp_func 5 1 py_cmp_func 33 99 py_cmp_func 7 33 py_cmp_func 1 7 py_cmp_func 5 7 >>>
As we can easily check, our array is sorted now:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2476b660-cf14-4f27-b8c4-88d2fb91c0da | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,493 | supabase-export-v2 | b9560270979184b0 | See :py:class:`~ctypes.CDLL`, the superclass, for common information.
When functions in this library are called, the
Python GIL is *not* released during the function call, and after the function
execution the Python error flag is checked. If the error flag is set, a Python
exception is raised. | trusted_official_docs | CPython Docs | See :py:class:`~ctypes.CDLL`, the superclass, for common information.
When functions in this library are called, the
Python GIL is *not* released during the function call, and after the function
execution the Python error flag is checked. If the error flag is set, a Python
exception is raised. | See :py:class:`~ctypes.CDLL`, the superclass, for common information.
When functions in this library are called, the
Python GIL is *not* released during the function call, and after the function
execution the Python error flag is checked. If the error flag is set, a Python
exception is raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
247eaa38-ecaa-43d0-98aa-fa1434913405 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,712 | supabase-export-v2 | 9b3fb8d5ef441d54 | .. function:: wstring_at(ptr, size=-1)
Return the wide-character string at *void \*ptr*. If *size* is specified, it is used as the number of
characters of the string, otherwise the string is assumed to be
zero-terminated. | trusted_official_docs | CPython Docs | .. function:: wstring_at(ptr, size=-1)
Return the wide-character string at *void \*ptr*. If *size* is specified, it is used as the number of
characters of the string, otherwise the string is assumed to be
zero-terminated. | .. function:: wstring_at(ptr, size=-1)
Return the wide-character string at *void \*ptr*. If *size* is specified, it is used as the number of
characters of the string, otherwise the string is assumed to be
zero-terminated. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24ce3766-dda5-446b-9400-b128aa39fdd6 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,283 | supabase-export-v2 | a32ec9e9492a6683 | # doctest: +SKIP 8059983 >>> strchr.restype = c_char_p # c_char_p is a pointer to a string >>> strchr(b"abcdef", ord("d")) b'def' >>> print(strchr(b"abcdef", ord("x"))) None >>>
If you want to avoid the :func:`ord("x") <ord>` calls above, you can set the
:attr:`~_CFuncPtr.argtypes` attribute, and the second argument wi... | trusted_official_docs | CPython Docs | # doctest: +SKIP 8059983 >>> strchr.restype = c_char_p # c_char_p is a pointer to a string >>> strchr(b"abcdef", ord("d")) b'def' >>> print(strchr(b"abcdef", ord("x"))) None >>>
If you want to avoid the :func:`ord("x") <ord>` calls above, you can set the
:attr:`~_CFuncPtr.argtypes` attribute, and the second argument wi... | # doctest: +SKIP 8059983 >>> strchr.restype = c_char_p # c_char_p is a pointer to a string >>> strchr(b"abcdef", ord("d")) b'def' >>> print(strchr(b"abcdef", ord("x"))) None >>>
If you want to avoid the :func:`ord("x") <ord>` calls above, you can set the
:attr:`~_CFuncPtr.argtypes` attribute, and the second argument wi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24fbfce6-7f8a-4aa3-8dde-7db374712c5e | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,608 | supabase-export-v2 | e6b5a9bf3c1acb2b | 4 Input parameter which defaults to the integer zero.
The optional second item is the parameter name as string. If this is specified,
the foreign function can be called with named parameters. | trusted_official_docs | CPython Docs | 4 Input parameter which defaults to the integer zero.
The optional second item is the parameter name as string. If this is specified,
the foreign function can be called with named parameters. | 4 Input parameter which defaults to the integer zero.
The optional second item is the parameter name as string. If this is specified,
the foreign function can be called with named parameters. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
254baaa9-fbd8-4328-9639-cd58b228e527 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,726 | supabase-export-v2 | 715d5b1453f5fd82 | .. method:: _CData.from_buffer_copy(source[, offset])
This method creates a ctypes instance, copying the buffer from the
*source* object buffer which must be readable. The optional *offset*
parameter specifies an offset into the source buffer in bytes; the default
is zero. If the source buffer is not large enough a ... | trusted_official_docs | CPython Docs | .. method:: _CData.from_buffer_copy(source[, offset])
This method creates a ctypes instance, copying the buffer from the
*source* object buffer which must be readable. The optional *offset*
parameter specifies an offset into the source buffer in bytes; the default
is zero. If the source buffer is not large enough a ... | .. method:: _CData.from_buffer_copy(source[, offset])
This method creates a ctypes instance, copying the buffer from the
*source* object buffer which must be readable. The optional *offset*
parameter specifies an offset into the source buffer in bytes; the default
is zero. If the source buffer is not large enough a ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
25f075fe-db0a-48be-abd7-2f4851e5b5c7 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,195 | supabase-export-v2 | 930ff79359ba3124 | that may be incompatible with the one being used by Python. Where possible, use native Python functionality, or else import and use the ``msvcrt`` module.
Other systems require the filename *including* the extension to
load a library, so attribute access can not be used to load libraries. Either the
:meth:`~LibraryLoad... | trusted_official_docs | CPython Docs | that may be incompatible with the one being used by Python. Where possible, use native Python functionality, or else import and use the ``msvcrt`` module.
Other systems require the filename *including* the extension to
load a library, so attribute access can not be used to load libraries. Either the
:meth:`~LibraryLoad... | that may be incompatible with the one being used by Python. Where possible, use native Python functionality, or else import and use the ``msvcrt`` module.
Other systems require the filename *including* the extension to
load a library, so attribute access can not be used to load libraries. Either the
:meth:`~LibraryLoad... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
269ace55-a6c3-4c61-8286-1a4bb223f102 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,858 | supabase-export-v2 | 112d212d5334ef1c | Abstract base class for structures in *native* byte order.
Concrete structure and union types must be created by subclassing one of these
types, and at least define a :attr:`_fields_` class variable. :mod:`!ctypes` will
create :term:`descriptor`\s which allow reading and writing the fields by direct
attribute access... | trusted_official_docs | CPython Docs | Abstract base class for structures in *native* byte order.
Concrete structure and union types must be created by subclassing one of these
types, and at least define a :attr:`_fields_` class variable. :mod:`!ctypes` will
create :term:`descriptor`\s which allow reading and writing the fields by direct
attribute access... | Abstract base class for structures in *native* byte order.
Concrete structure and union types must be created by subclassing one of these
types, and at least define a :attr:`_fields_` class variable. :mod:`!ctypes` will
create :term:`descriptor`\s which allow reading and writing the fields by direct
attribute access... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26b6c987-58bd-43ba-9bd9-b17f24f7b1ab | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,529 | supabase-export-v2 | 106ecbf415a3339e | or version number. (This is the form used for the posix linker option :option:`!-l`.) The result is in a format suitable for passing to :py:class:`~ctypes.CDLL`.
If no library can be found, return ``None``. | trusted_official_docs | CPython Docs | or version number. (This is the form used for the posix linker option :option:`!-l`.) The result is in a format suitable for passing to :py:class:`~ctypes.CDLL`.
If no library can be found, return ``None``. | or version number. (This is the form used for the posix linker option :option:`!-l`.) The result is in a format suitable for passing to :py:class:`~ctypes.CDLL`.
If no library can be found, return ``None``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
26db0c24-64c0-42b0-bc04-3441dce14958 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,523 | supabase-export-v2 | d7dedfa0b649a84a | Finding shared libraries ^^^^^^^^^^^^^^^^^^^^^^^^
When programming in a compiled language, shared libraries are accessed when
compiling/linking a program, and when the program is run. The programmer specifies a short name; the C compiler, linker, and
runtime dynamic library loader then interact in system-specific ways ... | trusted_official_docs | CPython Docs | Finding shared libraries ^^^^^^^^^^^^^^^^^^^^^^^^
When programming in a compiled language, shared libraries are accessed when
compiling/linking a program, and when the program is run. The programmer specifies a short name; the C compiler, linker, and
runtime dynamic library loader then interact in system-specific ways ... | Finding shared libraries ^^^^^^^^^^^^^^^^^^^^^^^^
When programming in a compiled language, shared libraries are accessed when
compiling/linking a program, and when the program is run. The programmer specifies a short name; the C compiler, linker, and
runtime dynamic library loader then interact in system-specific ways ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
283106ae-d905-4337-a04a-b42e4238da83 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,464 | supabase-export-v2 | 14e707704d44f6cb | To access the Python C API, prefer :py:data:`ctypes.pythonapi` which works across platforms.
The *mode* parameter can be used to specify how the library is loaded. For
details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is
ignored. On posix systems, RTLD_NOW is always added, and is not
configurable... | trusted_official_docs | CPython Docs | To access the Python C API, prefer :py:data:`ctypes.pythonapi` which works across platforms.
The *mode* parameter can be used to specify how the library is loaded. For
details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is
ignored. On posix systems, RTLD_NOW is always added, and is not
configurable... | To access the Python C API, prefer :py:data:`ctypes.pythonapi` which works across platforms.
The *mode* parameter can be used to specify how the library is loaded. For
details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is
ignored. On posix systems, RTLD_NOW is always added, and is not
configurable... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2844b1d5-c581-4207-8f5b-f005050dc340 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,542 | supabase-export-v2 | 9afb0f6e5543324a | Returns the filename of the VC runtime library used by Python, and by the extension modules.
If the name of the library cannot be determined, ``None`` is returned. Notably, this will happen for recent versions of the VC runtime library,
which are not directly loadable. | trusted_official_docs | CPython Docs | Returns the filename of the VC runtime library used by Python, and by the extension modules.
If the name of the library cannot be determined, ``None`` is returned. Notably, this will happen for recent versions of the VC runtime library,
which are not directly loadable. | Returns the filename of the VC runtime library used by Python, and by the extension modules.
If the name of the library cannot be determined, ``None`` is returned. Notably, this will happen for recent versions of the VC runtime library,
which are not directly loadable. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28542da3-4bdd-436d-9f4b-0826ca9b9323 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,871 | supabase-export-v2 | b46d30c6fbe13ee2 | This is only implemented for the MSVC-compatible memory layout (see :attr:`_layout_`).
Setting :attr:`!_pack_` to 0 is the same as not setting it at all. Otherwise, the value must be a positive power of two. The effect is equivalent to ``#pragma pack(N)`` in C, except
:mod:`!ctypes` may allow larger *n* than what the ... | trusted_official_docs | CPython Docs | This is only implemented for the MSVC-compatible memory layout (see :attr:`_layout_`).
Setting :attr:`!_pack_` to 0 is the same as not setting it at all. Otherwise, the value must be a positive power of two. The effect is equivalent to ``#pragma pack(N)`` in C, except
:mod:`!ctypes` may allow larger *n* than what the ... | This is only implemented for the MSVC-compatible memory layout (see :attr:`_layout_`).
Setting :attr:`!_pack_` to 0 is the same as not setting it at all. Otherwise, the value must be a positive power of two. The effect is equivalent to ``#pragma pack(N)`` in C, except
:mod:`!ctypes` may allow larger *n* than what the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28f9f51d-b7ee-4761-882a-e0ce4126b0cc | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,314 | supabase-export-v2 | 345bd259a473fb39 | maximum alignment for the fields and/or for the structure itself by setting the class attributes :attr:`~Structure._pack_` and/or :attr:`~Structure._align_`, respectively. See the attribute documentation for details.
:mod:`!ctypes` uses the native byte order for Structures and Unions. To build
structures with non-nativ... | trusted_official_docs | CPython Docs | maximum alignment for the fields and/or for the structure itself by setting the class attributes :attr:`~Structure._pack_` and/or :attr:`~Structure._align_`, respectively. See the attribute documentation for details.
:mod:`!ctypes` uses the native byte order for Structures and Unions. To build
structures with non-nativ... | maximum alignment for the fields and/or for the structure itself by setting the class attributes :attr:`~Structure._pack_` and/or :attr:`~Structure._align_`, respectively. See the attribute documentation for details.
:mod:`!ctypes` uses the native byte order for Structures and Unions. To build
structures with non-nativ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2a1f0363-aec9-4b23-af9b-22bc1540d086 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,297 | supabase-export-v2 | dbfb6171a255bd9f | Structures and unions ^^^^^^^^^^^^^^^^^^^^^
Structures and unions must derive from the :class:`Structure` and :class:`Union`
base classes which are defined in the :mod:`!ctypes` module. Each subclass must
define a :attr:`~Structure._fields_` attribute. :attr:`!_fields_` must be a list of
*2-tuples*, containing a *field... | trusted_official_docs | CPython Docs | Structures and unions ^^^^^^^^^^^^^^^^^^^^^
Structures and unions must derive from the :class:`Structure` and :class:`Union`
base classes which are defined in the :mod:`!ctypes` module. Each subclass must
define a :attr:`~Structure._fields_` attribute. :attr:`!_fields_` must be a list of
*2-tuples*, containing a *field... | Structures and unions ^^^^^^^^^^^^^^^^^^^^^
Structures and unions must derive from the :class:`Structure` and :class:`Union`
base classes which are defined in the :mod:`!ctypes` module. Each subclass must
define a :attr:`~Structure._fields_` attribute. :attr:`!_fields_` must be a list of
*2-tuples*, containing a *field... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ba68371-f779-49f7-942d-085e38b3fd3c | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,475 | supabase-export-v2 | 2c8131e62cf34d07 | The *name* parameter can now be a :term:`path-like object`.
Instances of this class have no public methods. Functions exported by the
shared library can be accessed as attributes or by index. Please note that
accessing the function through an attribute caches the result and therefore
accessing it repeatedly returns ... | trusted_official_docs | CPython Docs | The *name* parameter can now be a :term:`path-like object`.
Instances of this class have no public methods. Functions exported by the
shared library can be accessed as attributes or by index. Please note that
accessing the function through an attribute caches the result and therefore
accessing it repeatedly returns ... | The *name* parameter can now be a :term:`path-like object`.
Instances of this class have no public methods. Functions exported by the
shared library can be accessed as attributes or by index. Please note that
accessing the function through an attribute caches the result and therefore
accessing it repeatedly returns ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2bddb6c2-94d5-4822-905f-4aa8dea9ac6a | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,325 | supabase-export-v2 | 8fe12dc227216585 | Here is an example of a somewhat artificial data type, a structure containing 4 POINTs among other stuff::
>>> from ctypes import *
>>> class POINT(Structure):
... _fields_ = ("x", c_int), ("y", c_int)
... >>> class MyStruct(Structure):
... _fields_ = [("a", c_int),
... ("b", c_float),
... ("point_array", POINT *... | trusted_official_docs | CPython Docs | Here is an example of a somewhat artificial data type, a structure containing 4 POINTs among other stuff::
>>> from ctypes import *
>>> class POINT(Structure):
... _fields_ = ("x", c_int), ("y", c_int)
... >>> class MyStruct(Structure):
... _fields_ = [("a", c_int),
... ("b", c_float),
... ("point_array", POINT *... | Here is an example of a somewhat artificial data type, a structure containing 4 POINTs among other stuff::
>>> from ctypes import *
>>> class POINT(Structure):
... _fields_ = ("x", c_int), ("y", c_int)
... >>> class MyStruct(Structure):
... _fields_ = [("a", c_int),
... ("b", c_float),
... ("point_array", POINT *... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2bf5bf78-7fca-4a36-9d67-c76c1e3d5620 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,723 | supabase-export-v2 | 1c78c92a38c4db8b | .. method:: _CData.from_buffer(source[, offset])
This method returns a ctypes instance that shares the buffer of the
*source* object. The *source* object must support the writeable buffer
interface. The optional *offset* parameter specifies an offset into the
source buffer in bytes; the default is zero. If the sourc... | trusted_official_docs | CPython Docs | .. method:: _CData.from_buffer(source[, offset])
This method returns a ctypes instance that shares the buffer of the
*source* object. The *source* object must support the writeable buffer
interface. The optional *offset* parameter specifies an offset into the
source buffer in bytes; the default is zero. If the sourc... | .. method:: _CData.from_buffer(source[, offset])
This method returns a ctypes instance that shares the buffer of the
*source* object. The *source* object must support the writeable buffer
interface. The optional *offset* parameter specifies an offset into the
source buffer in bytes; the default is zero. If the sourc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c50457b-164c-4f6b-a82b-1b9a6c4ea870 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,469 | supabase-export-v2 | f5ccbee3ce59172b | issues such as DLL hijacking. Passing the full path to the DLL is the safest way to ensure the correct library and dependencies are loaded.
On Windows creating a :class:`CDLL` instance may fail even if the DLL name
exists. When a dependent DLL of the loaded DLL is not found, a
:exc:`OSError` error is raised with the ... | trusted_official_docs | CPython Docs | issues such as DLL hijacking. Passing the full path to the DLL is the safest way to ensure the correct library and dependencies are loaded.
On Windows creating a :class:`CDLL` instance may fail even if the DLL name
exists. When a dependent DLL of the loaded DLL is not found, a
:exc:`OSError` error is raised with the ... | issues such as DLL hijacking. Passing the full path to the DLL is the safest way to ensure the correct library and dependencies are loaded.
On Windows creating a :class:`CDLL` instance may fail even if the DLL name
exists. When a dependent DLL of the loaded DLL is not found, a
:exc:`OSError` error is raised with the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ca094cb-1482-4f35-b10a-23993b7223cb | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,207 | supabase-export-v2 | ad305d6770c91c21 | by magic, you must access the version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` explicitly, and then call it with bytes or string objects respectively.
Sometimes, dlls export functions with names which aren't valid Python
identifiers, like ``"??2@YAPAXI@Z"``. In this case you have to use
:func... | trusted_official_docs | CPython Docs | by magic, you must access the version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` explicitly, and then call it with bytes or string objects respectively.
Sometimes, dlls export functions with names which aren't valid Python
identifiers, like ``"??2@YAPAXI@Z"``. In this case you have to use
:func... | by magic, you must access the version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` explicitly, and then call it with bytes or string objects respectively.
Sometimes, dlls export functions with names which aren't valid Python
identifiers, like ``"??2@YAPAXI@Z"``. In this case you have to use
:func... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ca918c7-8224-4b7b-9b07-297b9df29dc4 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,716 | supabase-export-v2 | ae179f151d8e3c7d | Return a :class:`memoryview` object of length *size* that references memory starting at *void \*ptr*.
If *readonly* is true, the returned :class:`!memoryview` object can
not be used to modify the underlying memory. (Changes made by other means will still be reflected in the returned
object.) | trusted_official_docs | CPython Docs | Return a :class:`memoryview` object of length *size* that references memory starting at *void \*ptr*.
If *readonly* is true, the returned :class:`!memoryview` object can
not be used to modify the underlying memory. (Changes made by other means will still be reflected in the returned
object.) | Return a :class:`memoryview` object of length *size* that references memory starting at *void \*ptr*.
If *readonly* is true, the returned :class:`!memoryview` object can
not be used to modify the underlying memory. (Changes made by other means will still be reflected in the returned
object.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2d429fc4-6626-45c2-a7ac-e362141d87f7 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,347 | supabase-export-v2 | a854cf0db0a170df | instances, it has to create pointer *types* first. This is done with the :func:`POINTER` function, which accepts any :mod:`!ctypes` type, and returns a new type::
>>> PI = POINTER(c_int)
>>> PI
<class 'ctypes.LP_c_long'>
>>> PI(42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ... | trusted_official_docs | CPython Docs | instances, it has to create pointer *types* first. This is done with the :func:`POINTER` function, which accepts any :mod:`!ctypes` type, and returns a new type::
>>> PI = POINTER(c_int)
>>> PI
<class 'ctypes.LP_c_long'>
>>> PI(42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ... | instances, it has to create pointer *types* first. This is done with the :func:`POINTER` function, which accepts any :mod:`!ctypes` type, and returns a new type::
>>> PI = POINTER(c_int)
>>> PI
<class 'ctypes.LP_c_long'>
>>> PI(42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2db79380-e82c-44ff-a830-0cc22921bc5f | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,391 | supabase-export-v2 | 7b775ed467f95224 | class for the callback function. The class knows the calling convention, the return type, and the number and types of arguments this function will receive.
The :func:`CFUNCTYPE` factory function creates types for callback functions
using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE`
factory func... | trusted_official_docs | CPython Docs | class for the callback function. The class knows the calling convention, the return type, and the number and types of arguments this function will receive.
The :func:`CFUNCTYPE` factory function creates types for callback functions
using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE`
factory func... | class for the callback function. The class knows the calling convention, the return type, and the number and types of arguments this function will receive.
The :func:`CFUNCTYPE` factory function creates types for callback functions
using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE`
factory func... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2dc2a4df-7674-42bb-b783-51a363679a51 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,281 | supabase-export-v2 | b7c98415e080c800 | >>> print(libc.time(None)) # doctest: +SKIP 1150640792
Here is a more advanced example, it uses the :func:`!strchr` function, which expects
a string pointer and a char, and returns a pointer to a string:: | trusted_official_docs | CPython Docs | >>> print(libc.time(None)) # doctest: +SKIP 1150640792
Here is a more advanced example, it uses the :func:`!strchr` function, which expects
a string pointer and a char, and returns a pointer to a string:: | >>> print(libc.time(None)) # doctest: +SKIP 1150640792
Here is a more advanced example, it uses the :func:`!strchr` function, which expects
a string pointer and a char, and returns a pointer to a string:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ddea071-0438-43d7-b00a-04e7190d8a07 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,759 | supabase-export-v2 | 0236c048bfc53207 | Class attribute that contains an internal type code, as a single-character string. See :ref:`ctypes-fundamental-data-types` for a summary.
Types marked \* in the summary may be (or always are) aliases of a
different :class:`_SimpleCData` subclass, and will not necessarily
use the listed type code. For example, if the... | trusted_official_docs | CPython Docs | Class attribute that contains an internal type code, as a single-character string. See :ref:`ctypes-fundamental-data-types` for a summary.
Types marked \* in the summary may be (or always are) aliases of a
different :class:`_SimpleCData` subclass, and will not necessarily
use the listed type code. For example, if the... | Class attribute that contains an internal type code, as a single-character string. See :ref:`ctypes-fundamental-data-types` for a summary.
Types marked \* in the summary may be (or always are) aliases of a
different :class:`_SimpleCData` subclass, and will not necessarily
use the listed type code. For example, if the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2e861868-f3b5-44eb-aa22-cfe02e382051 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,526 | supabase-export-v2 | f0909bc354a1c41b | adding a configuration option or environment variable to let users select a library to use, and then perhaps use :func:`!find_library` as a default or fallback.
.. function:: find_library(name)
:module: ctypes.util | trusted_official_docs | CPython Docs | adding a configuration option or environment variable to let users select a library to use, and then perhaps use :func:`!find_library` as a default or fallback.
.. function:: find_library(name)
:module: ctypes.util | adding a configuration option or environment variable to let users select a library to use, and then perhaps use :func:`!find_library` as a default or fallback.
.. function:: find_library(name)
:module: ctypes.util | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2f10e5ca-3731-4430-9c86-90114e55926e | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,364 | supabase-export-v2 | 8088ecf5bb693d3b | ctypes accepts other objects. For example, you can pass compatible array instances instead of pointer types. So, for ``POINTER(c_int)``, ctypes accepts an array of c_int::
>>> class Bar(Structure):
... _fields_ = [("count", c_int), ("values", POINTER(c_int))]
... >>> bar = Bar()
>>> bar.values = (c_int * 3)(1, 2, 3)... | trusted_official_docs | CPython Docs | ctypes accepts other objects. For example, you can pass compatible array instances instead of pointer types. So, for ``POINTER(c_int)``, ctypes accepts an array of c_int::
>>> class Bar(Structure):
... _fields_ = [("count", c_int), ("values", POINTER(c_int))]
... >>> bar = Bar()
>>> bar.values = (c_int * 3)(1, 2, 3)... | ctypes accepts other objects. For example, you can pass compatible array instances instead of pointer types. So, for ``POINTER(c_int)``, ctypes accepts an array of c_int::
>>> class Bar(Structure):
... _fields_ = [("count", c_int), ("values", POINTER(c_int))]
... >>> bar = Bar()
>>> bar.values = (c_int * 3)(1, 2, 3)... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
31b76573-0e67-45b6-932c-dad0e150640c | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,438 | supabase-export-v2 | 1d8a29135c5a1919 | Objects instantiated from :class:`c_char_p` can only have their value set to bytes or integers.
Why is it printing ``False``? ctypes instances are objects containing a memory
block plus some :term:`descriptor`\s accessing the contents of the memory. Storing a Python object in the memory block does not store the object ... | trusted_official_docs | CPython Docs | Objects instantiated from :class:`c_char_p` can only have their value set to bytes or integers.
Why is it printing ``False``? ctypes instances are objects containing a memory
block plus some :term:`descriptor`\s accessing the contents of the memory. Storing a Python object in the memory block does not store the object ... | Objects instantiated from :class:`c_char_p` can only have their value set to bytes or integers.
Why is it printing ``False``? ctypes instances are objects containing a memory
block plus some :term:`descriptor`\s accessing the contents of the memory. Storing a Python object in the memory block does not store the object ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
329127d3-a17a-418d-afaa-8f8e0a121814 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,358 | supabase-export-v2 | eb61329af397e695 | >>> number = c_int(42) >>> pointer_a = pointer(number) >>> pointer_b = pointer(number)
In the above, it's only safe for one object to read and write to the address at once if the GIL is disabled. So, ``pointer_a`` can be shared and written to across multiple threads, but only if ``pointer_b``
is not also attempting to ... | trusted_official_docs | CPython Docs | >>> number = c_int(42) >>> pointer_a = pointer(number) >>> pointer_b = pointer(number)
In the above, it's only safe for one object to read and write to the address at once if the GIL is disabled. So, ``pointer_a`` can be shared and written to across multiple threads, but only if ``pointer_b``
is not also attempting to ... | >>> number = c_int(42) >>> pointer_a = pointer(number) >>> pointer_b = pointer(number)
In the above, it's only safe for one object to read and write to the address at once if the GIL is disabled. So, ``pointer_a`` can be shared and written to across multiple threads, but only if ``pointer_b``
is not also attempting to ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
32e4fada-4bd1-4cb2-b9a7-b522080dbaa7 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,434 | supabase-export-v2 | fe187cb985c526c1 | in mind that retrieving sub-objects from Structure, Unions, and Arrays doesn't *copy* the sub-object, instead it retrieves a wrapper object accessing the root-object's underlying buffer.
Another example that may behave differently from what one would expect is this:: | trusted_official_docs | CPython Docs | in mind that retrieving sub-objects from Structure, Unions, and Arrays doesn't *copy* the sub-object, instead it retrieves a wrapper object accessing the root-object's underlying buffer.
Another example that may behave differently from what one would expect is this:: | in mind that retrieving sub-objects from Structure, Unions, and Arrays doesn't *copy* the sub-object, instead it retrieves a wrapper object accessing the root-object's underlying buffer.
Another example that may behave differently from what one would expect is this:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
331c49d5-a545-405f-9171-dd3bbf11a898 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,810 | supabase-export-v2 | bff76eef3f76a866 | .. class:: c_uint
Represents the C :c:expr:`unsigned int` datatype. The constructor accepts an
optional integer initializer; no overflow checking is done. On platforms
where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`. | trusted_official_docs | CPython Docs | .. class:: c_uint
Represents the C :c:expr:`unsigned int` datatype. The constructor accepts an
optional integer initializer; no overflow checking is done. On platforms
where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`. | .. class:: c_uint
Represents the C :c:expr:`unsigned int` datatype. The constructor accepts an
optional integer initializer; no overflow checking is done. On platforms
where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
33d066d2-b8ac-4d4e-a742-1712cd892f94 | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,724 | supabase-export-v2 | a48503a5e9ae8285 | specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a :exc:`ValueError` is raised.
.. audit-event:: ctypes.cdata/buffer pointer,size,offset ctypes._CData.from_buffer | trusted_official_docs | CPython Docs | specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a :exc:`ValueError` is raised.
.. audit-event:: ctypes.cdata/buffer pointer,size,offset ctypes._CData.from_buffer | specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a :exc:`ValueError` is raised.
.. audit-event:: ctypes.cdata/buffer pointer,size,offset ctypes._CData.from_buffer | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
340197e1-b6ff-4749-96a4-d2575496195f | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,747 | supabase-export-v2 | 4316a99ec29bd44c | .. attribute:: _objects
This member is either ``None`` or a dictionary containing Python objects
that need to be kept alive so that the memory block contents is kept
valid. This object is only exposed for debugging; never modify the
contents of this dictionary. | trusted_official_docs | CPython Docs | .. attribute:: _objects
This member is either ``None`` or a dictionary containing Python objects
that need to be kept alive so that the memory block contents is kept
valid. This object is only exposed for debugging; never modify the
contents of this dictionary. | .. attribute:: _objects
This member is either ``None`` or a dictionary containing Python objects
that need to be kept alive so that the memory block contents is kept
valid. This object is only exposed for debugging; never modify the
contents of this dictionary. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35cb1093-eedd-4496-b0a9-26601340c8cd | CPython Docs | file://datasets/cpython/Doc/library/ctypes.rst | unknown | e6da9521-72d3-4c05-ab3f-df7c68f7662d | 39,537 | supabase-export-v2 | dbb4e3cb587c33ea | >>> from ctypes.util import find_library >>> find_library("m") 'libm.so.6' >>> find_library("c") 'libc.so.6' >>> find_library("bz2") 'libbz2.so.1.0' >>>
On macOS and Android, :func:`!find_library` uses the system's
standard naming schemes and paths to locate the library, and returns a full
pathname if successful:: | trusted_official_docs | CPython Docs | >>> from ctypes.util import find_library >>> find_library("m") 'libm.so.6' >>> find_library("c") 'libc.so.6' >>> find_library("bz2") 'libbz2.so.1.0' >>>
On macOS and Android, :func:`!find_library` uses the system's
standard naming schemes and paths to locate the library, and returns a full
pathname if successful:: | >>> from ctypes.util import find_library >>> find_library("m") 'libm.so.6' >>> find_library("c") 'libc.so.6' >>> find_library("bz2") 'libbz2.so.1.0' >>>
On macOS and Android, :func:`!find_library` uses the system's
standard naming schemes and paths to locate the library, and returns a full
pathname if successful:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.