4aad73cc创建于 2025年7月9日历史提交
Below are the changes for the current release.
See the CHANGES file for changes in older releases.
See the RELEASENOTES file for a summary of changes in each release.
Issue # numbers mentioned below can be found on Github. For more details, add
the issue number to the end of the URL: https://github.com/swig/swig/issues/

Version 4.3.0 (20 Oct 2024)
===========================

2024-10-20: wsfulton
            #3051 Fix seg fault passing invalid unicode values when expecting a
            std::string type - fix for python-3.13.

2024-10-19: olly
	    [ruby] Documentation comments now use `true` and `false` for bool
	    parameter default values, instead of `True` and `False` (which are
	    the Python names and wrong for Ruby!)

2024-10-16: wsfulton
            #874 Add nested classes to the parse tree dumped out by -xml.

2024-10-16: wsfulton
            #2213 Documentation for the XML output options of SWIG's parse tree has
            been added to the Extending chapter.

2024-10-09: wsfulton
            Remove -xmllang option used with -xml, which had no effect on the output.

2024-10-06: wsfulton
            [PHP] #2907 Fix returning NULL from functions with output
            parameters.

            Ensures OUTPUT and INOUT typemaps are handled consistently wrt
            return type.

            Added:
              void SWIG_Php_AppendOutput(zval *target, zval *o, int is_void);

            The t_output_helper function is deprecated. Replace t_output_helper
            in typemaps with SWIG_AppendOutput which calls SWIG_Php_AppendOutput
            appropriately setting the is_void parameter using the $isvoid special
            variable. If t_output_helper is currently being used and a completely
            backwards compatible (but technically incorrect) solution is required,
            then use SWIG_Php_AppendOutput and pass 1 instead of $isvoid for the
            is_void parameter.

            The t_output_helper fragment is also deprecated and is no longer
            needed as the SWIG_Php_AppendOutput function is now always
            generated.

2024-10-05: wsfulton
            [Ruby] Removed backwards compatible output_helper fragment and
            macro.

            Use SWIG_AppendOutput instead of output_helper (does not require
            the output_helper fragment).

	    *** POTENTIAL INCOMPATIBILITY ***

2024-10-05: wsfulton
            [Ruby] #2907 Fix returning NULL from functions with output
            parameters.

            Ensures OUTPUT and INOUT typemaps are handled consistently wrt
            return type.

            New declaration of SWIG_Ruby_AppendOutput is now:

              SWIG_Ruby_AppendOutput(VALUE target, VALUE o, int is_void);

            The 3rd parameter is new and the new $isvoid special variable
            should be passed to it, indicating whether or not the wrapped
            function returns void. If SWIG_Python_AppendOutput is currently being
            used and a completely backwards compatible (but technically incorrect)
            solution is required, then pass 1 for the is_void parameter.

            Also consider replacing with:

              SWIG_AppendOutput(VALUE target, VALUE o);

            which calls SWIG_Ruby_AppendOutput with same parameters but adding
            $isvoid for final parameter.

	    *** POTENTIAL INCOMPATIBILITY ***

2024-09-29: clintonstimpson
            [Python] #2350 Switch implementation from static types to heap
            types using PyType_FromSpec() introduced in Python 3.

            This currently only applies to the default code generation and is
            not available for the -builtin code generation.

2024-09-29: wsfulton
            [Python] Single line docstring comments are stripped of leading and
            trailing whitespace.

2024-09-29: olly
	    SWIG can now handle arbitrary expressions as a subscript (i.e. in
	    `[`...`]`).  We don't actually need to parse expressions in this
	    context so we can just skip to the matching closing square bracket.

2024-09-29: olly
	    C++11 auto variables for which SWIG can't parse the initialiser
	    now give a warning and are ignored rather than SWIG exiting with a
	    parse error.

2024-09-26: olly
	    SWIG now recognises --version as an alias for -version (it has
	    supported --help as an alias for -help since 2006).

2024-09-25: wsfulton
            [MzScheme/Racket] #920 #2830 MzScheme/Racket Deprecation notice.

            This language module no longer works with modern Racket versions
            (Racket 8 and later) due to the introduction of a different C API.
            We are thus putting out a plea for a Racket maintainer to step
            forward and rewrite the MzScheme module for Racket 8, otherwise it
            will be removed in swig-4.4.

2024-09-25: olly
	    SWIG can now handle arbitrary expressions in the parameter list of
	    a method call.  We don't actually need to parse expressions in this
	    context so we can just skip to the matching closing parenthesis.

2024-09-25: olly
	    Add support for C99 _Bool.  SWIG now treats _Bool as an alias for
	    the bool keyword when in C mode.

2024-09-23: olly
	    #3031 Improve support for C++11 trailing return types.  SWIG now
	    supports const references, const and non-const rvalue references,
	    and enum types with an explicit `enum`, `enum class` or `enum
	    struct`.

2024-09-22: wsfulton
            #3023 The binary executables in the Windows distribution are now
            64-bit now instead of 32-bit. Any 32-bit Windows OS users will need
            to build their own version using instructions in Windows.html or
            the "Getting Started Guide" for Windows on the Wiki at
            https://github.com/swig/swig/wiki/Getting-Started#windows.

2024-09-21: wsfulton
            #2879 Don't show warning SWIGWARN_LANG_SMARTPTR_MISSING (520) if
            class is ignored.

2024-09-21: olly
	    SWIG was ignoring `final` if specified after `noexcept`.

2024-09-20: olly
	    [Javascript] Fix problems with v8 support.  The tests and examples
	    now work, and configure can now successfully probe for v8 without
	    assistance on Debian and Ubuntu.

2024-09-19: wsfulton
            #2866 Fix incorrect variable setters being generated when wrapping
            reference member variables. A setter is no longer generated if the
            type of the reference member variable is non-assignable.

2024-09-18: olly
	    Fix parse error for a misplaced Doxygen comment which is the only
	    thing in a class/struct.

2024-09-18: olly
	    Fix parse error for %include/#include in a class/struct followed
	    by a member declaration.

2024-09-16: olly
	    #2995 SWIG now has generic handling for converting integer and
	    boolean literal values for use in target language code, replacing
	    code to do with in many of the target language backends.  This is
	    mainly an internal clean-up but it does fix a bug in the code it
	    replaces when wrapping code such as this:

	      typedef enum { T = (bool)1 } b;

	    With suitable enum wrapping settings, SWIG could incorrect wrap T
	    with value 0 in C#, D and Java.

	    Such cases now work correctly for D, but for C# and Java SWIG now
	    generates invalid C#/Java code because the C++ enum initialiser
	    expression isn't valid for initialising a C#/Java enum - this is
	    really an improvement over generating code which compiled but used
	    the wrong value!

	    If you are affected by this, use %csconstvalue/%javaconstvalue to
	    specify the value of such enumerators as a suitable C#/Java
	    expression.

2024-09-16: olly
	    #2560 Document complex.i in the manual.

2024-09-15: FredBonThermo
	    [C#] #2835 Support -doxygen option for converting doxygen comments
	    to XML formatted C# comments.

2024-09-14: wsfulton
            #2987 C++ reference errors when passing in a 'NULL' change of
            behaviour.  Most languages now use "NullReferenceError" in the
            error message where they previously used "ValueError". Also
            exception changes:

            Guile:    "swig-null-reference-error" instead of "swig-value-error"
            MzScheme: "swig-null-reference-error" instead of "swig-value-error"
            PHP:      TypeError instead of ValueError
            Python:   Consistently raises TypeError instead of a mix of
                      ValueError and TypeError.
            Ruby:     Consistently raises NullReferenceError instead of a mix
                      of ArgumentError and NullReferenceErrorError.

            The consistent raising of a TypeError instead of ValueError for
            Python ensures that incorrectly passing 'None' into a C++ reference
            argument will correctly convert the error into a NotImplemented
            error for the rich comparisons implementations per PEP 207.

	    *** POTENTIAL INCOMPATIBILITY ***

2024-09-13: vadz
	    [C] #2086 Add support for C as a target language.  This support is
	    currently experimental.

2024-09-12: olly
	    Remove remains of %nestedworkaround and the nestedworkaround
	    feature it uses, which were deprecated over 10 years ago in SWIG
	    3.0.0.  Since then uses of these have done nothing except emit a
	    warning.

2024-09-11: wsfulton
            [C# Java] #1188 Add the %interface_additional macro to the family
            of %interface macros for adding additional interfaces for the
            %generated interface to extend/derive from.

2024-09-11: olly
	    #197 #675 #1677 #2047 Fix incorrect inclusion of "enum " when
	    qualifying C++11 "enum class" enumerator names.

2024-09-11: olly
	    [Perl] #630 Fix wrapping of C++11 enum class when -const command
	    line option is specified.

2024-09-07: wsfulton
            #2875 Fix swig-4.1.0 regression using the %interface family of
            macros for multiple inheritance and common bases.

2024-09-06: olly
	    [Python] Stop documenting to define SWIG_FILE_WITH_INIT - this does
	    not actually do anything (and apparently never has!)

2024-09-05: wsfulton
            #2845 Fix duplicate friend wrappers for friend declarations in
            nested classes.

2024-09-03: olly
	    #3010 Improve handling of zero bytes in input files.  This is
	    certainly a corner case, but GCC and clang both accept zero bytes
	    at least in comments, and SWIG's current handling is to ignore
	    the zero byte and all following characters up to and including the
	    next newline, so for example if a // comment contains a zero byte
	    SWIG would quietly ignore the next line.

2024-08-30: olly
	    #2996 Fix generic string literal handling to handle embedded zero
	    bytes.  This allows such strings to work for C# (with %csconst), D
	    (with %dmanifestconst), Go and Java (with %javaconst).  For other
	    target languages SWIG-generated wrappers still truncate such string
	    literals at a zero byte (which is probably the best we can do for
	    target languages where the native string can't contain zero bytes).

2024-08-23: wsfulton
            [Java] #2991 Document solutions for mismatch in C++ access
            specifiers and Java access modifiers in an inheritance hierarchy.

2024-08-19: wsfulton
	    [Python] #2993 Add missing std::filesystem namespace to
	    std_filesystem.i.

2024-08-17: olly
	    #904 #1907 #2579 Fix string literal and character literal wrapping
	    bugs.

2024-08-15: olly
	    Fix parsing of octal string escapes.  We now stop when the next
	    character is digit 8 or 9, and stop after 3 octal digits even if
	    the next character is an octal digit.

2024-08-15: olly
	    SWIG now gives an error for digits 8 and 9 in octal constants -
	    previously these were quietly accepted resulting in a bogus value.
	    C++11 binary constants are now treated similarly - only digits 0
	    and 1 were allowed before, but trying to use other digits now gives
	    a clearer error.

2024-08-12: olly
	    #657 Allow unmatched ' and " in #error and #warning.

2024-08-09: wsfulton
	    [Java] #409 Add the constantsmodifiers pragma so that the
	    visibility for the Java constants interface can be changed from
	    public to default.

2024-08-02: vadz
	    [Python] #2966 Fix overloaded Doxygen comments. Sometimes the
	    Doxygen comments were not combined into one Pydoc comment.

2024-08-01: olly
	    Fix wrapping of string constants containing bytes 0-8, 11, 12 or
	    14-31 followed by a digit '0' to '7'.  We were emitting these bytes
	    as a one or two character octal escape sequence which when
	    interpreted would include the following character.

2024-07-27: olly
	    #2087 Fix parsing of `noexcept` on a function pointer type used
	    as the type of a function parameter.  We currently generate
	    invalid C++ code if we try to wrap the function parameter, but
	    at least the user can `%ignore` the parameter or the whole
	    function, whereas the parse error was hard to work around.

2024-07-26: olly
	    Support parsing `noexcept(X)` in expressions, including deducing
	    its type (which is always `bool`).

2024-07-21: wsfulton
	    [Python] Add missing slot for init in struct _specialization_cache
            needed for python-3.13 builtin wrappers.

2024-07-21: shadchin
	    [Python] #2968 Add missing tp_versions_used slot needed for
	    python-3.13.

2024-07-19: olly
	    -Wallkw now includes keywords for Javascript.

2024-07-19: vadz
	    [Javascript] #2940 Names of object properties can be keywords in
	    Javascript so don't auto-rename them to have a leading underscore.

2024-07-18: olly
	    #1917 Stop removing `f` and `F` suffixes from float literals.
	    This was resulting in incorrect generated C# and Java code.  For
	    some cases such as `#define CONSTANT 1.0f` this was a regression
	    introduced in 4.2.0 when we started more correctly wrapping these
	    as `float` rather than `double`.

2024-07-15: vadz
            #2941 Suppress warning WARN_PARSE_USING_UNDEF for ignored using
            declarations.

2024-07-03: wsfulton
            #2860 Enhance Windows.html documentation for the popular Visual C++
            compiler recommending users to correctly set the __cplusplus macro
            in order to benefit from modern standards based features that SWIG
            provides.

2024-07-02: erezgeva
	    [Python, Ruby] #2870 Change the thread safety options for the
            director code that manages C++ director pointer ownership. Please
            define SWIG_THREADS to turn on thread safety. For Python, this can
            also be done via the threads module option or -threads.
            Implementation now includes a C++11 std::mutex option as priority
            over WIN32 and pthread mutexes. See director_guard.swg for further
            implementation details.

2024-06-28: vadz
            #2935 Fix instantiation of specialized template where the primary
            template is a forward class template declaration.

2024-06-16: wsfulton
            #2927 Don't ignore overloaded friend functions that are also
            declared constexpr.

2024-06-15: wsfulton
            [Python] Removed deprecated pytuplehlp.swg file and t_output_helper.
            Use SWIG_AppendOutput as a direct replacement for t_output_helper.

	    *** POTENTIAL INCOMPATIBILITY ***

2024-06-15: vadz
            [Python] #2907 Fix returning null from functions with output
            parameters.  Ensures OUTPUT and INOUT typemaps are handled
            consistently wrt return type.

            New declaration of SWIG_Python_AppendOutput is now:

              SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void);

            The 3rd parameter is new and the new $isvoid special variable
            should be passed to it, indicating whether or not the wrapped
            function returns void. If SWIG_Python_AppendOutput is currently being
            used and a completely backwards compatible (but technically incorrect)
            solution is required, then pass 1 for the is_void parameter.

            Also consider replacing with:

              SWIG_AppendOutput(PyObject* result, PyObject* obj);

            which calls SWIG_Python_AppendOutput with same parameters but adding $isvoid
            for final parameter.

	    *** POTENTIAL INCOMPATIBILITY ***

2024-06-15: wsfulton
            #2907 Add $isvoid special variable which expands to 1 if the
            wrapped function has a void return, otherwise expands to 0.

2024-06-14: jschueller
	    #2863 Support Python 3.13 (currently in prerelease).

2024-06-13: erezgeva
            #2609 Fix Java typemap (const char *STRING, size_t LENGTH) to
            marshall as Java String instead of Java byte[]. If the old
            behaviour is required, replace with typemap (const void *BYTES,
            size_t LENGTH).

            Add multi-argument typemaps to most languages:

              (const char *STRING, size_t LENGTH)

            All languages now use a target language string type for this
            typemap.

            New multi-argument typemaps have been added to most target
            languages for use with C raw data (cdata):

              (const void *BYTES, size_t LENGTH) to

            Statically typed languages use a byte array for this typemap, while
            scripting languages remain using a string.

	    *** POTENTIAL INCOMPATIBILITY ***

            * Raw C data: Go uses byte array and int64 for size.
            Users can use the (const char *STRING, size_t LENGTH) typemaps for
            strings.

2024-06-06: olly
	    Support alignof(T) for arbitrary type T, and deduce the type of
	    alignof(T) as size_t.

2024-06-06: olly
	    #2919 Support parsing `sizeof(X)` for any expression or type X by
	    skipping balanced parentheses.  We don't need to actually parse X
	    since the type of sizeof is always size_t.

2024-06-05: leakec
            #2873 Fix -fvirtual and using declarations for inheriting base
            class methods corner case.

2024-05-31: wsfulton
            [C#, D, Java, Javascript, Lua] Fix %nspace and %nspacemove for
            nested classes and enums in a class. For example:

              %nspace Space::OuterClass80;
              namespace Space {
                struct OuterClass80 {
                  struct InnerClass80 {
                    struct BottomClass80 {};
                  };
                  enum InnerEnum80 { ie80a, ie80b };
                };
              }

            Previously the following were additionally required for some
            languages:

              %nspace Space::OuterClass80::InnerClass80;
              %nspace Space::OuterClass80::InnerClass80::Bottom80;

            Now the appropriate nspace setting is taken from the outer class.

            A new warning has also been introduced to check and correct
            conflicting nspace usage, for example if the following is
            additionally added:

              %nspacemove(AnotherSpace) Space::OuterClass80::InnerClass80;

            The following warning appears as an inner class can't be moved
            outside of the outer class:

              Warning 406: Ignoring nspace setting (AnotherSpace) for 'Space::OuterClass80::InnerClass80',
              Warning 406: as it conflicts with the nspace setting (Space) for outer class 'Space::OuterClass80'.

2024-05-31: wsfulton
            [C#, D, Java, Javascript, Lua] #2782 Enhance the nspace feature
            with %nspacemove for moving a class or enum into a differently
            named %target language equivalent of a namespace.

2024-05-31: binaire10
	    [Ruby] #2906 Fix SWIG wrappers for std::map and std::vector to
	    work with Ruby's "select".

2024-05-30: olly
	    #2914 Handle alternative operator names in C++ preprocessor
	    expressions.  Handle full set of alternative operator names in
	    C++ expressions (previously only "and", "or" and "not" were
	    understood).

2024-05-15: olly
	    #2868 Support C++17 fold expressions.

2024-05-15: olly
	    #2876 Report error if parser stack depth exceeded.  Previously SWIG
	    would quietly exit with status 0 in this situation.

2024-04-12: pfusik
            [Javascript] #2869 Fix JavaScript _wrap_getCPtr on 64-bit Windows

2024-04-12: wsfulton
            [Javascript, MzScheme, Python, Ruby] #202 Remove the vast majority
            of the /*@SWIG:...*/ locator strings in the generated wrappers for
            these 4 languages to help with reproducible builds.

2024-04-08: thewtex
            [Python] #2856 Include stdlib.h for more recent Python Stable ABI

2024-03-28: olly
	    Fix preprocessor to handle C-style comment ending **/ in macro
	    argument.

2024-03-27: wsfulton
            [Python] #2844 Fix for using more than one std::string_view type in
            a method.

2024-03-27: wsfulton
            [R] #2847 Add missing std::vector<long> and std::vector<long long>
            typemaps which were missing depending on whether or not
            SWIGWORDSIZE64 was defined.

2024-03-25: wsfulton
            [Python] #2826 Stricter stable ABI conformance.
            1. Use Py_DecRef and Py_IncRef when Py_LIMITED_API is defined
               instead of macro equivalents, such as Py_INCREF.
            2. Don't use PyUnicode_GetLength from python-3.7 and later.
            3. Use PyObject_Free instead of deprecated equivalents.

2024-03-25: olly
	    #2848 Fix elision of comma before ##__VA_ARGS__ which we document
	    as supported but seems to have not worked since before 2009.

2024-03-11: wsfulton
            [C#] #2829 Improve handling and documentation of missing enum base
            type information.

2024-03-07: wsfulton
            [Ocaml] Fix SWIGTYPE MOVE 'in' typemap to fix compilation error.

2024-03-07: wsfulton
            Add SWIGTYPE MOVE 'typecheck' typemaps to remove warning 472 
            (SWIGWARN_TYPEMAP_TYPECHECK_UNDEF).

2024-03-06: wsfulton
            Add support for std::unique_ptr & typemaps. Non-const inputs
            implement move semantics from proxy class to C++ layer, otherwise
            const inputs and all reference returns behave like any other lvalue
            reference to a class.

2024-03-06: wsfulton
            [Javascript, MzScheme, Octave] Support NULL being passed into char*
            typemaps.

2024-03-06: christophe-calmejane,wsfulton
            #2650 Add support for movable std::unique_ptr by adding in
            std::unique_ptr && input typemaps. The std::unique && output
            typemaps do not support move semantics by default and behave like
            lvalue references.

2024-03-06: wsfulton
            Add missing use of move constructor instead of copy constructor
            when passing movable types by value. This was previously
            implemented only for parameters passed to a global function or
            static member function and is now extended to parameters passed to
            member methods as well as constructors.

2024-03-01: olly
	    [Java] #2819 Suppress Java removal warnings for uses of
	    System.runFinalization().  SWIG will need to stop relying on
	    finalize methods, but we know that and meanwhile these warnings
	    make the testsuite output noisy.  Fix use of deprecated form
	    of Runtime.exec() in the doxygen example.

2024-02-28: wsfulton
            #1754 Fix compilation errors in generated code when instantiating a
            templated static method within a template (non-static methods and
            constructors were always okay). For example:

              template <typename T> class X {
                template <class InputIterator>
                  static void fn(InputIterator first, InputIterator last) {
                    ...
                  }
              };
              class SimpleIterator { ... };

              %extend X<int> {
                %template(fn) fn<SimpleIterator>;
              }