Skip to content

import C API mess #37769

Closed
Closed

Description

@gvanrossum
BPO 667770
Nosy @brettcannon
Dependencies
  • bpo-2377: Replace import w/ importlib.import
  • 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/brettcannon'
    closed_at = <Date 2012-11-17.16:14:07.136>
    created_at = <Date 2003-01-14.15:02:56.000>
    labels = ['interpreter-core', 'type-feature']
    title = 'import C API mess'
    updated_at = <Date 2012-11-17.16:14:07.134>
    user = 'https://github.com/gvanrossum'

    bugs.python.org fields:

    activity = <Date 2012-11-17.16:14:07.134>
    actor = 'brett.cannon'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2012-11-17.16:14:07.136>
    closer = 'brett.cannon'
    components = ['Interpreter Core']
    creation = <Date 2003-01-14.15:02:56.000>
    creator = 'gvanrossum'
    dependencies = ['2377']
    files = []
    hgrepos = []
    issue_num = 667770
    keywords = []
    message_count = 4.0
    messages = ['60301', '63892', '63896', '175766']
    nosy_count = 1.0
    nosy_names = ['brett.cannon']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue667770'
    versions = ['Python 3.2']

    Activity

    1. gvanrossum commented on Jan 14, 2003

      @gvanrossum
      MemberAuthor

      There are too many different C-level APIs for importing
      a module.

      Many of them have the nasty property that they can try
      to do a relative import in the context of the nearest
      Python stack frame, where that is not what the C code
      intended.

      This needs to be cleaned up.

      Example use case: time.strptime() is now a C wrapper
      that imports the _strptime module; but if you follow
      the path it takes to import, it's quite an amazing
      journey. It should cut all of that short by looking in
      sys.modules['_strptime'] first. (But what about
      restricted execution? Well _strptime.py ought to be safe.)

    2. gvanrossum commented on Mar 18, 2008

      @gvanrossum
      MemberAuthor

      Brett, perhaps you can consider this with your integration of
      import-rewritten-in-Python? I think it's fine to leave this alone for 2.6.

    3. brettcannon commented on Mar 18, 2008

      @brettcannon
      Member

      I was planning to do that in order to make my life simpler when I have
      to re-implement the C API.

    4. brettcannon commented on Nov 17, 2012

      @brettcannon
      Member

      The story of impports from the C level is much more sane than back in the 2.6 days thanks to PyImport_Import, PyImport_ImportModuleLevelObject, and PyImport_ImportModuleLevel.

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

    Metadata

    Metadata

    Assignees

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions