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.
This commit is contained in:
parent
3e99eb5fe9
commit
374f267ecc
|
@ -15,7 +15,6 @@
|
|||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from cpython cimport PyString_FromFormatV
|
||||
from libc.string cimport const_char
|
||||
from efl.eina cimport Eina_Log_Domain, const_Eina_Log_Domain, Eina_Log_Level, \
|
||||
eina_log_print_cb_set, eina_log_domain_register, eina_log_level_set, \
|
||||
|
@ -25,6 +24,9 @@ cdef extern from "stdarg.h":
|
|||
ctypedef struct va_list:
|
||||
pass
|
||||
|
||||
cdef extern from "Python.h":
|
||||
object PyUnicode_FromFormatV(char *format, va_list vargs)
|
||||
|
||||
cdef tuple log_levels = (
|
||||
50,
|
||||
40,
|
||||
|
@ -39,7 +41,7 @@ cdef void py_eina_log_print_cb(const_Eina_Log_Domain *d,
|
|||
Eina_Log_Level level,
|
||||
const_char *file, const_char *fnc, int line,
|
||||
const_char *fmt, void *data, va_list args) with gil:
|
||||
cdef str msg = PyString_FromFormatV(fmt, args)
|
||||
cdef unicode msg = PyUnicode_FromFormatV(fmt, args)
|
||||
rec = logging.LogRecord(d.name, log_levels[level], file, line, msg, None, None, fnc)
|
||||
logger = loggers.get(d.name, loggers["efl"])
|
||||
logger.handle(rec)
|
||||
|
|
Loading…
Reference in New Issue