GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Raise exceptions, don't throw · Issue #60918 · python/cpython

Raise exceptions, don't throw #60918

New issue
Copy link
New issue
Copy link
Closed
Closed
Raise exceptions, don't throw#60918
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-featureA feature request or enhancementA feature request or enhancement

Description

@serhiy-storchaka
serhiy-storchaka
opened on Dec 18, 2012
Issue body actions
BPO 16714
Nosy @birkenfeld, @asvetlov, @cjerdonek, @serhiy-storchaka
Files
  • raise-3.3.patch: Patch for 3.3+
  • raise-3.2.patch: Patch for 3.2
  • raise-2.7.patch: Patch for 2.7
  • raise-2.7_2.patch
  • raise-3.3_2.patch
  • raise-3.2_2.patch
  • throw_away.patch: Revert 'raise' to 'throw'. Patch for 2.7
  • threw2raised.patch: Replace 'threw' to 'raised'. Patch for 3.3 and 3.4
  • threw2raised-3.2.patch: Replace 'threw' to 'raised'. Patch for 2.7 and 3.2
  • 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 2012-12-18.19:28:42.780>
    created_at = <Date 2012-12-18.18:11:28.917>
    labels = ['type-feature', 'docs']
    title = "Raise exceptions, don't throw"
    updated_at = <Date 2012-12-19.20:56:38.455>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2012-12-19.20:56:38.455>
    actor = 'asvetlov'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2012-12-18.19:28:42.780>
    closer = 'asvetlov'
    components = ['Documentation']
    creation = <Date 2012-12-18.18:11:28.917>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['28347', '28348', '28349', '28350', '28351', '28352', '28360', '28361', '28362']
    hgrepos = []
    issue_num = 16714
    keywords = ['patch']
    message_count = 9.0
    messages = ['177698', '177699', '177700', '177701', '177702', '177755', '177779', '177780', '177781']
    nosy_count = 6.0
    nosy_names = ['georg.brandl', 'asvetlov', 'chris.jerdonek', 'docs@python', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue16714'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3', 'Python 3.4']

    Activity

    1. serhiy-storchaka commented on Dec 18, 2012

      @serhiy-storchaka
      serhiy-storchaka
      on Dec 18, 2012
      MemberAuthor
      More actions

      The proposed patch fixes wording of documentation, comments, etc which use the term 'throw' instead of 'raise' in context of exception raising.

    2. serhiy-storchaka
      assigned
      docspython
      on Dec 18, 2012
    3. serhiy-storchaka
      added
      docsDocumentation in the Doc dirDocumentation in the Doc dir
      type-featureA feature request or enhancementA feature request or enhancement
      on Dec 18, 2012
    4. birkenfeld commented on Dec 18, 2012

      @birkenfeld
      birkenfeld
      on Dec 18, 2012
      Member
      More actions

      LGTM, except for:

      diff -r 907d71668d3c Python/pythonrun.c
      --- a/Python/pythonrun.c	Sun Dec 16 21:10:35 2012 +0100
      +++ b/Python/pythonrun.c	Tue Dec 18 19:35:27 2012 +0200
      @@ -2518,7 +2518,7 @@
       PyOS_CheckStack(void)
       {
           __try {
      -        /* alloca throws a stack overflow exception if there's
      +        /* alloca raises a stack overflow exception if there's
                  not enough space left on the stack */
               alloca(PYOS_STACK_MARGIN * sizeof(void*));
               return 0;

      This is talking about a C++ exception and therefore "throw" is correct.

    5. serhiy-storchaka commented on Dec 18, 2012

      @serhiy-storchaka
      serhiy-storchaka
      on Dec 18, 2012
      MemberAuthor
      More actions

      Indeed. Here are updated patches.

    6. python-dev commented on Dec 18, 2012

      @python-dev
      python-devmannequin
      on Dec 18, 2012
      Mannequin
      More actions

      New changeset fdf907708f49 by Andrew Svetlov in branch '3.2':
      Issue bpo-16714: use 'raise' exceptions, don't 'throw'.
      http://hg.python.org/cpython/rev/fdf907708f49

      New changeset 15a391919deb by Andrew Svetlov in branch '3.3':
      Issue bpo-16714: use 'raise' exceptions, don't 'throw'.
      http://hg.python.org/cpython/rev/15a391919deb

      New changeset 7260cf668dd7 by Andrew Svetlov in branch 'default':
      Issue bpo-16714: use 'raise' exceptions, don't 'throw'.
      http://hg.python.org/cpython/rev/7260cf668dd7

      New changeset 8c2635afbfe1 by Andrew Svetlov in branch '2.7':
      Issue bpo-16714: use 'raise' exceptions, don't 'throw'.
      http://hg.python.org/cpython/rev/8c2635afbfe1

    7. asvetlov commented on Dec 18, 2012

      @asvetlov
      asvetlov
      on Dec 18, 2012
      Contributor
      More actions

      Fixed. Thanks, Serhiy.

    8. asvetlov
      closed this as completedon Dec 18, 2012
    9. serhiy-storchaka commented on Dec 19, 2012

      @serhiy-storchaka
      serhiy-storchaka
      on Dec 19, 2012
      MemberAuthor
      More actions

      I found one error. In Lib/email/header.py for 2.7 'raise' should be
      reverted to 'throw'.

      Also I miss a past form. Second patch replaces 'threw' with 'raised'.

    10. python-dev commented on Dec 19, 2012

      @python-dev
      python-devmannequin
      on Dec 19, 2012
      Mannequin
      More actions

      New changeset 0a5c5399f638 by Andrew Svetlov in branch '2.7':
      revert comment wording (bpo-16714)
      http://hg.python.org/cpython/rev/0a5c5399f638

    11. python-dev commented on Dec 19, 2012

      @python-dev
      python-devmannequin
      on Dec 19, 2012
      Mannequin
      More actions

      New changeset b227f8f7242d by Andrew Svetlov in branch '2.7':
      replace threw with raised (bpo-16714)
      http://hg.python.org/cpython/rev/b227f8f7242d

      New changeset 74da2dbb5e50 by Andrew Svetlov in branch '3.2':
      replace threw with raised (bpo-16714)
      http://hg.python.org/cpython/rev/74da2dbb5e50

      New changeset 55d86476d048 by Andrew Svetlov in branch '3.3':
      replace threw with raised (bpo-16714)
      http://hg.python.org/cpython/rev/55d86476d048

      New changeset 3594175c6860 by Andrew Svetlov in branch 'default':
      replace threw with raised (bpo-16714)
      http://hg.python.org/cpython/rev/3594175c6860

    12. asvetlov commented on Dec 19, 2012

      @asvetlov
      asvetlov
      on Dec 19, 2012
      Contributor
      More actions

      Committed. Thanks again, Serhiy!

    13. ezio-melotti
      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

      docsDocumentation in the Doc dirDocumentation in the Doc dirtype-featureA feature request or enhancementA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.