diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html index eee47f922..ff5ef2993 100644 --- a/Doc/Manual/Python.html +++ b/Doc/Manual/Python.html @@ -5853,12 +5853,19 @@ class M2(pkg2.mod3.M3): pass -

By default, SWIG would generate mod2.py proxy file with +

By default, SWIG will generate mod2.py proxy file with import directive as in point 1. This can be changed with the -relativeimport command line option. The -relativeimport instructs -SWIG to organize imports as in point 2 (for Python < 2.7.0) or as in point 4 -for Python 2.7.0 and newer. This is a check done at the time the module is -imported. In short, if you have +SWIG to organize imports as in point 4 for Python 2.7.0 and newer. +

+ +

+Compatibility Note: Versions of SWIG prior to SWIG-4.0.0 supported Python < 2.7.0 +and would organize the imports as in point 2 if an older version of Python was detected at runtime. +

+ +

+In short, if you have mod2.i and mod3.i as above, then without -relativeimport SWIG will write

@@ -5873,13 +5880,8 @@ write

-from sys import version_info
-if version_info >= (2, 7, 0):
-    from . import pkg2
-    import pkg1.pkg2.mod3
-else:
-    import pkg2.mod3
-del version_info
+from . import pkg2
+from .pkg2 import mod3
 
@@ -5917,7 +5919,7 @@ from __future__ import absolute_import -

at the very beginning of his proxy *.py file. In SWIG, it may be +

at the very beginning of your proxy *.py file. In SWIG, it may be accomplished with %pythonbegin directive as follows:

@@ -6129,8 +6131,8 @@ covered next.

-The pure Python module needs to load the C/C++ module in order to link -to the wrapped C/C++ methods. To do this it must make some assumptions +The pure Python module needs to load the C/C++ module in order to call +the wrapped C/C++ methods. To do this it must make some assumptions about what package the C/C++ module may be located in. The approach the pure Python module uses to find the C/C++ module is as follows: