classification
Title: module struct support for ssize_t and size_t
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: MrJean1, loewis, mark.dickinson, meador.inge, pitrou, python-dev, skrah
Priority: normal Keywords: patch

Created on 2008-06-21 18:05 by MrJean1, last changed 2011-10-06 13:31 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
struct_size_t.rev2.patch MrJean1, 2008-06-21 18:26 revised patch
struct_nn.patch pitrou, 2011-10-04 12:41 review
struct_nn2.patch pitrou, 2011-10-04 14:34 review
struct_nn3.patch pitrou, 2011-10-04 14:54 review
struct_nn4.patch pitrou, 2011-10-05 13:46 review
Messages (20)
msg68528 - (view) Author: Jean Brouwers (MrJean1) Date: 2008-06-21 18:05
Attached is a (simplistic) patch for the struct module to support C types 
ssize_t and size_t with format characters 'z' resp. 'Z'.

The patch updates Python 2.6b1 files Modules/_struct.c and 
Doc/library/struct.rst.

Note, format character 'Z' is also proposed in PEP 3118 for C type complex  
and that has to be something else, perhaps 'C'.
msg68530 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-06-21 18:17
Now that Python 2.6 is in beta, new features should be deferred to 2.7.
msg68531 - (view) Author: Jean Brouwers (MrJean1) Date: 2008-06-21 18:26
Please ignore the first patch.  Use the rev2 patch which includes an 
update for test file  Lib/test/test_struct.py as well.
msg107799 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-06-14 16:55
The proposed addition seems reasonable to me, for native packing and unpacking.

For standard mode packing and unpacking, I don't see the point;  we'd have to pick a standard size, which would almost certainly be either 4 or 8, and so would already be covered by either the 'iI' or the 'qQ' codes.  So I'd suggest adding the size_t/ssize_t codes only for native mode, and leaving them unsupported for the standard modes.
msg107800 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-06-14 16:55
To avoid clashing with PEP 3118, we could use 'n' and 'N' instead of 'z' and 'Z'.
msg110313 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-07-14 19:08
Jean, if you're still around:

Do you still have interest in pursuing this?
msg110330 - (view) Author: Jean Brouwers (MrJean1) Date: 2010-07-14 21:12
Yes I am and I will get back to you on this after check my (old) notes.

/Jean

On Wed, Jul 14, 2010 at 12:08 PM, Mark Dickinson <report@bugs.python.org>wrote:

>
> Mark Dickinson <dickinsm@gmail.com> added the comment:
>
> Jean, if you're still around:
>
> Do you still have interest in pursuing this?
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue3163>
> _______________________________________
>
msg110385 - (view) Author: Jean Brouwers (MrJean1) Date: 2010-07-15 18:29
It would be sufficient to support size_t/ssize_t in native mode for my usage.  The workaround I have been using is in this recipe

  <http://code.activestate.com/recipes/546530/>

in the function calcsize.  That maps the 'z' and 'Z' format to either 'l', 'L' or 'P' for lack of anything better.
msg112867 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-04 19:12
Okay;  would you be interested in updating your patch?
msg144885 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-04 12:08
#3163 is a duplicate.
msg144886 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-04 12:08
Ooops, I meant #13098.
msg144888 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-04 12:41
Here is a patch.
msg144891 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2011-10-04 14:26
Mostly LGTM.  I have a few comments in rietveld.
msg144892 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-04 14:34
Thanks. I have answered one of your comments, and here is a new patch.
msg144893 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-04 14:54
New patch with cosmetic doc fix.
msg144936 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2011-10-05 02:41
Found a few test case nits.  Comments in rietveld.
msg144950 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-05 13:46
Thanks for the comments. Here is an updated patch.
msg144978 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2011-10-06 00:28
No problem.  This last version LGTM.
msg145009 - (view) Author: Roundup Robot (python-dev) Date: 2011-10-06 13:31
New changeset db3e15017172 by Antoine Pitrou in branch 'default':
Issue #3163: The struct module gets new format characters 'n' and 'N'
http://hg.python.org/cpython/rev/db3e15017172
msg145010 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-06 13:31
Thanks for the reviews!
History
Date User Action Args
2011-10-06 13:31:55pitrousetstatus: open -> closed
resolution: fixed
messages: + msg145010

stage: patch review -> resolved
2011-10-06 13:31:23python-devsetnosy: + python-dev
messages: + msg145009
2011-10-06 00:28:18meador.ingesetmessages: + msg144978
2011-10-05 14:18:37mark.dickinsonsetassignee: mark.dickinson ->
2011-10-05 13:46:53pitrousetfiles: + struct_nn4.patch

messages: + msg144950
2011-10-05 02:41:47meador.ingesetmessages: + msg144936
2011-10-04 14:54:44pitrousetfiles: + struct_nn3.patch

messages: + msg144893
2011-10-04 14:34:12pitrousetfiles: + struct_nn2.patch

messages: + msg144892
2011-10-04 14:26:37meador.ingesetnosy: + meador.inge

messages: + msg144891
stage: needs patch -> patch review
2011-10-04 12:41:27pitrousetfiles: + struct_nn.patch

messages: + msg144888
2011-10-04 12:21:09skrahsetnosy: + skrah
2011-10-04 12:08:49pitrousetmessages: + msg144886
2011-10-04 12:08:27pitrousetpriority: low -> normal

nosy: + pitrou
messages: + msg144885

stage: patch review -> needs patch
2011-10-04 12:08:00pitroulinkissue13098 superseder
2011-01-06 15:53:56pitrousetnosy: loewis, mark.dickinson, MrJean1
versions: + Python 3.3, - Python 3.2
2010-08-04 19:12:11mark.dickinsonsetmessages: + msg112867
2010-07-15 18:29:50MrJean1setmessages: + msg110385
2010-07-15 18:22:05MrJean1setfiles: - unnamed
2010-07-14 21:12:40MrJean1setfiles: + unnamed

messages: + msg110330
2010-07-14 19:09:32mark.dickinsonsetpriority: normal -> low
2010-07-14 19:08:47mark.dickinsonsetmessages: + msg110313
2010-06-14 16:55:34mark.dickinsonsetmessages: + msg107800
2010-06-14 16:55:05mark.dickinsonsetmessages: + msg107799
2010-06-14 15:26:44mark.dickinsonsetversions: - Python 2.7
2010-06-14 14:30:49mark.dickinsonsetassignee: mark.dickinson

nosy: + mark.dickinson
2009-05-16 20:34:02ajaksu2setpriority: normal
stage: patch review
versions: + Python 3.2
2008-10-07 17:47:07MrJean1setversions: + Python 2.7, - Python 2.5.3
2008-10-07 17:44:11MrJean1setversions: + Python 2.5.3, - Python 2.7
2008-06-21 18:26:35MrJean1setfiles: - struct_size_t.patch
2008-06-21 18:26:27MrJean1setfiles: + struct_size_t.rev2.patch
messages: + msg68531
2008-06-21 18:17:46loewissetnosy: + loewis
messages: + msg68530
versions: + Python 2.7, - Python 2.6
2008-06-21 18:05:48MrJean1create