Issue with debugpy and post portem debug hook in Python 3.12+
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện test.py được cung cấp với Python 3.12 và debugpy. Kiểm tra traceback trong debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py, đặc biệt là build_exception_info_response, và lần theo hook postmortem qua pydevd.stop_on_unhandled_exception. Hoàn tất khi script có thể xử lý ValueError được phát sinh mà không gặp AttributeError nội bộ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi! Decided to post it as a separate issue - perhaps it indicate some general problem in debugpy too.
There was a script to setup postmortem debugger that would start debugpy automatically. It worked fine, but in 3.12 stopped wokring. There's some internal error in debugpy - see the script and steps to reproduce it below.
Snippet from @fabioz worked really well for me, but it seems to break in Python 3.12.
Haven't investigated in details yet - any ideas for a workaround?uv venv --python 3.12 .venv\Scripts\activate uv pip install debugpy python test.py # 2.04s - Error getting exception type. # Traceback (most recent call last): # File ".venv\Lib\site-packages\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 1550, in build_exception_info_response # stype = frames_list.exc_type.__qualname__ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # AttributeError: 'NoneType' object has no attribute '__qualname__'# test.py def test(): for i in range(5): print("Hello, world!", i) if i == 3: raise ValueError("Test exception") def setup_post_portem(): import sys from types import TracebackType from typing import Any, Callable, Type def make_debugpy_excepthook() -> Callable[[Type[BaseException], BaseException, TracebackType], Any]: """ Return an excepthook that will initialise debugpy and then call through to its exception handler. """ import debugpy original_debugpy_excepthook = sys.excepthook def debugpy_excepthook( type_: Type[BaseException], value: BaseException, traceback: TracebackType, ) -> Any: """ Callback called when an exception is hit and debugpy is enabled. """ if not debugpy.is_client_connected(): print("Exception thrown. Waiting for debugpy on port 5678.") debugpy.listen(5678) debugpy.wait_for_client() import pydevd import threading py_db = pydevd.get_global_debugger() thread = threading.current_thread() additional_info = py_db.set_additional_thread_info(thread) additional_info.is_tracing += 1 try: arg = (type_, value, traceback) py_db.stop_on_unhandled_exception(py_db, thread, additional_info, arg) finally: additional_info.is_tracing -= 1 original_debugpy_excepthook(type_, value, traceback) return debugpy_excepthook sys.excepthook = make_debugpy_excepthook() if __name__ == "__main__": setup_post_portem() test()
Originally posted by @Andrej730 in #723
- Ngôn ngữ chính
- Python
- Star
- 2.5k
- Fork
- 205
- Merge trung bình
- 1 ngày 43 phút
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/debugpy
-
pydevd_comm.py start_client() does not set TCP_NODELAY on the connections it opensCó thể đã có người làm @nightcityblade đã nhận 55 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Document "rules"-optionCó thể đã có người làm @nightcityblade đã nhận 43 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
wx.EventLoop() deprecation warningCó thể đã có người làm @nightcityblade đã nhận 42 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
debugpy.configure(python=) is not properly documentedCó thể đã có người làm @nightcityblade đã nhận 53 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
Tất cả issue của microsoft/debugpy
Issue tương tự
-
request-theme
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 70/100
LizardByte/ThemerrDB#8877 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/install-update comp/gateway P0 sweeper:risk-compatibility type/bug
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 72/100
NousResearch/hermes-agent#135997 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
deepset-ai/haystack#13199 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] JSONLoader rejects valid UTF-8 BOM filesCó thể đã có người làm @zouyonghe đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
anthropics/knowledge-work-plugins#1298 ·
Maintainer thường phản hồi trong vòng 1 ngày