From 398f0790dec34c33ead05cdfbe0a6b9e4fa96fb8 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Tue, 24 Sep 2024 12:39:56 -0700 Subject: [PATCH] Add DeprecationWarning emission to Python free_record wrapper Signed-off-by: Ryan Lee --- libraries/libapparmor/swig/SWIG/libapparmor.i | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/libapparmor/swig/SWIG/libapparmor.i b/libraries/libapparmor/swig/SWIG/libapparmor.i index 34ed2f0d5..b35fc94b2 100644 --- a/libraries/libapparmor/swig/SWIG/libapparmor.i +++ b/libraries/libapparmor/swig/SWIG/libapparmor.i @@ -36,6 +36,12 @@ * backwards compatibility with the existing high-level code that uses it. */ %rename(free_record) noop_free_record; +#ifdef SWIGPYTHON +%pythonprepend noop_free_record %{ +import warnings +warnings.warn("free_record is now a no-op as the record's memory is handled automatically", DeprecationWarning) +%} +#endif %feature("autodoc", "This function used to free aa_log_record objects. Freeing is now handled " "automatically, so this no-op function remains for backwards compatibility.") noop_free_record;