You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run the python3-fail2ban component built by yocto, but I'm encountering an error related to the PY_SSIZE_T_CLEAN macro. The error message is PY_SSIZE_T_CLEAN macro must be defined for '#' formats.
I have no issues with python dependent fail2ban, issues observed only with python3
Note: For all # variants of formats (s#, y#, etc.), the macro PY_SSIZE_T_CLEAN must be defined before including Python.h. On Python 3.9 and older, the type of the length argument is [Py_ssize_t](https://docs.python.org/3.10/c-api/intro.html#c.Py_ssize_t) if the PY_SSIZE_T_CLEAN macro is defined, or int otherwise.
I tried to resolve this issue by defining the PY_SSIZE_T_CLEAN macro before including Python.h. But the issue was not resolved, patch snippet here,
I don't think so, vice versa it looks like it may be one...
Because of usage of systemd backend (which requires journal.Reader from python-systemd module) I believe it is systemd/python-systemd#107 (seems to be already fixed and a fixed version published on pypi, but probably did not reach your distro/python installation).
To check whether it is really abovementioned issue, try this... here is (successful) output with 3.11 on Debian 12:
I'm trying to run the python3-fail2ban component built by yocto, but I'm encountering an error related to the PY_SSIZE_T_CLEAN macro. The error message is PY_SSIZE_T_CLEAN macro must be defined for '#' formats.
I have no issues with python dependent fail2ban, issues observed only with python3
I've looked into the issue and found that in the Python 3.10 C-API documentation https://docs.python.org/3.10/c-api/arg.html#arg-parsing, it's mentioned that,
Note: For all # variants of formats (s#, y#, etc.), the macro PY_SSIZE_T_CLEAN must be defined before including Python.h. On Python 3.9 and older, the type of the length argument is [Py_ssize_t](https://docs.python.org/3.10/c-api/intro.html#c.Py_ssize_t) if the PY_SSIZE_T_CLEAN macro is defined, or int otherwise.
+#ifndef PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN 1
+#endif
#include "Python.h"
Environment:
The issue:
Steps to reproduce
/etc/fail2ban/jail.local
with the below data,sudo systemctl restart fail2ban.service
cat /var/log/fail2ban.log
Expected behavior
No error expected here, so sshd jail not working
Relevant parts of /var/log/fail2ban.log file:
fail2ban-server[11527]: fail2ban [11527]: ERROR NOK: ("PY_SSIZE_T_CLEAN macro must be defined for '#' formats",)
The text was updated successfully, but these errors were encountered: