[New-bugs-announce] [issue19538] Changed function prototypes in the PEP 384 stable ABI

Thomas Heller report at bugs.python.org
Sat Nov 9 21:28:24 CET 2013


New submission from Thomas Heller:

(As requested by email in python-dev I'm reporting this problem)

Some function prototypes in the stable ABI have been changed between Python 3.3 and 3.4.
PyObject_CallFunction is an example, the second parameter has been changed from 'char *' to 'const char *', which leads to compiler warnings in my code.

I admit that my use case is probably weird, but here we go:

I want to embed Python and use the stable ABI (API?) so that I the executable does not have to be recompiled for different Python versions.  I want to link dynamically to the Python runtime (loaded with LoadLibrary on Windows).  Also I do not want in use python3.dll.

To make calling the functions less painful I ended up with the following approach.

My executable is compiled with 'Py_BUILD_CORE' defined so that I can *implement* PyObject_CallFunction myself.  I have a python-dynload.c file which implements the API functions in this way:

#define Py_BUILD_CORE
#include <Python.h>
HMODULE hPyDLL; /* the module handle of a dynamically loaded python3X.dll */

PyObject *PyObject_CallFunction(PyObject *callable, char *format, ...)
{
   /* implement by forwarding to functions in the dynloaded dll */
}

When I compile this code with the Python 3.3 headers, everything is ok.  With the Python 3.4 headers, I get

  source/python-dynload.c(75) : warning C4028: formal parameter 2 different from declaration

When I change the second parameter in the function definition to 'const char *format', the situation reverses, compiling with 3.3 gives the warning but 3.4 is ok.

----------
components: Build
keywords: 3.3regression
messages: 202495
nosy: theller
priority: normal
severity: normal
status: open
title: Changed function prototypes in the PEP 384 stable ABI
versions: Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19538>
_______________________________________


More information about the New-bugs-announce mailing list