python / python/cpython

Cannot pickle cyclic ExceptionGroup

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

@serhiy-storchaka đang làm issue này rồi.

Từ ngày 18/8/2025.

stdlib 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:

Pickling an exception group with a cycle, like so...

import pickle
inner = Exception("Inner")
outer = ExceptionGroup("outer", [inner])
outer.exceptions[0].foo = outer  
pickle.loads(pickle.dumps(outer))

...produces...

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: second argument (exceptions) must be a non-empty sequence

Maybe BaseExceptionGroup needs a custom reducer that allows for two-phase initialization.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

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.