Benjamin Peterson | e9bbc8b | 2008-09-28 02:06:32 +0000 | [diff] [blame] | 1 | .. highlightlang:: c |
| 2 | |
Guido van Rossum | 56076da | 2008-12-02 22:58:36 +0000 | [diff] [blame] | 3 | .. _cporting-howto: |
| 4 | |
Larry Hastings | 62417a0 | 2012-02-28 16:21:47 -0800 | [diff] [blame] | 5 | ************************************* |
| 6 | Porting Extension Modules to Python 3 |
| 7 | ************************************* |
Benjamin Peterson | e9bbc8b | 2008-09-28 02:06:32 +0000 | [diff] [blame] | 8 | |
Petr Viktorin | 2d3ff2b | 2018-09-24 12:42:33 +0200 | [diff] [blame^] | 9 | We recommend the following resources for porting extension modules to Python 3: |
Benjamin Peterson | e9bbc8b | 2008-09-28 02:06:32 +0000 | [diff] [blame] | 10 | |
Petr Viktorin | 2d3ff2b | 2018-09-24 12:42:33 +0200 | [diff] [blame^] | 11 | * The `Migrating C extensions`_ chapter from |
| 12 | *Supporting Python 3: An in-depth guide*, a book on moving from Python 2 |
| 13 | to Python 3 in general, guides the reader through porting an extension |
| 14 | module. |
| 15 | * The `Porting guide`_ from the *py3c* project provides opinionated |
| 16 | suggestions with supporting code. |
| 17 | * The `Cython`_ and `CFFI`_ libraries offer abstractions over |
| 18 | Python's C API. |
| 19 | Extensions generally need to be re-written to use one of them, |
| 20 | but the library then handles differences between various Python |
| 21 | versions and implementations. |
Benjamin Peterson | e9bbc8b | 2008-09-28 02:06:32 +0000 | [diff] [blame] | 22 | |
Petr Viktorin | 2d3ff2b | 2018-09-24 12:42:33 +0200 | [diff] [blame^] | 23 | .. _Migrating C extensions: http://python3porting.com/cextensions.html |
| 24 | .. _Porting guide: https://py3c.readthedocs.io/en/latest/guide.html |
| 25 | .. _Cython: http://cython.org/ |
| 26 | .. _CFFI: https://cffi.readthedocs.io/en/latest/ |