Calling Python macro from ctypes

Steven D'Aprano steve at pearwood.info
Tue Aug 13 02:25:37 EDT 2013


On Mon, 12 Aug 2013 13:42:14 +0200, Peter Otten wrote:

> Steven D'Aprano wrote:
> 
>> Is it possible to call a Python macro from ctypes? For example, Python
>> 3.3 introduces some new macros for querying the internal representation
>> of strings:
>> 
>> http://www.python.org/dev/peps/pep-0393/#new-api
[...]

> That's not possible. It may look like a function, but a preprocessor
> replaces the C macro in the C source before compilation.

That's what I feared.

In that case, how would I use ctypes to access the underlying fields in 
the new string implementation?



-- 
Steven



More information about the Python-list mailing list