From 2072ae19c91cc2b3888e40e5a63b856473c9129e Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 27 Feb 2022 10:06:45 +0000 Subject: [PATCH] Python function annotations removed from -py3 option. Python function annotations containing C/C++ types are no longer generated when using the -py3 option. Function annotations support has been moved to a feature to provide finer grained control. It can be turned on globally by adding: %feature("python:annotations", "c"); or by using the command line argument: -features python:annotations=c The implementation is designed to be expandable to support different annotations implementations. Future implementations could implement something like the following for generating pure Python types: %feature("python:annotations", "python"); or typing module types to conform to PEP-484: %feature("python:annotations", "typing"); Closes #1561 Issue #735 --- CHANGES.current | 14 +++ Doc/Manual/Contents.html | 5 +- Doc/Manual/Python.html | 86 +++++++++++++------ Examples/test-suite/python/Makefile.in | 1 + .../python/python_annotations_c_runme.py | 27 ++++++ Examples/test-suite/python_annotations_c.i | 26 ++++++ Source/Modules/python.cxx | 7 +- 7 files changed, 133 insertions(+), 33 deletions(-) create mode 100644 Examples/test-suite/python/python_annotations_c_runme.py create mode 100644 Examples/test-suite/python_annotations_c.i diff --git a/CHANGES.current b/CHANGES.current index 2563749a2..1dc7709da 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,20 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.1.0 (in progress) =========================== +2022-02-27: wsfulton + [Python] #735 #1561 Function annotations containing C/C++ types are no longer + generated when using the -py3 option. Function annotations support has been + moved to a feature to provide finer grained control. It can be turned on + globally by adding: + + %feature("python:annotations", "c"); + + or by using the command line argument: + + -features python:annotations=c + + *** POTENTIAL INCOMPATIBILITY *** + 2022-02-26: wsfulton #655 #1840 Add new warning WARN_LANG_USING_NAME_DIFFERENT to warn when a method introduced by a using declaration in a derived class cannot diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index b1da2953a..433ae5f9e 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -1478,7 +1478,10 @@
  • Python 3 Support
  • Python 3 Support