Skip to content

types module can be implemented only in Python #46660

Closed

Description

@benjaminp
BPO 2408
Nosy @amauryfa, @tiran, @benjaminp
Files
  • expose_cell.patch: exposes cell objects
  • expose_cell_python.patch: better implementation
  • types_in_python.diff: makes the types module use python only
  • 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 2008-04-08.22:09:42.495>
    created_at = <Date 2008-03-18.21:09:29.487>
    labels = ['interpreter-core', 'type-feature', 'library']
    title = 'types module can be implemented only in Python'
    updated_at = <Date 2008-04-08.22:09:42.487>
    user = 'https://github.com/benjaminp'

    bugs.python.org fields:

    activity = <Date 2008-04-08.22:09:42.487>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-04-08.22:09:42.495>
    closer = 'amaury.forgeotdarc'
    components = ['Interpreter Core', 'Library (Lib)']
    creation = <Date 2008-03-18.21:09:29.487>
    creator = 'benjamin.peterson'
    dependencies = []
    files = ['9740', '9743', '9745']
    hgrepos = []
    issue_num = 2408
    keywords = ['patch']
    message_count = 7.0
    messages = ['63988', '64001', '64003', '64004', '64007', '64252', '65221']
    nosy_count = 3.0
    nosy_names = ['amaury.forgeotdarc', 'christian.heimes', 'benjamin.peterson']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue2408'
    versions = ['Python 2.6']

    Activity

    1. benjaminp commented on Mar 18, 2008

      @benjaminp
      ContributorAuthor

      types currently exposes all types used by the interpreter except cell
      objects. This patch adds support for that and adds to the docs. I
      couldn't find a way to access the cell type through Python, so I added
      it to the _types module.

    2. added
      interpreter-core
      stdlib
      type-feature
      on Mar 18, 2008
    3. amauryfa commented on Mar 18, 2008

      @amauryfa
      Contributor

      The following python code retrieves the cell type, and could be added to
      types.py:

      def _f(x=None):
         def g():
            x
         return g
      
      CellType = type(_f().func_closure[0])

      OTOH, you are unlikely to need it. Do you have a use case, or is it just
      to have the full list of types?

    4. amauryfa commented on Mar 18, 2008

      @amauryfa
      Contributor

      While I'm at it, the _types module could be removed, because its exports
      can easily be replaced by:

      GetSetDescriptorType = type(Exception.args)
      MemberDescriptorType = type(EnvironmentError.errno)
    5. benjaminp commented on Mar 18, 2008

      @benjaminp
      ContributorAuthor

      I've attached a patch which uses the Amaury's implementation.

      OTOH, you are unlikely to need it. Do you have a use case, or is it just
      to have the full list of types?
      Mostly, I want a full list of types.

    6. benjaminp commented on Mar 18, 2008

      @benjaminp
      ContributorAuthor

      Okay, I removed the _types module in favor of your Python
      implementation. Here's the patch.

    7. changed the title [-]types should expose cell object[/-] [+]types module can be implemented only in Python[/+] on Mar 18, 2008
    8. tiran commented on Mar 21, 2008

      @tiran
      Member

      Please have a look at patch bpo-1605, too. It implements a semi
      autogenerated _types module which exposes all types in from Include/*.h

    9. amauryfa commented on Apr 8, 2008

      @amauryfa
      Contributor

      Committed r62231: remove _types module.

      I did not add CellType though, because of discussion in bpo-1605.

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      interpreter-corestdlibtype-feature

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions