Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: version detection on Python 3.11 #184

Merged
merged 1 commit into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/python/symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ enum {
#ifdef PY_PROC_C

#ifdef PL_MACOS
#define SYM_PREFIX "__"
#else
#define SYM_PREFIX "_"
#else
#define SYM_PREFIX ""
#endif


static const char * _dynsym_array[] = {
SYM_PREFIX "PyThreadState_Current",
SYM_PREFIX "PyRuntime",
SYM_PREFIX "_PyThreadState_Current",
SYM_PREFIX "_PyRuntime",
"interp_head",
"Py_Version",
SYM_PREFIX "Py_Version",
};

static long _dynsym_hash_array[DYNSYM_COUNT] = {0};
Expand Down
17 changes: 17 additions & 0 deletions test/test_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from subprocess import check_output

from test.utils import allpythons
from test.utils import austin
from test.utils import compress
Expand Down Expand Up @@ -115,3 +117,18 @@ def test_pipe_wall_time_multiprocess_output(py, tmp_path):
d = int(meta["duration"])

assert 0 < 0.8 * d < a < 2.2 * d


@allpythons(min=(3, 11))
def test_python_version(py):
result = austin("-Pi", "1s", *python(py), target())
assert result.returncode == 0

meta = metadata(result.stdout)

reported_version = ".".join((str(_) for _ in meta["python"]))
actual_version = (
check_output([*python(py), "-V"]).decode().strip().partition(" ")[-1]
)

assert reported_version == actual_version, meta
Loading