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

Adding support for _Bool to ctypes as c_bool #44534

Closed
chmod007 mannequin opened this issue Jan 31, 2007 · 6 comments
Closed

Adding support for _Bool to ctypes as c_bool #44534

chmod007 mannequin opened this issue Jan 31, 2007 · 6 comments
Assignees
Labels
extension-modules C modules in the Modules dir

Comments

@chmod007
Copy link
Mannequin

chmod007 mannequin commented Jan 31, 2007

BPO 1649190
Nosy @loewis, @theller
Files
  • c_bool patch against r53606.diff: Patch relative to revision 53606
  • c_bool patch against r53623.diff: Patch relative to revision 53623 -- addressing thomas' review
  • 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 = 'https://github.com/theller'
    closed_at = <Date 2007-03-13.20:45:04.000>
    created_at = <Date 2007-01-31.21:04:22.000>
    labels = ['extension-modules']
    title = 'Adding support for _Bool to ctypes as c_bool'
    updated_at = <Date 2007-03-13.20:45:04.000>
    user = 'https://bugs.python.org/chmod007'

    bugs.python.org fields:

    activity = <Date 2007-03-13.20:45:04.000>
    actor = 'theller'
    assignee = 'theller'
    closed = True
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2007-01-31.21:04:22.000>
    creator = 'chmod007'
    dependencies = []
    files = ['7748', '7749']
    hgrepos = []
    issue_num = 1649190
    keywords = ['patch']
    message_count = 6.0
    messages = ['51825', '51826', '51827', '51828', '51829', '51830']
    nosy_count = 3.0
    nosy_names = ['loewis', 'theller', 'chmod007']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1649190'
    versions = ['Python 2.6']

    @chmod007
    Copy link
    Mannequin Author

    chmod007 mannequin commented Jan 31, 2007

    Adds support for the C99 _Bool type to ctypes. Requires struct patch that has already been accepted in the python 2.6 train.

    Updates ctypes C extension, ctypes __init__.py, ctypes documentation and ctypes tests.

    @chmod007 chmod007 mannequin closed this as completed Jan 31, 2007
    @chmod007 chmod007 mannequin assigned theller Jan 31, 2007
    @chmod007 chmod007 mannequin added the extension-modules C modules in the Modules dir label Jan 31, 2007
    @chmod007 chmod007 mannequin closed this as completed Jan 31, 2007
    @chmod007 chmod007 mannequin assigned theller Jan 31, 2007
    @chmod007 chmod007 mannequin added the extension-modules C modules in the Modules dir label Jan 31, 2007
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jan 31, 2007

    Thomas, can you take a look?

    I think this needs to take into account Python versions without bool support in the struct module, as the same ctypes code is used with older Python releases as well.

    @chmod007
    Copy link
    Mannequin Author

    chmod007 mannequin commented Feb 1, 2007

    Should I prepare the patch relative to /ctypes/trunk/ctypes instead?

    @theller
    Copy link

    theller commented Feb 1, 2007

    David, I encountered these issues with the patch:

    1. a typo in Lib/ctypes/test/test_numbers.py:
      'bool_type' should be 'bool_types'
      It is trivial to fix this.

    2. ctypes/init.py should be cean for 'from ctypes import *',
      but with your patch it exposes the 'struct_error' symbol.

      I would recommend to change Modules/_ctypes/cfield.c so that a
      c_bool type can be created even if HAVE_C99_BOOL is undefined (I think
      you took that approach in your _Bool struct patch).

      Then, ctypes/init.py would not have to depend on the struct 't'
      typecode at all. The '_check_size(c_bool, "t")' check can probably be
      removed.

    3. ctypes/test/test_repr.py does not work.

      Easy to fix this: just add c_bool to the list of types starting
      at line 5.

    These changes would also ensure compatibility with previous Python
    versions, with one exception: A check for the _Bool type must be added
    to Modules/ctypes/libffi/configure.in.

    To answer your question: No, it is not needed to prepare a patch
    relative to ctypes/trunk/ctypes. This repository contains
    svn:external properties for the 'source' and 'ctypes' directories that
    point into the 'release25-maint/Modules/_ctypes' and
    'release25-maint/Lib/ctypes' directories from Python.

    @chmod007
    Copy link
    Mannequin Author

    chmod007 mannequin commented Feb 2, 2007

    Thanks for the review, Thomas! I've attached a new patch that addresses the points you bring up (I hope) in the suggested manner. I have not tested it on 2.5, but tests pass on 2.6.
    File Added: c_bool patch against r53623.diff

    @theller
    Copy link

    theller commented Mar 13, 2007

    Committed as revision 54357. Thanks for the patch.

    @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
    extension-modules C modules in the Modules dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant