python / python/cpython

legacy_tracing.c: Unchecked PyLong_AsInt in tracing callbacks

Open
#153,622 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

Original gist: https://gist.github.com/devdanzin/d1a6ab9f62970be0cae139366ce3c482

Summary

sys_trace_jump_func (line 382-384) and sys_trace_line_func (line 355): PyLong_AsInt error return -1 not checked. Proceeds with wrong values and pending exception.

Fix

Add if (result == -1 && PyErr_Occurred()) return NULL; checks.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs
  • gh-153623

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read legacy_tracing.c at sys_trace_line_func and sys_trace_jump_func, focusing on the PyLong_AsInt calls noted at lines 355 and 382-384. Confirm both callbacks handle conversion errors without continuing with invalid values or a pending exception. The issue is already linked to PR gh-153623, so check that work before starting.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.