Issue 3163: module struct support for ssize_t and size_t (original) (raw)

Created on 2008-06-21 18:05 by MrJean1, last changed 2022-04-11 14:56 by admin. 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) (Python triager) 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
2022-04-11 14:56:35 admin set github: 47413
2011-10-06 13:31:55 pitrou set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2011-10-06 13:31:23 python-dev set nosy: + python-devmessages: +
2011-10-06 00:28:18 meador.inge set messages: +
2011-10-05 14🔞37 mark.dickinson set assignee: mark.dickinson ->
2011-10-05 13:46:53 pitrou set files: + struct_nn4.patchmessages: +
2011-10-05 02:41:47 meador.inge set messages: +
2011-10-04 14:54:44 pitrou set files: + struct_nn3.patchmessages: +
2011-10-04 14:34:12 pitrou set files: + struct_nn2.patchmessages: +
2011-10-04 14:26:37 meador.inge set nosy: + meador.ingemessages: + stage: needs patch -> patch review
2011-10-04 12:41:27 pitrou set files: + struct_nn.patchmessages: +
2011-10-04 12:21:09 skrah set nosy: + skrah
2011-10-04 12:08:49 pitrou set messages: +
2011-10-04 12:08:27 pitrou set priority: low -> normalnosy: + pitroumessages: + stage: patch review -> needs patch
2011-10-04 12:08:00 pitrou link issue13098 superseder
2011-01-06 15:53:56 pitrou set nosy:loewis, mark.dickinson, MrJean1versions: + Python 3.3, - Python 3.2
2010-08-04 19:12:11 mark.dickinson set messages: +
2010-07-15 18:29:50 MrJean1 set messages: +
2010-07-15 18:22:05 MrJean1 set files: - unnamed
2010-07-14 21:12:40 MrJean1 set files: + unnamedmessages: +
2010-07-14 19:09:32 mark.dickinson set priority: normal -> low
2010-07-14 19:08:47 mark.dickinson set messages: +
2010-06-14 16:55:34 mark.dickinson set messages: +
2010-06-14 16:55:05 mark.dickinson set messages: +
2010-06-14 15:26:44 mark.dickinson set versions: - Python 2.7
2010-06-14 14:30:49 mark.dickinson set assignee: mark.dickinsonnosy: + mark.dickinson
2009-05-16 20:34:02 ajaksu2 set priority: normalstage: patch reviewversions: + Python 3.2
2008-10-07 17:47:07 MrJean1 set versions: + Python 2.7, - Python 2.5.3
2008-10-07 17:44:11 MrJean1 set versions: + Python 2.5.3, - Python 2.7
2008-06-21 18:26:35 MrJean1 set files: - struct_size_t.patch
2008-06-21 18:26:27 MrJean1 set files: + struct_size_t.rev2.patchmessages: +
2008-06-21 18:17:46 loewis set nosy: + loewismessages: + versions: + Python 2.7, - Python 2.6
2008-06-21 18:05:48 MrJean1 create