diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32e16e3..dca803d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: tests: strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: @@ -33,6 +33,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true + cache: pip + cache-dependency-path: "pyproject.toml" - name: Install Intercepts shell: bash diff --git a/intercepts/registration.py b/intercepts/registration.py index 4c6c629..591c416 100644 --- a/intercepts/registration.py +++ b/intercepts/registration.py @@ -120,6 +120,18 @@ def _register_function( bytes( [dis.opmap["PUSH_NULL"], 0] + load_const + [dis.opmap["NOP"], 0] * 4 ), + ).replace( + bytes( + [ + dis.opmap["LOAD_GLOBAL"], + (_index << 1) + 1, + *([dis.opmap["CACHE"], 0] * 4), + ] + ), + # Need the NOPs to prevent segfaults with coveragepy and pytest + bytes( + [dis.opmap["PUSH_NULL"], 0] + load_const + [dis.opmap["NOP"], 0] * 3 + ), ) if _PYTHON_VERSION < (3, 8): _code = types.CodeType(