Skip to content

Commit b2ba73f

Browse files
authored
fix: keep the copyreg module [backport #5750 to 1.13] (#5754)
Backport of #5750 to 1.13 Some frameworks might extend the pickle capabilities by interacting with the copyreg module. Unloading it as part of the module clean-up process causes issues, so we add it to the list of modules to keep. Fixes: #5742 ## Testing strategy The issue does not occur when the library is installed in edit mode, which makes it tricky to test with `riot` in our CI. Manual testing shows that issue that prompted this fix is resolved. ## Risk Because we don't have a reproducer in our test suite we are left vulnerable to regressions. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines) are followed. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] PR description includes explicit acknowledgement/acceptance of the performance implications of this PR as reported in the benchmarks PR comment. ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment.
1 parent d4e0ec0 commit b2ba73f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ddtrace/bootstrap/sitecustomize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def drop(module_name):
124124
KEEP_MODULES = frozenset(
125125
[
126126
"atexit",
127+
"copyreg", # pickling issues for tracebacks with gevent
127128
"ddtrace",
128129
"asyncio",
129130
"concurrent",
@@ -134,7 +135,7 @@ def drop(module_name):
134135
]
135136
)
136137
if PY2:
137-
KEEP_MODULES_PY2 = frozenset(["encodings", "codecs"])
138+
KEEP_MODULES_PY2 = frozenset(["encodings", "codecs", "copy_reg"])
138139
for m in list(_ for _ in sys.modules if _ not in LOADED_MODULES):
139140
if any(m == _ or m.startswith(_ + ".") for _ in KEEP_MODULES):
140141
continue
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
gevent: Fix a bug that caused traceback objects to fail to pickle when using gevent.

0 commit comments

Comments
 (0)