Calling Python macro from ctypes

Steven D'Aprano steve at pearwood.info
Mon Aug 12 06:01:59 EDT 2013


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


So I try this in 3.3:

py> import ctypes
py> ctypes.pythonapi.PyUnicode_MAX_CHAR_VALUE
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.3/ctypes/__init__.py", line 366, in 
__getattr__
    func = self.__getitem__(name)
  File "/usr/local/lib/python3.3/ctypes/__init__.py", line 371, in 
__getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python3.3: undefined symbol: PyUnicode_MAX_CHAR_VALUE





-- 
Steven



More information about the Python-list mailing list