[Python-Dev] libpython added to ABI tracker

Andrey Ponomarenko aponomarenko at rosalab.ru
Wed Apr 2 16:18:53 CEST 2014


Nick Coghlan wrote:
> Regarding the warnings for this one - is there a way for the checker
> to warn if data structures are exposed directly, rather than as opaque
> types? It's fine if there isn't, it would just be cool if there was -
> one of the premises of the stable ABI is that it *doesn't* expose the
> type definitions directly to consuming code, just the pointers to them
> (hence allowing the struct size to change without actually breaking
> compatibility with the defined ABI).

The ABI of the library can be dumped by the abi-compliance-checker basic 
tool to a text file in the human readable format, so anyone can analyse 
it in order to find problems of any kind.

Homepage of the tool: https://github.com/lvc/abi-compliance-checker

To dump the libpython ABI type:

$> abi-compliance-checker -l libpython -dump descriptor.xml

The descriptor.xml input file ({RELPATH} - path to the python install 
tree, i.e. installation "prefix"):

<version>
     3.4.0
</version>

<headers>
     {RELPATH}/include
</headers>

<libs>
     {RELPATH}/lib/libpython3.4m.so.1.0
</libs>

<skip_including>
     ast.h
     Python-ast.h
     asdl.h
     pyexpat.h
     pymactoolbox.h
</skip_including>

<gcc_options>
     -DPy_LIMITED_API=0x03020000
</gcc_options>

I've already created the sample dump of the libpython-3.4.0 stable ABI 
here: http://upstream-tracker.org/downloads/libpython_3.4.0.abi.tar.gz

In order to analyse data types in the ABI please read 'TypeInfo' section 
of the dump.

I see several structures with exposed definition in the stable ABI v3.4.0:

struct PyStructSequence_Desc
struct grammar
struct PyStructSequence_Field
struct _node
struct cchar_t
struct PyType_Spec
struct PyType_Slot
struct dfa
struct labellist
struct PyMethodDef
struct _Py_Identifier
struct state
struct PyVarObject
struct arc
struct label
struct PyModuleDef
struct PyModuleDef_Base
struct PyMemberDef
struct PyGetSetDef
struct _object
struct PyCursesWindowObject


Thanks.

-- 
Andrey Ponomarenko, NTC IT ROSA.



More information about the Python-Dev mailing list