Skip to content

'exceptions' import fixer #46603

Closed
Closed

Description

@brettcannon
BPO 2350
Nosy @loewis, @brettcannon, @jcea, @cjmayo, @benjaminp, @berkerpeksag, @iritkatriel
Superseder
  • bpo-45544: Close 2to3 issues and list them here
  • Files
  • exceptions_fixer.patch
  • issue2350.diff
  • 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 2021-10-20.23:05:39.072>
    created_at = <Date 2008-03-17.19:22:08.317>
    labels = ['3.8', 'type-feature', 'expert-2to3', '3.9', '3.10']
    title = "'exceptions' import fixer"
    updated_at = <Date 2021-10-20.23:05:39.072>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2021-10-20.23:05:39.072>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-20.23:05:39.072>
    closer = 'iritkatriel'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2008-03-17.19:22:08.317>
    creator = 'brett.cannon'
    dependencies = []
    files = ['11251', '28494']
    hgrepos = []
    issue_num = 2350
    keywords = []
    message_count = 11.0
    messages = ['63718', '63769', '71886', '71902', '71949', '72971', '172772', '172773', '178590', '178591', '379318']
    nosy_count = 9.0
    nosy_names = ['loewis', 'brett.cannon', 'collinwinter', 'jcea', 'cjmayo', 'benjamin.peterson', 'douglas', 'berker.peksag', 'iritkatriel']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = '45544'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue2350'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    Activity

    1. brettcannon commented on Mar 17, 2008

      @brettcannon
      MemberAuthor

      Importing 'exceptions' should raise at least a Py3K warning, if not a
      full DeprecationWarning.

    2. douglas commented on Mar 17, 2008

      douglasmannequin
      Mannequin

      I ran python through a debugger and found that the exceptions module is
      imported automatically at load time. Because of this, when "import
      exceptions" is parsed, the module is already loaded, and PyImport_Import
      is not called. In order to correct this, we'll have to either catch
      this at the AST, or just handle it in 2to3...

    3. benjaminp commented on Aug 24, 2008

      @benjaminp
      Contributor

      I'm not sure how we could implement a warning on import of exceptions
      aside from implementing it in the compiler. I suppose 2to3 could just
      remove the import...

    4. brettcannon commented on Aug 24, 2008

      @brettcannon
      MemberAuthor

      On Sun, Aug 24, 2008 at 2:51 PM, Benjamin Peterson
      <report@bugs.python.org> wrote:

      Benjamin Peterson <musiccomposition@gmail.com> added the comment:

      I'm not sure how we could implement a warning on import of exceptions
      aside from implementing it in the compiler. I suppose 2to3 could just
      remove the import...

      ... and would also have to change all references. But that would
      probably work out fine.

    5. benjaminp commented on Aug 25, 2008

      @benjaminp
      Contributor

      Here's my 2to3 fixer for the job. It cleanly removes the imports and
      changes the usage.

    6. changed the title [-]Warn against importing 'exceptions'[/-] [+]'exceptions' import fixer[/+] on Aug 25, 2008
    7. 1 remaining item

    8. loewis commented on Sep 10, 2008

      loewismannequin
      Mannequin

      Given that this is now a request for a fixer, and not a request for a
      deprecation warning, I don't see why this is considered a release
      blocker. Lowering the priority to normal. Even if the fixer isn't added
      to the 2to3 copy shipped with 2.6.0, I think 2to3 improvements can well
      be incorporated into 2.6.1 (including additional fixers).

    9. loewis commented on Oct 12, 2012

      loewismannequin
      Mannequin

      Brett: Why did you close the issue? Benjamin's change was never committed...

    10. brettcannon commented on Oct 12, 2012

      @brettcannon
      MemberAuthor

      I don't remember.

    11. berkerpeksag commented on Dec 30, 2012

      @berkerpeksag
      Member

      I've converted Benjamin's patch to extended diff format, fixed some
      PEP-8 violations and typos, removed the {get, set}_prefix usage, added
      more tests and updated the documentation.

    12. benjaminp commented on Dec 30, 2012

      @benjaminp
      Contributor

      This is something people can easily convert in there 2.x code, so I don't think the need for it is great.

    13. iritkatriel commented on Oct 22, 2020

      @iritkatriel
      Member

      Updating the versions, though it seems that you may want to close this as rejected based on the discussion.

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

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions