[issue19023] ctypes docs: Unimplemented and undocumented features
New submission from Sye van der Veen:
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.
----------
assignee: docs@python
components: Documentation, Tests, ctypes
hgrepos: 209
messages: 197764
nosy: docs@python, syeberman
priority: normal
severity: normal
status: open
title: ctypes docs: Unimplemented and undocumented features
type: enhancement
_______________________________________
Python tracker
Changes by Sye van der Veen
Georg Brandl added the comment:
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.
----------
nosy: +georg.brandl
_______________________________________
Python tracker
Changes by Luca Faustin
Adam Knight added the comment:
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...
----------
nosy: +ahknight
_______________________________________
Python tracker
Changes by Berker Peksag
Martin Panter added the comment:
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.
----------
nosy: +vadmium
Added file: http://bugs.python.org/file36188/arrays-pointers.patch
_______________________________________
Python tracker
Martin Panter added the comment:
Posting a new patch, rebased against the recent “default” (3.5) branch:
* Tweaked so that sentences start with a capital letter
* Added _Pointer.contents
----------
Added file: http://bugs.python.org/file38195/arrays-pointers.v3.patch
_______________________________________
Python tracker
Changes by Martin Panter
Changes by Berker Peksag
Martin Panter added the comment:
Sye van der Veen: can you sign a contributor agreement https://www.python.org/psf/contrib/contrib-form/? I think it might be needed for this patch.
----------
_______________________________________
Python tracker
Sye van der Veen added the comment:
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 < https://www.python.org/psf/contrib/contrib-form/>? I think it might be needed for this patch.
----------
_______________________________________ Python tracker
http://bugs.python.org/issue19023 _______________________________________
----------
_______________________________________
Python tracker
Roundup Robot added the comment:
New changeset 732fdd03e708 by Martin Panter in branch '3.5':
Issue #19023: Document ctypes array and pointer classes
https://hg.python.org/cpython/rev/732fdd03e708
New changeset a78cbb2125a8 by Martin Panter in branch 'default':
Issue #19023: Merge ctypes doc and tests from 3.5
https://hg.python.org/cpython/rev/a78cbb2125a8
----------
nosy: +python-dev
_______________________________________
Python tracker
Roundup Robot added the comment:
New changeset 034b077d3015 by Martin Panter in branch '2.7':
Issue #19023: Document ctypes array and pointer classes
https://hg.python.org/cpython/rev/034b077d3015
----------
_______________________________________
Python tracker
Martin Panter added the comment:
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?)
----------
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 2.7, Python 3.6 -Python 3.4
_______________________________________
Python tracker
Change by David Goncalves
участники (8)
-
Adam Knight
-
Berker Peksag
-
David Goncalves
-
Georg Brandl
-
Luca Faustin
-
Martin Panter
-
Roundup Robot
-
Sye van der Veen