python / python/cpython

_Py_TryIncrefCompareStackRef incorrectly listed as non-escaping in cases generator

Đang mở
#129,452 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@DinoV đang làm issue này rồi.

Từ ngày 29/1/2025.

topic-free-threading type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Bug report

Bug description:

(This came up during the faster-cpython meeting, filing a bug so we don't forget.)

_Py_TryIncrefCompareStackRef and _Py_TryIncrefCompare are currently listed as non-escaping in the bytecode cases generator (https://github.com/python/cpython/blob/99ed3025fe8fa9079b4c1eac01c5af62caa98c15/Tools/cases_generator/analyzer.py#L635), but they can in fact escape (in the DECREF path when we're no longer sure the object we INCREF'ed is a correct object, since it may have been a pointer to a new object in re-used memory). _Py_TryIncrefCompare isn't currently used in bytecodes.c, but _Py_TryIncrefCompareStackRef is used in LOAD_ATTR specializations, which are consequently incorrectly flagged as non-escaping (and also can also theoretically cause crashes because of the missing spilling).

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.