Skip to content

Commit

Permalink
chore: drop support for old Python versions
Browse files Browse the repository at this point in the history
Python < 3.8 is no longer maintained, so we drop support for it.
Previous versions of Austin can still be used if needed.
  • Loading branch information
P403n1x87 committed Aug 13, 2023
1 parent 89a1f48 commit 206e380
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 557 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

env:
AUSTIN_TESTS_PYTHON_VERSIONS: ${{ matrix.python-version }}
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

env:
AUSTIN_TESTS_PYTHON_VERSIONS: ${{ matrix.python-version }}
Expand Down Expand Up @@ -303,7 +303,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

env:
AUSTIN_TESTS_PYTHON_VERSIONS: ${{ matrix.python-version }}
Expand Down Expand Up @@ -381,7 +381,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

env:
AUSTIN_TESTS_PYTHON_VERSIONS: ${{ matrix.python-version }}
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ folder in either the SVG, PDF or PNG format

# Compatibility

Austin supports Python 2.3-2.7 and 3.3-3.11 and has been tested on the
Austin supports Python 3.8-3.11 and has been tested on the
following platforms and architectures

| | <img src="art/tux.svg" /> | <img src="art/win.svg"/> | <img src="art/apple.svg"/> |
Expand All @@ -594,7 +594,8 @@ following platforms and architectures

> **NOTE** Austin *might* work with other versions of Python on all the
> platforms and architectures above. So it is worth giving it a try even if
> your system is not listed below.
> your system is not listed below. If you are looking for support for Python <
> 3.8, you can use Austin 3.5.
Because of platform-specific details, Austin usage may vary slightly. Below are
further compatibility details to be aware of.
Expand Down
Binary file modified doc/cheatsheet.pdf
Binary file not shown.
Binary file modified doc/cheatsheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 19 additions & 17 deletions doc/cheatsheet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions scripts/build-wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
1 change: 0 additions & 1 deletion src/linux/py_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include "../version.h"


#define CHECK_HEAP
#define DEREF_SYM


Expand Down
1 change: 0 additions & 1 deletion src/mac/py_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "../mem.h"
#include "../resources.h"

#define CHECK_HEAP
#define DEREF_SYM


Expand Down
101 changes: 2 additions & 99 deletions src/py_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ _get_version_from_filename(char * filename, const char * needle, int * major, in
}

#elif defined PL_WIN /* WIN */
// Assume the library path is of the form *.python[23][0-9]+[.]dll
// Assume the library path is of the form *.python3[0-9]+[.]dll
int n = strlen(filename);
if (n < 10) {
FAIL;
Expand All @@ -165,7 +165,7 @@ _get_version_from_filename(char * filename, const char * needle, int * major, in
while (*(p--) != 'n' && p > filename);
p++;
*major = *(p++) - '0';
if (*major != 2 && *major != 3) {
if (*major != 3) {
FAIL;
}

Expand All @@ -175,7 +175,6 @@ _get_version_from_filename(char * filename, const char * needle, int * major, in

#elif defined PL_MACOS /* MAC */
char * ver_needle = strstr(filename, "3.");
if (ver_needle == NULL) ver_needle = strstr(filename, "2.");
if (ver_needle != NULL && sscanf(ver_needle, "%d.%d", major, minor) == 2) {
SUCCESS;
}
Expand Down Expand Up @@ -323,30 +322,6 @@ _py_proc__infer_python_version(py_proc_t * self) {
set_version:
self->py_v = get_version_descriptor(major, minor, patch);
SUCCESS;

// Scan the rodata section for something that looks like the Python version.
// There are good chances this is at the very beginning of the section so
// it shouldn't take too long to find a match. This is more reliable than
// waiting until the version appears in the bss section at run-time.
// NOTE: This method is not guaranteed to find a valid Python version.
// If this causes problems then another method is required.
// char * p_ver = (char *) map + (Elf64_Addr) self->map.rodata.base;
// for (register int i = 0; i < self->map.rodata.size; i++) {
// if (
// p_ver[i] == '.' &&
// p_ver[i+1] != '.' &&
// p_ver[i+2] == '.' &&
// p_ver[i-2] == 0
// ) {
// if (
// sscanf(p_ver + i - 1, "%d.%d.%d", &major, &minor, &patch) == 3 &&
// (major == 2 || major == 3)
// ) {
// log_i("Python version: %s", p_ver + i - 1, p_ver);
// // break;
// }
// }
// }
}


Expand Down Expand Up @@ -434,57 +409,6 @@ _py_proc__check_interp_state(py_proc_t * self, void * raddr) {
SUCCESS;
}


#ifdef CHECK_HEAP
// ----------------------------------------------------------------------------
static int
_py_proc__is_heap_raddr(py_proc_t * self, void * raddr) {
if (!isvalid(self) || !isvalid(raddr) || !isvalid(self->map.heap.base))
return FALSE;

return (
raddr >= self->map.heap.base &&
raddr < self->map.heap.base + self->map.heap.size
);
}


// ----------------------------------------------------------------------------
static int
_py_proc__is_raddr_within_max_range(py_proc_t * self, void * raddr) {
if (!isvalid(self) || !isvalid(raddr) || !isvalid(self->map.heap.base))
return FALSE;

return (raddr >= self->min_raddr && raddr < self->max_raddr);
}


// ----------------------------------------------------------------------------
static int
_py_proc__scan_heap(py_proc_t * self) {
log_d("Scanning HEAP");
// NOTE: This seems to be required by Python 2.7 on i386 Linux.
void * upper_bound = self->map.heap.base + self->map.heap.size;
for (
register void ** raddr = (void **) self->map.heap.base;
(void *) raddr < upper_bound;
raddr++
) {
switch (_py_proc__check_interp_state(self, raddr)) {
case 0:
self->is_raddr = raddr;
SUCCESS;

case OUT_OF_BOUND:
return OUT_OF_BOUND;
}
}

FAIL;
}
#endif


// ----------------------------------------------------------------------------
static int
_py_proc__scan_bss(py_proc_t * self) {
Expand Down Expand Up @@ -531,11 +455,6 @@ _py_proc__scan_bss(py_proc_t * self) {
) {
if (
(!shift &&
#ifdef CHECK_HEAP
(isvalid(self->lib_path)
? _py_proc__is_raddr_within_max_range(self, *raddr)
: _py_proc__is_heap_raddr(self, *raddr)) &&
#endif
success(_py_proc__check_interp_state(self, *raddr)))
||(shift && success(_py_proc__check_interp_state(self, (void*) raddr - self->bss + base)))
) {
Expand Down Expand Up @@ -755,22 +674,6 @@ _py_proc__wait_for_interp_state(py_proc_t * self) {
if (self->child)
FAIL;

#ifdef CHECK_HEAP
log_w("BSS scan unsuccessful so we scan the heap directly ...");

// TODO: Consider copying heap over and check for pointers
TIMER_SET(100)
TIMER_START
switch (_py_proc__scan_heap(self)) {
case 0:
SUCCESS;

case OUT_OF_BOUND:
TIMER_STOP
}
TIMER_END
#endif

set_error(EPROCISTIMEOUT);
FAIL;
} // _py_proc__wait_for_interp_state
Expand Down
Loading

0 comments on commit 206e380

Please sign in to comment.