[Boost-bugs] [Boost C++ Libraries] #4125: Boost.Python should use macros to access members of PyMethodObject

Subject: [Boost-bugs] [Boost C++ Libraries] #4125: Boost.Python should use macros to access members of PyMethodObject
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-04-20 17:40:51


#4125: Boost.Python should use macros to access members of PyMethodObject
-------------------------------------------------------+--------------------
 Reporter: Amaury Forgeot d'Arc <amauryfa@…> | Owner: dave
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: Python
  Version: Boost 1.42.0 | Severity: Problem
 Keywords: |
-------------------------------------------------------+--------------------
 In libs/python/src/wrapper.cpp, the members of !PyMethodObject are
 accessed directly:
 {{{
   ((PyMethodObject*)m.get())->im_self
   ((PyMethodObject*)m.get())->im_func
 }}}
 These accesses are not documented in the python API.
 I suggest to use the following macros instead, which have been existing
 since python 1.6 at least:
 {{{
   PyMethod_GET_SELF(m.get())
   PyMethod_GET_FUNCTION(m.get())
 }}}
 When using CPython, these macros expand to exactly the same code.

 The goal is to allow other implementations of python, like !PyPy, to
 provide alternate compatible implementation of these macros, and thus be
 able to load modules compiled with Boost.Python.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4125>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC