[sr-dev] [kamailio/kamailio] [Feature Request] Fix Python 2 & 3 build warnings (#1748)

Anthony Messina notifications at github.com
Sat Dec 1 21:05:01 CET 2018


The following patch resolves the app_python3 build errors (Which are changes with Python 3.7).  Fedora 29 includes Python 3.7 released on 06/27/2018.
```
diff --git a/src/modules/app_python3/app_python3_mod.c b/src/modules/app_python3/app_python3_mod.c
index fcc42fa89..00f7e2ced 100644
--- a/src/modules/app_python3/app_python3_mod.c
+++ b/src/modules/app_python3/app_python3_mod.c
@@ -177,7 +177,7 @@ static int child_init(int rank)
 		return 0;
 	}
 	_apy_process_rank = rank;
-	PyOS_AfterFork();
+	PyOS_AfterFork_Child();
 	if (cfg_child_init()) {
 		return -1;
 	}
@@ -431,7 +431,7 @@ int apy_init_script(int rank)
 {
 	PyObject *pFunc, *pArgs, *pValue, *pResult;
 	int rval = -1;
-	char *classname;
+	const char *classname;
 	PyGILState_STATE gstate;
 
 
diff --git a/src/modules/app_python3/python_support.c b/src/modules/app_python3/python_support.c
index e7dc47d52..14ba3283f 100644
--- a/src/modules/app_python3/python_support.c
+++ b/src/modules/app_python3/python_support.c
@@ -234,10 +234,10 @@ static char *make_message(const char *fmt, va_list ap)
 	return NULL;	// shall not happened, but who knows ;)
 }
 
-char *get_class_name(PyObject *y)
+const char *get_class_name(PyObject *y)
 {
 	PyObject *p;
-	char *name;
+	const char *name;
 
 	p = PyObject_GetAttrString(y, "__name__");
 	if (p == NULL || p == Py_None)
@@ -253,10 +253,10 @@ char *get_class_name(PyObject *y)
 }
 
 
-char *get_instance_class_name(PyObject *y)
+const char *get_instance_class_name(PyObject *y)
 {
 	PyObject *p, *n;
-	char *name;
+	const char *name;
 
 	n = PyObject_GetAttrString(y, "__class__");
 	if (n == NULL || n == Py_None)
diff --git a/src/modules/app_python3/python_support.h b/src/modules/app_python3/python_support.h
index 4d2556411..b3823da76 100644
--- a/src/modules/app_python3/python_support.h
+++ b/src/modules/app_python3/python_support.h
@@ -30,7 +30,7 @@ PyObject *format_exc_obj;
 void python_handle_exception(const char *, ...);
 
 PyObject *InitTracebackModule(void);
-char *get_class_name(PyObject *);
-char *get_instance_class_name(PyObject *);
+const char *get_class_name(PyObject *);
+const char *get_instance_class_name(PyObject *);
 
 #endif
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1748#issuecomment-443454407
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181201/d8c0e8c6/attachment.html>


More information about the sr-dev mailing list