summaryrefslogtreecommitdiff
path: root/efl/utils
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-10-25 13:43:40 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2013-10-25 13:49:29 +0300
commit374f267ecc78fdedb5ae7f38628f9e61c5d04517 (patch)
treedd85b0fa6bc32a8161bac884352f053961060985 /efl/utils
parent3e99eb5fe93d157e485ae713031055462ccbad6d (diff)
Fix missing symbol PyString_FromFormatV when compiled for Python 3.x.
That function was removed so I replaced it with PyUnicode_FromFormatV, cdef extern it directly from Python.h since it's not found in Cython unicode.pxd.
Diffstat (limited to 'efl/utils')
-rw-r--r--efl/utils/logger.pyx6
1 files changed, 4 insertions, 2 deletions
diff --git a/efl/utils/logger.pyx b/efl/utils/logger.pyx
index 471de9e..3893bbc 100644
--- a/efl/utils/logger.pyx
+++ b/efl/utils/logger.pyx
@@ -15,7 +15,6 @@
15# You should have received a copy of the GNU Lesser General Public License 15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. 16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17 17
18from cpython cimport PyString_FromFormatV
19from libc.string cimport const_char 18from libc.string cimport const_char
20from efl.eina cimport Eina_Log_Domain, const_Eina_Log_Domain, Eina_Log_Level, \ 19from efl.eina cimport Eina_Log_Domain, const_Eina_Log_Domain, Eina_Log_Level, \
21 eina_log_print_cb_set, eina_log_domain_register, eina_log_level_set, \ 20 eina_log_print_cb_set, eina_log_domain_register, eina_log_level_set, \
@@ -25,6 +24,9 @@ cdef extern from "stdarg.h":
25 ctypedef struct va_list: 24 ctypedef struct va_list:
26 pass 25 pass
27 26
27cdef extern from "Python.h":
28 object PyUnicode_FromFormatV(char *format, va_list vargs)
29
28cdef tuple log_levels = ( 30cdef tuple log_levels = (
29 50, 31 50,
30 40, 32 40,
@@ -39,7 +41,7 @@ cdef void py_eina_log_print_cb(const_Eina_Log_Domain *d,
39 Eina_Log_Level level, 41 Eina_Log_Level level,
40 const_char *file, const_char *fnc, int line, 42 const_char *file, const_char *fnc, int line,
41 const_char *fmt, void *data, va_list args) with gil: 43 const_char *fmt, void *data, va_list args) with gil:
42 cdef str msg = PyString_FromFormatV(fmt, args) 44 cdef unicode msg = PyUnicode_FromFormatV(fmt, args)
43 rec = logging.LogRecord(d.name, log_levels[level], file, line, msg, None, None, fnc) 45 rec = logging.LogRecord(d.name, log_levels[level], file, line, msg, None, None, fnc)
44 logger = loggers.get(d.name, loggers["efl"]) 46 logger = loggers.get(d.name, loggers["efl"])
45 logger.handle(rec) 47 logger.handle(rec)