Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module struct support for ssize_t and size_t #47413

Closed
MrJean1 mannequin opened this issue Jun 21, 2008 · 20 comments
Closed

module struct support for ssize_t and size_t #47413

MrJean1 mannequin opened this issue Jun 21, 2008 · 20 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@MrJean1
Copy link
Mannequin

MrJean1 mannequin commented Jun 21, 2008

BPO 3163
Nosy @loewis, @mdickinson, @pitrou, @skrah, @meadori
Files
  • struct_size_t.rev2.patch: revised patch
  • struct_nn.patch
  • struct_nn2.patch
  • struct_nn3.patch
  • struct_nn4.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2011-10-06.13:31:55.192>
    created_at = <Date 2008-06-21.18:05:48.427>
    labels = ['type-feature', 'library']
    title = 'module struct support for ssize_t and size_t'
    updated_at = <Date 2011-10-06.13:31:55.191>
    user = 'https://bugs.python.org/MrJean1'

    bugs.python.org fields:

    activity = <Date 2011-10-06.13:31:55.191>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-10-06.13:31:55.192>
    closer = 'pitrou'
    components = ['Library (Lib)']
    creation = <Date 2008-06-21.18:05:48.427>
    creator = 'MrJean1'
    dependencies = []
    files = ['10690', '23310', '23311', '23312', '23318']
    hgrepos = []
    issue_num = 3163
    keywords = ['patch']
    message_count = 20.0
    messages = ['68528', '68530', '68531', '107799', '107800', '110313', '110330', '110385', '112867', '144885', '144886', '144888', '144891', '144892', '144893', '144936', '144950', '144978', '145009', '145010']
    nosy_count = 7.0
    nosy_names = ['loewis', 'mark.dickinson', 'pitrou', 'MrJean1', 'skrah', 'meador.inge', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue3163'
    versions = ['Python 3.3']

    @MrJean1
    Copy link
    Mannequin Author

    MrJean1 mannequin commented Jun 21, 2008

    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'.

    @MrJean1 MrJean1 mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jun 21, 2008
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jun 21, 2008

    Now that Python 2.6 is in beta, new features should be deferred to 2.7.

    @MrJean1
    Copy link
    Mannequin Author

    MrJean1 mannequin commented Jun 21, 2008

    Please ignore the first patch. Use the rev2 patch which includes an
    update for test file Lib/test/test_struct.py as well.

    @mdickinson mdickinson self-assigned this Jun 14, 2010
    @mdickinson
    Copy link
    Member

    mdickinson commented Jun 14, 2010

    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.

    @mdickinson
    Copy link
    Member

    mdickinson commented Jun 14, 2010

    To avoid clashing with PEP-3118, we could use 'n' and 'N' instead of 'z' and 'Z'.

    @mdickinson
    Copy link
    Member

    mdickinson commented Jul 14, 2010

    Jean, if you're still around:

    Do you still have interest in pursuing this?

    @MrJean1
    Copy link
    Mannequin Author

    MrJean1 mannequin commented Jul 14, 2010

    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\>


    @MrJean1
    Copy link
    Mannequin Author

    MrJean1 mannequin commented Jul 15, 2010

    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.

    @mdickinson
    Copy link
    Member

    mdickinson commented Aug 4, 2010

    Okay; would you be interested in updating your patch?

    @pitrou
    Copy link
    Member

    pitrou commented Oct 4, 2011

    bpo-3163 is a duplicate.

    @pitrou
    Copy link
    Member

    pitrou commented Oct 4, 2011

    Ooops, I meant bpo-13098.

    @pitrou
    Copy link
    Member

    pitrou commented Oct 4, 2011

    Here is a patch.

    @meadori
    Copy link
    Member

    meadori commented Oct 4, 2011

    Mostly LGTM. I have a few comments in rietveld.

    @pitrou
    Copy link
    Member

    pitrou commented Oct 4, 2011

    Thanks. I have answered one of your comments, and here is a new patch.

    @pitrou
    Copy link
    Member

    pitrou commented Oct 4, 2011

    New patch with cosmetic doc fix.

    @meadori
    Copy link
    Member

    meadori commented Oct 5, 2011

    Found a few test case nits. Comments in rietveld.

    @pitrou
    Copy link
    Member

    pitrou commented Oct 5, 2011

    Thanks for the comments. Here is an updated patch.

    @mdickinson mdickinson removed their assignment Oct 5, 2011
    @meadori
    Copy link
    Member

    meadori commented Oct 6, 2011

    No problem. This last version LGTM.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 6, 2011

    New changeset db3e15017172 by Antoine Pitrou in branch 'default':
    Issue bpo-3163: The struct module gets new format characters 'n' and 'N'
    http://hg.python.org/cpython/rev/db3e15017172

    @pitrou
    Copy link
    Member

    pitrou commented Oct 6, 2011

    Thanks for the reviews!

    @pitrou pitrou closed this as completed Oct 6, 2011
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants