[3.13] copyreg._reconstructor failures for protocol 0 and 1 for `dateutil.tz.tzutc`
Chưa có ai nhận issue này.
- 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 description:
In [25]: pickle.load(open('taskwarrior/f91b9e98-7586-4317-ae52-b516e97209e5', 'rb'))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[25], line 1
----> 1 pickle.load(open('taskwarrior/f91b9e98-7586-4317-ae52-b516e97209e5', 'rb'))
File /usr/lib/python3.13/copyreg.py:44, in _reconstructor(cls, base, state)
41 def _reconstructor(cls, base, state):
42 if base is object:
43 #obj = cls.__new__(cls)
---> 44 obj = object.__new__(cls)
45 else:
46 obj = base.__new__(cls, state)
TypeError: object.__new__(tzutc) is not safe, use tzutc.__new__()
It seems that cls.__new__(cls) is the correct way to achieve the desired effect for any type of object?
This issue was not present in 3.12, or at least same code on same pickles used to work.
I was not able to reproduce this with arbitrary data serialization/deserialization (e.g. pickle.dump(tzutc(), f); pickle.load(f) works), which suggests this is dependent on how exactly data is structured, and so I'm including the culprit pickle here: 74b9da0a-ab54-437f-9ab5-549e886d3c83.txt
CPython versions tested on:
3.13
Operating systems tested on:
Linux
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.
Hướng nghiên cứu
Bắt đầu với copyreg.py quanh dòng 44 và tái hiện lỗi pickle đính kèm trên Python 3.13 bằng dateutil.tz.tzutc. So sánh hành vi của protocol 0 và 1 với Python 3.12, sau đó xác minh rằng thay đổi được chọn vẫn giữ nguyên các trường hợp đang hoạt động và tải đúng pickle được cung cấp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100