Opened 13 years ago
Last modified 12 years ago
#4125 new Patches
Boost.Python should use macros to access members of PyMethodObject
Reported by: | Owned by: | Dave Abrahams | |
---|---|---|---|
Milestone: | Boost 1.43.0 | Component: | python USE GITHUB |
Version: | Boost 1.42.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Attachments (2)
Change History (3)
by , 12 years ago
Attachment: | 4125-use-macros-instead-of-direct-access.patch added |
---|
by , 12 years ago
Attachment: | 4125-use-macros-instead-of-direct-access.2.patch added |
---|
comment:1 by , 12 years ago
Type: | Bugs → Patches |
---|
Note:
See TracTickets
for help on using tickets.