This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: ctypes docs: Unimplemented and undocumented features
Type: enhancement Stage: resolved
Components: ctypes, Documentation Versions: Python 3.6, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: ahknight, amaury.forgeotdarc, belopolsky, berker.peksag, docs@python, dpg, faustinl, georg.brandl, martin.panter, meador.inge, python-dev, syeberman
Priority: normal Keywords: patch

Created on 2013-09-15 11:57 by syeberman, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
75843d82f6cf.diff syeberman, 2013-09-15 11:58 review
arrays-pointers.patch martin.panter, 2014-08-01 05:54 review
arrays-pointers.v3.patch martin.panter, 2015-02-21 06:19 review
Pull Requests
URL Status Linked Edit
PR 25480 merged dpg, 2021-04-20 11:28
Repositories containing patches
Messages (10)
msg197764 - (view) Author: Sye van der Veen (syeberman) * Date: 2013-09-15 11:57
In the ctypes documentation, there's mention of a BigEndianUnion/LittleEndianUnion that isn't actually implemented, and the "Arrays and pointers" section just reads "Not yet written".

The attached patch adds the (Big|Little)EndianUnion classes (with tests), finishes the Array/_Pointer class docs (and adds missing cases to the tests), and makes some stylistic improvements to docs.

The patch was made against default, but it's quite likely it could be back-ported all the way to Python 3.1.
msg197971 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-09-17 08:28
Thanks for the patch! The amount of unrelated changes (mostly removing ">>>" empty prompts) makes this a bit hard to review.

Also, I don't think it is too important to link to the "ctypes" module from within the docs of ctypes :)

Please separate out the implementation of the Union classes into a separate patch.

The Array docs look good to me.  The _Pointer docs talk about "reading and writing the elements using standard subscript and slice accesses".  That is true for pointers pointing to arrays, but ".contents" should be mentioned as well.
msg209211 - (view) Author: Adam Knight (ahknight) Date: 2014-01-25 15:52
Can someone add this in?  What needs to be done to make it happen? Kind of need this for a project I'm working on...
msg224469 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2014-08-01 05:54
Here is the patch stripped of all the noise and the structure and union stuff, so you can see just the changes related to arrays and pointers. However I have not attempted to apply the patch, nor addressed Georg’s comment about the “contents” attribute.
msg236353 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-02-21 06:19
Posting a new patch, rebased against the recent “default” (3.5) branch:

* Tweaked so that sentences start with a capital letter
* Added _Pointer.contents
msg254587 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-11-13 04:28
Sye van der Veen: can you sign a contributor agreement <>? I think it might be needed for this patch.
msg254605 - (view) Author: Sye van der Veen (syeberman) * Date: 2015-11-13 14:34
Signed and confirmed. :-)

On Thu, Nov 12, 2015 at 11:28 PM Martin Panter <>

> Martin Panter added the comment:
> Sye van der Veen: can you sign a contributor agreement <
>>? I think it might be
> needed for this patch.
> ----------
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
msg259121 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-28 10:35
New changeset 732fdd03e708 by Martin Panter in branch '3.5':
Issue #19023: Document ctypes array and pointer classes

New changeset a78cbb2125a8 by Martin Panter in branch 'default':
Issue #19023: Merge ctypes doc and tests from 3.5
msg259174 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-28 23:21
New changeset 034b077d3015 by Martin Panter in branch '2.7':
Issue #19023: Document ctypes array and pointer classes
msg259175 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-01-28 23:31
Okay I have committed the Array and _Pointer stuff. I suggest if anyone wants to work on the Union classes, they open a separate report. (I never understood what they are for. C doesn’t have much little or big endian stuff; byte order mostly depends on the ABI, so why is ctypes different?)
Date User Action Args
2022-04-11 14:57:50adminsetgithub: 63223
2021-04-20 11:28:05dpgsetnosy: + dpg

pull_requests: + pull_request24205
2016-01-28 23:31:03martin.pantersetstatus: open -> closed
versions: + Python 2.7, Python 3.6, - Python 3.4
messages: + msg259175

resolution: fixed
stage: patch review -> resolved
2016-01-28 23:21:49python-devsetmessages: + msg259174
2016-01-28 10:35:09python-devsetnosy: + python-dev
messages: + msg259121
2015-11-13 14:34:41syebermansetmessages: + msg254605
2015-11-13 04:28:40martin.pantersetmessages: + msg254587
2015-03-30 00:34:50berker.peksagsetnosy: + berker.peksag

components: - Tests
versions: + Python 3.4, Python 3.5
2015-03-24 09:10:41martin.pantersetstage: patch review
2015-02-21 06:19:28martin.pantersetfiles: + arrays-pointers.v3.patch

messages: + msg236353
2014-08-01 05:54:24martin.pantersetfiles: + arrays-pointers.patch
nosy: + martin.panter
messages: + msg224469

2014-01-27 00:39:07berker.peksagsetnosy: + amaury.forgeotdarc, belopolsky, meador.inge
2014-01-25 15:52:55ahknightsetnosy: + ahknight
messages: + msg209211
2014-01-03 16:14:46faustinlsetnosy: + faustinl
2013-09-17 08:28:17georg.brandlsetnosy: + georg.brandl
messages: + msg197971
2013-09-15 11:58:47syebermansetfiles: + 75843d82f6cf.diff
keywords: + patch
2013-09-15 11:57:50syebermancreate