17db96d56Sopenharmony_ci.. highlight:: c 27db96d56Sopenharmony_ci 37db96d56Sopenharmony_ci.. _cporting-howto: 47db96d56Sopenharmony_ci 57db96d56Sopenharmony_ci************************************* 67db96d56Sopenharmony_ciPorting Extension Modules to Python 3 77db96d56Sopenharmony_ci************************************* 87db96d56Sopenharmony_ci 97db96d56Sopenharmony_ciWe recommend the following resources for porting extension modules to Python 3: 107db96d56Sopenharmony_ci 117db96d56Sopenharmony_ci* The `Migrating C extensions`_ chapter from 127db96d56Sopenharmony_ci *Supporting Python 3: An in-depth guide*, a book on moving from Python 2 137db96d56Sopenharmony_ci to Python 3 in general, guides the reader through porting an extension 147db96d56Sopenharmony_ci module. 157db96d56Sopenharmony_ci* The `Porting guide`_ from the *py3c* project provides opinionated 167db96d56Sopenharmony_ci suggestions with supporting code. 177db96d56Sopenharmony_ci* The `Cython`_ and `CFFI`_ libraries offer abstractions over 187db96d56Sopenharmony_ci Python's C API. 197db96d56Sopenharmony_ci Extensions generally need to be re-written to use one of them, 207db96d56Sopenharmony_ci but the library then handles differences between various Python 217db96d56Sopenharmony_ci versions and implementations. 227db96d56Sopenharmony_ci 237db96d56Sopenharmony_ci.. _Migrating C extensions: http://python3porting.com/cextensions.html 247db96d56Sopenharmony_ci.. _Porting guide: https://py3c.readthedocs.io/en/latest/guide.html 257db96d56Sopenharmony_ci.. _Cython: https://cython.org/ 267db96d56Sopenharmony_ci.. _CFFI: https://cffi.readthedocs.io/en/latest/ 27