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

_lsprof.c:ptrace_enter_call assumes PyErr_* is clean #45071

Closed
peaker mannequin opened this issue Jun 9, 2007 · 4 comments
Closed

_lsprof.c:ptrace_enter_call assumes PyErr_* is clean #45071

peaker mannequin opened this issue Jun 9, 2007 · 4 comments
Labels
extension-modules C modules in the Modules dir

Comments

@peaker
Copy link
Mannequin

peaker mannequin commented Jun 9, 2007

BPO 1733973
Nosy @arigo
Files
  • cProfile.patch: A patch to the most recent svn
  • cProfile.patch: Removed redundant PyErr_Clear (already done by PyErr_Fetch)
  • 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 2007-09-06.08:36:01.201>
    created_at = <Date 2007-06-09.08:04:30.000>
    labels = ['extension-modules']
    title = '_lsprof.c:ptrace_enter_call assumes PyErr_* is clean'
    updated_at = <Date 2007-09-06.08:36:01.171>
    user = 'https://bugs.python.org/peaker'

    bugs.python.org fields:

    activity = <Date 2007-09-06.08:36:01.171>
    actor = 'arigo'
    assignee = 'none'
    closed = True
    closed_date = <Date 2007-09-06.08:36:01.201>
    closer = 'arigo'
    components = ['Extension Modules']
    creation = <Date 2007-06-09.08:04:30.000>
    creator = 'peaker'
    dependencies = []
    files = ['8039', '8040']
    hgrepos = []
    issue_num = 1733973
    keywords = ['patch']
    message_count = 4.0
    messages = ['52738', '52739', '52740', '55681']
    nosy_count = 2.0
    nosy_names = ['arigo', 'peaker']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1733973'
    versions = ['Python 2.6']

    @peaker
    Copy link
    Mannequin Author

    peaker mannequin commented Jun 9, 2007

    _lsprof.c:ptrace_enter_call assumes PyErr_* has no errors.
    It assumes this by feeling free to call functions that PyErr_Clear and overwrite PyErr.

    This assumption is broken when throwing into a generator. In that case gen_send_ex(.., 1) calls the ptrace_enter_call with an exception already set.

    This assumption causes two bugs:
    A. The exception thrown into the generator is overwritten and lost. Later it was also cleared.
    B. gen_send_ex(..) still returns error-indication, but since the exception was cleared, you get a SystemError (error indication returned but no exception was set).

    To fix this, ptrace_enter_call now saves/restores the current PyErr.

    The attached patch was applied on the newest trunk svn. I guess it should be applicable without problems on the 2.5 bugfix branch as well.

    @peaker peaker mannequin added the extension-modules C modules in the Modules dir label Jun 9, 2007
    @peaker
    Copy link
    Mannequin Author

    peaker mannequin commented Jun 9, 2007

    It seems that bug bpo-1733757 encountered the same bug. See comments on that bug.

    @peaker
    Copy link
    Mannequin Author

    peaker mannequin commented Jun 9, 2007

    File Added: cProfile.patch

    @arigo
    Copy link
    Mannequin

    arigo mannequin commented Sep 6, 2007

    Thanks for the patch. Checked in:

    • r58004 (trunk)
    • r58005 (release25-maint)

    @arigo arigo mannequin closed this as completed Sep 6, 2007
    @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

    0 participants