diff --git a/CHANGES.current b/CHANGES.current index 1a5a5d0a6..1de8dccab 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,14 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.1.0 (in progress) =========================== +2022-03-23: wsfulton + [Python] #1779 The -py3 option is deprecated and now has no effect on the + code generated. Use of this option results in a deprecated warning. + The related SWIGPYTHON_PY3 macro that this option defined is no longer generated. + + Note that %pythonnondynamic feature generates a metaclass that works on both + Python 2 and Python 3. + 2022-03-21: wsfulton [Python] #1779 pyabc.i for abstract base classes now supports versions of Python prior to 3.3 by using the collection module for these older versions. diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html index 3fa26120f..c5043aaed 100644 --- a/Doc/Manual/Preprocessor.html +++ b/Doc/Manual/Preprocessor.html @@ -169,7 +169,6 @@ SWIG_D_VERSION Unsigned integer target version when using D SWIGGO_CGO Defined when using Go for cgo SWIGGO_GCCGO Defined when using Go for gccgo SWIGGO_INTGO_SIZE Size of the Go type int when using Go (32 or 64) -SWIGPYTHON_PY3 Defined when using Python with -py3 SWIGPYTHON_BUILTIN Defined when using Python with -builtin SWIG_RUBY_AUTORENAME Defined when using Ruby with -autorename diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html index 2ed0211cc..e2c9c8630 100644 --- a/Doc/Manual/Python.html +++ b/Doc/Manual/Python.html @@ -152,11 +152,6 @@ - -
-Caution: This chapter is under repair! -
-This chapter describes SWIG's support of Python. SWIG is compatible with all recent Python versions (Python 2.7 and Python >= 3.2). If you @@ -967,7 +962,6 @@ swig -python -help
SWIG is able to support Python 3.x. The wrapper code generated by -SWIG can be compiled with both Python 2.x or 3.x. Further more, by -passing the -py3 command line option to SWIG, wrapper code -with some Python 3 specific features can be generated (see below -subsections for details of these features). +SWIG can be compiled with both Python 2.x or 3.x. +
-There is a list of known-to-be-broken features in Python 3: +The list of known-to-be-broken features around Python 3 are:
Compatibility Note: SWIG-4.1.0 changed the way that function annotations are generated. -Prior versions required the -py3 option to generate function annotation support +Prior versions required the (now removed) -py3 option to generate function annotation support containing C/C++ types instead of supporting %feature("python:annotations", "c"). Variable annotations were also added in SWIG-4.1.0.
diff --git a/Examples/Makefile.in b/Examples/Makefile.in index 5f56f71dc..1a27b32cd 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -329,13 +329,6 @@ else endif PYTHON_SO = @PYTHON_SO@ -# SWIG option for Python3 -ifneq (,$(PY2)) - SWIGOPTPY3 = -else - SWIGOPTPY3 = -py3 -endif - PYCODESTYLE = @PYCODESTYLE@ PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391 @@ -344,7 +337,7 @@ PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,W291,W391 # ---------------------------------------------------------------- python: $(SRCDIR_SRCS) - $(SWIG) -python $(SWIGOPTPY3) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(SWIG) -python $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(PYTHON_INCLUDE) $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) @@ -353,7 +346,7 @@ python: $(SRCDIR_SRCS) # ----------------------------------------------------------------- python_cpp: $(SRCDIR_SRCS) - $(SWIG) -python $(SWIGOPTPY3) -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(SWIG) -python -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(PYTHON_INCLUDE) $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) @@ -369,12 +362,12 @@ TKINTER = PYTHON_LIBOPTS = $(PYTHON_LINK) @LIBS@ $(TKINTER) $(SYSLIBS) python_static: $(SRCDIR_SRCS) - $(SWIG) -python $(SWIGOPTPY3) -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(SWIG) -python -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET) python_static_cpp: $(SRCDIR_SRCS) - $(SWIG) -python $(SWIGOPTPY3) -c++ -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(SWIG) -python -c++ -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET) diff --git a/Examples/test-suite/python_annotations_c.i b/Examples/test-suite/python_annotations_c.i index 8ecf4c6b0..c023e4d07 100644 --- a/Examples/test-suite/python_annotations_c.i +++ b/Examples/test-suite/python_annotations_c.i @@ -1,7 +1,7 @@ %module python_annotations_c // Tests the C/C++ annotations that were automatically added by using -py3 before swig-4.1.0 -// In swig-4.1.0 and later, the feature below is needed as annotations are no longer generated with -py3 +// In swig-4.1.0 and later, the feature below is needed as the -py3 option was dropped %feature("python:annotations", "c") mymethod; %feature("python:annotations", "c") makeT