mirror of https://github.com/swig/swig.git
The manual still used the Python 2 compatibility macros in its typemap examples. These were removed from the generated code in 4.5.0, so the examples no longer compile. Each macro is replaced with the Python 3 API that keeps the example working as documented: PyUnicode_* where the example converts Python text (char *str, char *argv[], const char *fmt, std::string and the char and char * typecheck typemaps) and PyBytes_* for the read()/write() example, which passes a binary buffer. The read/write session transcript is updated to bytes literals and Python 3 octal syntax to match. The "Useful Python Functions" section of the Python chapter listed the PyString_* functions and the Python 2 only PyFile_FromFile and PyFile_AsFile. These are replaced by the PyUnicode_*, PyBytes_* and PyObject_AsFileDescriptor equivalents. A compatibility note is added listing every removed macro alongside the Python 3 API it expanded to. Also fix the "newfree" typemap example in the Ruby chapter, which called PyString_FromString instead of rb_str_new2. Closes #3530 Assisted-by: Claude Code (Opus 5) |
||
|---|---|---|
| .. | ||
| Devel | ||
| Manual | ||
| README | ||
README
Doc/Manual - Latest version of the SWIG user manual
Doc/Devel - Developer documentation concerning SWIG internals.
(not necessarily up to date)
Open the index.html file in each of these directories with a web browser.