Skip to content

Commit 919a5f7

Browse files
committed
Up
1 parent 9e31fa2 commit 919a5f7

File tree

2 files changed

+90
-79
lines changed

2 files changed

+90
-79
lines changed

.github/workflows/test.yml

Lines changed: 79 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,52 @@ on:
55
branches:
66
- main
77
- "v*.*"
8+
- jk-test
89
jobs:
9-
linux:
10-
runs-on: ubuntu-20.04
11-
strategy:
12-
fail-fast: false
13-
matrix:
14-
include:
15-
- pair: { elixir: "1.15.8", otp: "25.3" }
16-
python_minor: "10"
17-
- pair: { elixir: "1.18.1", otp: "27.2" }
18-
python_minor: "10"
19-
- pair: { elixir: "1.18.1", otp: "27.2" }
20-
python_minor: "11"
21-
- pair: { elixir: "1.18.1", otp: "27.2" }
22-
python_minor: "12"
23-
- pair: { elixir: "1.18.1", otp: "27.2" }
24-
python_minor: "13"
25-
lint: true
26-
env:
27-
MIX_ENV: test
28-
PYTHONX_TEST_PYTHON_MINOR: ${{ matrix.python_minor }}
29-
name: Linux x86_64 (3.${{ matrix.python_minor }}, ${{ matrix.pair.elixir }}, ${{ matrix.pair.otp }})
30-
steps:
31-
- uses: actions/checkout@v4
32-
- uses: erlef/setup-beam@v1
33-
with:
34-
otp-version: ${{ matrix.pair.otp }}
35-
elixir-version: ${{ matrix.pair.elixir }}
36-
- uses: actions/cache@v4
37-
with:
38-
path: |
39-
deps
40-
_build
41-
key: ${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }}
42-
restore-keys: |
43-
${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-
44-
- run: mix deps.get
45-
- run: mix format --check-formatted
46-
if: ${{ matrix.lint }}
47-
- run: mix deps.unlock --check-unused
48-
if: ${{ matrix.lint }}
49-
- run: mix deps.compile
50-
- run: mix compile --warnings-as-errors
51-
if: ${{ matrix.lint }}
52-
- run: mix test
10+
# linux:
11+
# runs-on: ubuntu-20.04
12+
# strategy:
13+
# fail-fast: false
14+
# matrix:
15+
# include:
16+
# - pair: { elixir: "1.15.8", otp: "25.3" }
17+
# python_minor: "10"
18+
# - pair: { elixir: "1.18.1", otp: "27.2" }
19+
# python_minor: "10"
20+
# - pair: { elixir: "1.18.1", otp: "27.2" }
21+
# python_minor: "11"
22+
# - pair: { elixir: "1.18.1", otp: "27.2" }
23+
# python_minor: "12"
24+
# - pair: { elixir: "1.18.1", otp: "27.2" }
25+
# python_minor: "13"
26+
# lint: true
27+
# env:
28+
# MIX_ENV: test
29+
# PYTHONX_TEST_PYTHON_MINOR: ${{ matrix.python_minor }}
30+
# name: Linux x86_64 (3.${{ matrix.python_minor }}, ${{ matrix.pair.elixir }}, ${{ matrix.pair.otp }})
31+
# steps:
32+
# - uses: actions/checkout@v4
33+
# - uses: erlef/setup-beam@v1
34+
# with:
35+
# otp-version: ${{ matrix.pair.otp }}
36+
# elixir-version: ${{ matrix.pair.elixir }}
37+
# - uses: actions/cache@v4
38+
# with:
39+
# path: |
40+
# deps
41+
# _build
42+
# key: ${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }}
43+
# restore-keys: |
44+
# ${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-
45+
# - run: mix deps.get
46+
# - run: mix format --check-formatted
47+
# if: ${{ matrix.lint }}
48+
# - run: mix deps.unlock --check-unused
49+
# if: ${{ matrix.lint }}
50+
# - run: mix deps.compile
51+
# - run: mix compile --warnings-as-errors
52+
# if: ${{ matrix.lint }}
53+
# - run: mix test
5354

5455
windows:
5556
runs-on: windows-2019
@@ -84,37 +85,37 @@ jobs:
8485
- run: mix deps.compile
8586
- run: mix test
8687

87-
macos:
88-
runs-on: macos-13
89-
strategy:
90-
fail-fast: false
91-
matrix:
92-
include:
93-
- pair: { elixir: "1.15.8", otp: "25.3" }
94-
python_minor: "10"
95-
- pair: { elixir: "1.18.1", otp: "27.2" }
96-
python_minor: "13"
97-
env:
98-
MIX_ENV: test
99-
PYTHONX_TEST_PYTHON_MINOR: ${{ matrix.python_minor }}
100-
name: macOS x86_64 (3.${{ matrix.python_minor }}, ${{ matrix.pair.elixir }}, ${{ matrix.pair.otp }})
101-
steps:
102-
- uses: actions/checkout@v4
103-
- run: |
104-
curl -fsSO https://elixir-lang.org/install.sh
105-
sh install.sh elixir@${{ matrix.pair.elixir }} otp@${{ matrix.pair.otp }}
106-
otp_bin=($HOME/.elixir-install/installs/otp/*/bin)
107-
elixir_bin=($HOME/.elixir-install/installs/elixir/*/bin)
108-
echo "$otp_bin" >> "$GITHUB_PATH"
109-
echo "$elixir_bin" >> "$GITHUB_PATH"
110-
- uses: actions/cache@v4
111-
with:
112-
path: |
113-
deps
114-
_build
115-
key: ${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }}
116-
restore-keys: |
117-
${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-
118-
- run: mix deps.get
119-
- run: mix deps.compile
120-
- run: mix test
88+
# macos:
89+
# runs-on: macos-13
90+
# strategy:
91+
# fail-fast: false
92+
# matrix:
93+
# include:
94+
# - pair: { elixir: "1.15.8", otp: "25.3" }
95+
# python_minor: "10"
96+
# - pair: { elixir: "1.18.1", otp: "27.2" }
97+
# python_minor: "13"
98+
# env:
99+
# MIX_ENV: test
100+
# PYTHONX_TEST_PYTHON_MINOR: ${{ matrix.python_minor }}
101+
# name: macOS x86_64 (3.${{ matrix.python_minor }}, ${{ matrix.pair.elixir }}, ${{ matrix.pair.otp }})
102+
# steps:
103+
# - uses: actions/checkout@v4
104+
# - run: |
105+
# curl -fsSO https://elixir-lang.org/install.sh
106+
# sh install.sh elixir@${{ matrix.pair.elixir }} otp@${{ matrix.pair.otp }}
107+
# otp_bin=($HOME/.elixir-install/installs/otp/*/bin)
108+
# elixir_bin=($HOME/.elixir-install/installs/elixir/*/bin)
109+
# echo "$otp_bin" >> "$GITHUB_PATH"
110+
# echo "$elixir_bin" >> "$GITHUB_PATH"
111+
# - uses: actions/cache@v4
112+
# with:
113+
# path: |
114+
# deps
115+
# _build
116+
# key: ${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }}
117+
# restore-keys: |
118+
# ${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-
119+
# - run: mix deps.get
120+
# - run: mix deps.compile
121+
# - run: mix test

c_src/pythonx/pythonx.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,30 @@ class PyGILGuard {
8383
PyThreadStatePtr state;
8484

8585
{
86+
std::cout << "wait thread_states_mutex" << std::endl;
8687
auto guard = std::lock_guard<std::mutex>(thread_states_mutex);
88+
std::cout << "got thread_states_mutex" << std::endl;
8789

8890
if (thread_states.find(this->thread_id) == thread_states.end()) {
8991
// Note that PyThreadState_New does not require GIL to be held.
92+
std::cout << "before PyThreadState_New" << std::endl;
9093
state = PyThreadState_New(interpreter_state);
94+
std::cout << "after PyThreadState_New" << std::endl;
9195
} else {
9296
state = thread_states[this->thread_id];
9397
}
9498
}
9599

100+
std::cout << "wait PyEval_RestoreThread" << std::endl;
96101
PyEval_RestoreThread(state);
102+
std::cout << "got PyEval_RestoreThread" << std::endl;
97103
}
98104

99-
~PyGILGuard() { PyEval_SaveThread(); }
105+
~PyGILGuard() {
106+
std::cout << "before PyEval_SaveThread" << std::endl;
107+
PyEval_SaveThread();
108+
std::cout << "after PyEval_SaveThread" << std::endl;
109+
}
100110
};
101111

102112
// Ensures the given object refcount is decremented when the guard

0 commit comments

Comments
 (0)