Skip to content

Commit

Permalink
Merge pull request #214 from P403n1x87/fix/line-end
Browse files Browse the repository at this point in the history
fix: line end information for CPython < 3.11
  • Loading branch information
P403n1x87 committed Mar 16, 2024
2 parents ebfd9fd + 250d858 commit 5303860
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 10 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2024-xx-xx v3.6.1

Bugfix: fixed a bug with the MOJO binary format that caused the line end
position to wrongly be set to a non-zero value for CPython < 3.11, where line
end information is not actually available.


2023-10-04 v3.6.0

Added support for CPython 3.12
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AC_PREREQ([2.69])
# from scripts.utils import get_current_version_from_changelog as version
# print(f"AC_INIT([austin], [{version()}], [https://github.com/p403n1x87/austin/issues])")
# ]]]
AC_INIT([austin], [3.6.0], [https://github.com/p403n1x87/austin/issues])
AC_INIT([austin], [3.6.1], [https://github.com/p403n1x87/austin/issues])
# [[[end]]]
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ base: core20
# from scripts.utils import get_current_version_from_changelog as version
# print(f"version: '{version()}+git'")
# ]]]
version: '3.6.0+git'
version: '3.6.1+git'
# [[[end]]]
summary: A Python frame stack sampler for CPython
description: |
Expand Down
2 changes: 1 addition & 1 deletion src/austin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from scripts.utils import get_current_version_from_changelog as version
print(f'#define VERSION "{version()}"')
]]] */
#define VERSION "3.6.0"
#define VERSION "3.6.1"
// [[[end]]]

#endif
2 changes: 1 addition & 1 deletion src/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ _frame_from_code_raddr(py_proc_t * py_proc, void * code_raddr, int lasti, python
ssize_t len = 0;

unsigned int lineno = V_FIELD(unsigned int, code, py_code, o_firstlineno);
unsigned int line_end = lineno;
unsigned int line_end = 0;
unsigned int column = 0;
unsigned int column_end = 0;

Expand Down
32 changes: 26 additions & 6 deletions test/functional/test_mojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from pathlib import Path
from test.utils import allpythons
from test.utils import austin
from test.utils import python
from test.utils import target
from test.utils import allpythons, austin, python, target

from austin.format.mojo import MojoFile
from austin.format.mojo import MojoFrame
from austin.format.mojo import MojoFile, MojoFrame


@allpythons(min=(3, 11))
Expand Down Expand Up @@ -56,3 +52,27 @@ def strip(f):
("lazy", 6, 6, 9, 19),
("<listcomp>", 17, 17, 5, 17),
}


@allpythons(max=(3, 10))
def test_mojo_no_column_data(py, tmp_path: Path):
"""
Test that no other location information is present apart from the line
number for Python versions prior to 3.11.
"""
datafile = tmp_path / "test_mojo_column.austin"

result = austin(
"-i", "100", "-o", str(datafile), *python(py), target("column.py"), mojo=True
)
assert result.returncode == 0, result.stderr or result.stdout

def strip(f):
return

with datafile.open("rb") as f:
assert {
(e.line_end, e.column, e.column_end)
for e in MojoFile(f).parse()
if isinstance(e, MojoFrame)
} == {(0, 0, 0)}

0 comments on commit 5303860

Please sign in to comment.