call_historic() memorizes the caller's kwargs mapping, so later mutation changes what late plugins receive
Maintainer thường phản hồi trong vòng 1 ngày
@RonnyPfannschmidt đang làm issue này rồi.
Từ ngày 21/10/2026.
- #810 của @rajnish-verma-22172 — đã đóng, không merge
Đánh giá
Issue này chưa được đánh giá.
Mô tả
🤖 Written by Claude Opus 5.5 via Claude Code for the pluggy maintainers; I prompted it, it did the work, I read it.
HookCaller.call_historic() appends kwargs to _call_history and replays it for plugins registered later. When the hookspec has no argument defaults, _apply_defaults() returns the caller's own mapping unchanged, so the history holds a reference to the caller's object:
d = {"arg": "at-call-time"}
pm.hook.myhook.call_historic(kwargs=d)
d["arg"] = "mutated"
pm.register(LatePlugin()) # LatePlugin.myhook receives arg="mutated"
When the spec has defaults, _apply_defaults() builds a new dict, so those calls are already isolated. The behavior therefore depends on whether the spec happens to declare a default.
Fix: store dict(kwargs) after applying defaults. This is a shallow copy, so mutable argument values are still shared, and that's expected. Low priority: nobody has reported it in the wild, and pytest passes fresh dicts.
Found while reviewing #806.
- Ngôn ngữ chính
- Python
- Star
- 1.7k
- Fork
- 192
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 25
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 pytest-dev/pluggy
-
Plugin registry compares plugins by equality, not identityCó thể đã có người làm @00200200 đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
pytest-dev/pluggy#760 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
deprecate passing None as a plugin instanceCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
pytest-dev/pluggy#790 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Defaulted positional-only hook parameters are forwarded as keywordsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 45/100
pytest-dev/pluggy#774 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
unregister() argument validation relies on assertCó thể đã có người làm @ekanshul đã nhận 14 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 42/100
pytest-dev/pluggy#762 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Failures during add_hookspecs / historic replay leave partial stateCó thể đã có người làm @starx710 đã nhận 9 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
pytest-dev/pluggy#761 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của pytest-dev/pluggy
Issue tương tự
-
style: article/section 📝 system: cloud.rc ☁️ system: security 🔐
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
uabrc/uabrc.github.io#1262 ·
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NCAR/miles-credit#526 ·
-
documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
conda/conda-lock#957 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/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 76/100
aws-samples/sample-per-model-bedrock#464 ·
Maintainer thường phản hồi trong vòng 1 ngày