Skip to content

Commit af986f7

Browse files
authored
chore(debugging): add RESUME to functions generated by DSL (#6835)
We add a RESUME instructions to the functions generated by the compilation of DI expressions. Whilst this does not seem to cause problems with CPython 3.11, early tests show that this is more of an issue with CPython 3.12. Therefore, we make this change to prevent any potential future issues. ## 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/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Title is accurate. - [ ] No unnecessary changes are introduced. - [ ] Description motivates each change. - [ ] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [ ] Testing strategy adequately addresses listed risk(s). - [ ] Change is maintainable (easy to change, telemetry, documentation). - [ ] Release note makes sense to a user of the library. - [ ] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [ ] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) - [ ] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [ ] This PR doesn't touch any of that.
1 parent 154c151 commit af986f7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ddtrace/debugging/_expressions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
""" # noqa
2626
from itertools import chain
2727
import re
28+
import sys
2829
from types import FunctionType
2930
from typing import Any
3031
from typing import Callable
@@ -67,6 +68,8 @@ def _make_function(ast, args, name):
6768
raise ValueError("Invalid predicate: %r" % ast)
6869

6970
instrs = compiled + [Instr("RETURN_VALUE")]
71+
if sys.version_info >= (3, 11):
72+
instrs.insert(0, Instr("RESUME", 0))
7073

7174
abstract_code = Bytecode(instrs)
7275
abstract_code.argcount = len(args)

0 commit comments

Comments
 (0)