[Python-Dev] Use C extensions compiled in release mode on a Python compiled in debug mode

Ivan Pozdeev vano at mail.mipt.ru
Wed Apr 24 14:55:21 EDT 2019


On 24.04.2019 17:03, Antoine Pitrou wrote:
> On Wed, 24 Apr 2019 01:44:17 +0200
> Victor Stinner <vstinner at redhat.com> wrote:
>> The first requirement for the use case is that a Python debug build
>> supports the ABI of a release build. The current blocker issue is that
>> the Py_DEBUG define imply the Py_TRACE_REFS define: PyObject gets 2
>> extra fields (_ob_prev and _ob_next) which change the offset of all
>> attributes of all objects and makes the ABI completely incompatible. I
>> propose to no longer imply Py_TRACE_REFS *by default* (but keep the
>> code):
>>
>> https://bugs.python.org/issue36465
>> https://github.com/python/cpython/pull/12615
> +1 from me.
>
>> The second issue is that library filenames are different for a debug
>> build: SOABI gets an additional "d" flag for Py_DEBUG. A debug build
>> should first look for "NAME.cpython-38dm.so" (flags: "dm"), but then
>> also look for "NAME.cpython-38m.so" (flags: "m").
> Sounds fair (but only on Unix, I guess).
>
>> Maybe pip could be enhanced to support installing C extensions
>> compiled in release mode when using a debug mode. But that's more for
>> convenience, it's not really required, since it is easy to switch the
>> Python runtime between release and debug build.
> Not sure what you mean by "easy to switch the Python runtime".  As soon
> as I want to use pip, I have to use a release build, right?
No, pip works with a debug Python just as well (python.bat -m ensurepip) and installs modules to `<source tree>/site-packages` IIRC.
But building extensions is broken in this case as per https://mail.python.org/pipermail/python-dev/2019-April/157180.html .
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru

-- 
Regards,
Ivan



More information about the Python-Dev mailing list