mirror of https://github.com/swig/swig
parent
df86fbc54e
commit
a343b7e254
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
</pre></div>
|
||||
|
|
|
@ -152,11 +152,6 @@
|
|||
<!-- INDEX -->
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<b>Caution: This chapter is under repair!</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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
|
|||
<tr><td>-nortti </td><td>Disable the use of the native C++ RTTI with directors</td></tr>
|
||||
<tr><td>-nothreads </td><td>Disable thread support for the entire interface</td></tr>
|
||||
<tr><td>-olddefs </td><td>Keep the old method definitions when using -fastproxy</td></tr>
|
||||
<tr><td>-py3 </td><td>Generate code with Python 3 specific features and syntax</td></tr>
|
||||
<tr><td>-relativeimport </td><td>Use relative Python imports</td></tr>
|
||||
<tr><td>-threads </td><td>Add thread support for all the interface</td></tr>
|
||||
<tr><td>-O </td><td>Enable the following optimization options: -fastdispatch -fastproxy -fvirtual</td></tr>
|
||||
|
@ -6744,13 +6738,11 @@ to do this (remember you are now the Python importer) or use dynamic linking.
|
|||
|
||||
<p>
|
||||
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 <tt>-py3</tt> 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.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
<ul>
|
||||
<li>No more support for FILE* typemaps, because PyFile_AsFile has been dropped
|
||||
|
@ -6875,7 +6867,7 @@ class V(object):
|
|||
|
||||
<p>
|
||||
<b>Compatibility Note:</b> SWIG-4.1.0 changed the way that function annotations are generated.
|
||||
Prior versions required the <tt>-py3</tt> option to generate function annotation support
|
||||
Prior versions required the (now removed) <tt>-py3</tt> option to generate function annotation support
|
||||
containing C/C++ types instead of supporting <tt>%feature("python:annotations", "c")</tt>.
|
||||
Variable annotations were also added in SWIG-4.1.0.
|
||||
</p>
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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<short>;
|
||||
%feature("python:annotations", "c") global_ints;
|
||||
|
|
|
@ -69,8 +69,6 @@ static int no_header_file = 0;
|
|||
static int max_bases = 0;
|
||||
static int builtin_bases_needed = 0;
|
||||
|
||||
static int py3 = 0;
|
||||
|
||||
/* C++ Support + Shadow Classes */
|
||||
|
||||
static int have_constructor = 0;
|
||||
|
@ -131,7 +129,6 @@ static const char *usage3 = "\
|
|||
-nortti - Disable the use of the native C++ RTTI with directors\n\
|
||||
-nothreads - Disable thread support for the entire interface\n\
|
||||
-olddefs - Keep the old method definitions when using -fastproxy\n\
|
||||
-py3 - Generate code with Python 3 specific features and syntax\n\
|
||||
-relativeimport - Use relative Python imports\n\
|
||||
-threads - Add thread support for all the interface\n\
|
||||
-O - Enable the following optimization options:\n\
|
||||
|
@ -396,10 +393,6 @@ public:
|
|||
fputs(usage1, stdout);
|
||||
fputs(usage2, stdout);
|
||||
fputs(usage3, stdout);
|
||||
} else if (strcmp(argv[i], "-py3") == 0) {
|
||||
py3 = 1;
|
||||
Preprocessor_define("SWIGPYTHON_PY3", 0);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-builtin") == 0) {
|
||||
builtin = 1;
|
||||
Preprocessor_define("SWIGPYTHON_BUILTIN", 0);
|
||||
|
@ -415,7 +408,10 @@ public:
|
|||
strcmp(argv[i], "-modernargs") == 0 ||
|
||||
strcmp(argv[i], "-noproxydel") == 0 ||
|
||||
strcmp(argv[i], "-safecstrings") == 0) {
|
||||
Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
|
||||
Printf(stderr, "Deprecated command line option: %s. Ignored, this option is now always on.\n", argv[i]);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-py3") == 0) {
|
||||
Printf(stderr, "Deprecated command line option: %s. Ignored, this option is no longer supported.\n", argv[i]);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-aliasobj0") == 0 ||
|
||||
strcmp(argv[i], "-buildnone") == 0 ||
|
||||
|
@ -443,7 +439,7 @@ public:
|
|||
strcmp(argv[i], "-oldrepr") == 0 ||
|
||||
strcmp(argv[i], "-outputtuple") == 0 ||
|
||||
strcmp(argv[i], "-proxydel") == 0) {
|
||||
Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
|
||||
Printf(stderr, "Deprecated command line option: %s. This option is no longer available.\n", argv[i]);
|
||||
Swig_mark_arg(i);
|
||||
Exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -871,13 +867,8 @@ public:
|
|||
Printv(f_shadow_py, "\n", f_shadow_begin, "\n", NIL);
|
||||
|
||||
Printv(f_shadow_py, "\nfrom sys import version_info as _swig_python_version_info\n", NULL);
|
||||
if (py3) {
|
||||
Printv(f_shadow_py, "if _swig_python_version_info < (3, 0):\n", NULL);
|
||||
Printv(f_shadow_py, tab4, "raise RuntimeError(\"Python 3.x or later required\")\n\n", NULL);
|
||||
} else {
|
||||
Printv(f_shadow_py, "if _swig_python_version_info < (2, 7, 0):\n", NULL);
|
||||
Printv(f_shadow_py, tab4, "raise RuntimeError(\"Python 2.7 or later required\")\n\n", NULL);
|
||||
}
|
||||
Printv(f_shadow_py, "if _swig_python_version_info < (2, 7, 0):\n", NULL);
|
||||
Printv(f_shadow_py, tab4, "raise RuntimeError(\"Python 2.7 or later required\")\n\n", NULL);
|
||||
|
||||
if (Len(f_shadow_after_begin) > 0)
|
||||
Printv(f_shadow_py, f_shadow_after_begin, "\n", NIL);
|
||||
|
|
Loading…
Reference in New Issue