Skip to content
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
38 changes: 18 additions & 20 deletions class_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
DEBUG = False

# The pytsk3 version.
VERSION = "20260519"
VERSION = "20260524"

# These functions are used to manage library memory.
FREE = "aff4_free"
Expand Down Expand Up @@ -544,14 +544,11 @@ class Module(BaseCodeGenerator):
* Pre-3.12 support has been retained for Python 3.10 and 3.11 compatibility.
*/
void pytsk_fetch_error(void) {{
#if PY_VERSION_HEX >= 0x030C0000
PyObject *raised_exception = NULL;
#else
#if PY_VERSION_HEX < 0x030C0000
PyObject *exception_traceback = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
#endif
PyObject *exception_repr = NULL;
PyObject *exception_value = NULL;
PyObject *string_object = NULL;
char *str_c = NULL;
char *error_str = NULL;
Expand All @@ -562,17 +559,15 @@ class Module(BaseCodeGenerator):
/* Fetch the exception state and convert it to a string.
*/
#if PY_VERSION_HEX >= 0x030C0000
raised_exception = PyErr_GetRaisedException();
exception_repr = raised_exception;
exception_value = PyErr_GetRaisedException();
#else
PyErr_Fetch(&exception_type, &exception_value, &exception_traceback);
exception_repr = exception_value;
#endif

/* NULL on the legacy path means PyErr_SetNone(type) raised without a value, e.g.
* KeyboardInterrupt); on the modern path means no exception was actually set.
*/
if(exception_repr == NULL) {{
if(exception_value == NULL) {{
if(error_str != NULL) {{
const char *placeholder = "Python exception raised without value";
size_t placeholder_len = strlen(placeholder);
Expand All @@ -584,13 +579,13 @@ class Module(BaseCodeGenerator):
}}
*error_type = ERuntimeError;
#if PY_VERSION_HEX >= 0x030C0000
PyErr_SetRaisedException(raised_exception);
PyErr_SetRaisedException(exception_value);
#else
PyErr_Restore(exception_type, exception_value, exception_traceback);
#endif
return;
}}
string_object = PyObject_Repr(exception_repr);
string_object = PyObject_Repr(exception_value);

if(string_object != NULL) {{
utf8_string_object = PyUnicode_AsUTF8String(string_object);
Expand Down Expand Up @@ -620,7 +615,7 @@ class Module(BaseCodeGenerator):
*error_type = ERuntimeError;
}}
#if PY_VERSION_HEX >= 0x030C0000
PyErr_SetRaisedException(raised_exception);
PyErr_SetRaisedException(exception_value);
#else
PyErr_Restore(exception_type, exception_value, exception_traceback);
#endif
Expand Down Expand Up @@ -777,14 +772,15 @@ class Module(BaseCodeGenerator):
}}

#ifdef Py_GIL_DISABLED
/* Declare this module safe for free-threaded Python
* Without this call, CPython force-enables
* the GIL for our module at import time on
* free-threaded builds, which would serialize every
* pytsk3 call and defeat the point of free-threading.
* The symbol is only declared when Py_GIL_DISABLED is set
/* Declare this module safe for free-threaded Python. Without this call, CPython
* force-enables the GIL for our module at import time on free-threaded builds,
* which would serialize every pytsk3 call and defeat the point of free-threading.
* The symbol is only declared when Py_GIL_DISABLED is set.
*/
PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED);
if( PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED) != 0) {{
Py_DecRef(module);
return(NULL);
}}
#endif

d = PyModule_GetDict(module);
Expand Down Expand Up @@ -1023,6 +1019,8 @@ def write(self, out):
"on_error:\n"
" PyGILState_Release(gil_state);\n"
"\n"
" Py_DecRef(module);\n"
"\n"
" return NULL;\n"
"}\n"
"\n"
Expand Down
4 changes: 2 additions & 2 deletions dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytsk3 (20260519-1) unstable; urgency=low
pytsk3 (20260524-1) unstable; urgency=low

* Auto-generated

-- Joachim Metz <joachim.metz@gmail.com> Tue, 19 May 2026 20:44:24 +0200
-- Joachim Metz <joachim.metz@gmail.com> Sun, 24 May 2026 19:48:56 -0100
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pytsk3"
version = "20260519"
version = "20260524"
description = "Python bindings for the SleuthKit"
authors = [
{ name = "Michael Cohen", email = "scudette@gmail.com" },
Expand Down
Loading