Author: brane
Date: Mon Nov  4 05:59:36 2019
New Revision: 1869354

URL: http://svn.apache.org/viewvc?rev=1869354&view=rev
Log:
Merge the swig-py3 branch to trunk.

Added:
    subversion/trunk/build/ac-macros/py3c.m4
      - copied unchanged from r1869353, 
subversion/branches/swig-py3/build/ac-macros/py3c.m4
    subversion/trunk/build/generator/templates/vcnet_vsprops.ezt
      - copied unchanged from r1869353, 
subversion/branches/swig-py3/build/generator/templates/vcnet_vsprops.ezt
    
subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py3c.h
      - copied unchanged from r1869353, 
subversion/branches/swig-py3/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py3c.h
    subversion/trunk/subversion/bindings/swig/python/tests/typemap.py
      - copied unchanged from r1869353, 
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/typemap.py
Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/INSTALL
    subversion/trunk/Makefile.in
    subversion/trunk/aclocal.m4
    subversion/trunk/build.conf
    subversion/trunk/build/ac-macros/swig.m4
    subversion/trunk/build/generator/gen_base.py
    subversion/trunk/build/generator/gen_make.py
    subversion/trunk/build/generator/gen_vcnet_vcproj.py
    subversion/trunk/build/generator/gen_win.py
    subversion/trunk/build/generator/gen_win_dependencies.py
    subversion/trunk/build/generator/swig/__init__.py
    subversion/trunk/build/generator/swig/header_wrappers.py
    subversion/trunk/build/generator/templates/build-outputs.mk.ezt
    subversion/trunk/build/generator/templates/vcnet_vcproj.ezt
    subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt
    subversion/trunk/build/get-py-info.py
    subversion/trunk/configure.ac
    subversion/trunk/gen-make.py
    subversion/trunk/get-deps.sh
    subversion/trunk/subversion/bindings/swig/INSTALL
    subversion/trunk/subversion/bindings/swig/core.i
    subversion/trunk/subversion/bindings/swig/include/proxy.py
    subversion/trunk/subversion/bindings/swig/include/proxy.swg
    subversion/trunk/subversion/bindings/swig/include/proxy_apr.swg
    subversion/trunk/subversion/bindings/swig/include/svn_containers.swg
    subversion/trunk/subversion/bindings/swig/include/svn_global.swg
    subversion/trunk/subversion/bindings/swig/include/svn_string.swg
    subversion/trunk/subversion/bindings/swig/include/svn_swigcompat.swg
    subversion/trunk/subversion/bindings/swig/include/svn_types.swg
    
subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
    
subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
    subversion/trunk/subversion/bindings/swig/python/svn/client.py
    subversion/trunk/subversion/bindings/swig/python/svn/core.py
    subversion/trunk/subversion/bindings/swig/python/svn/delta.py
    subversion/trunk/subversion/bindings/swig/python/svn/diff.py
    subversion/trunk/subversion/bindings/swig/python/svn/fs.py
    subversion/trunk/subversion/bindings/swig/python/svn/ra.py
    subversion/trunk/subversion/bindings/swig/python/svn/repos.py
    subversion/trunk/subversion/bindings/swig/python/svn/wc.py
    subversion/trunk/subversion/bindings/swig/python/tests/auth.py
    subversion/trunk/subversion/bindings/swig/python/tests/checksum.py
    subversion/trunk/subversion/bindings/swig/python/tests/client.py
    subversion/trunk/subversion/bindings/swig/python/tests/core.py
    subversion/trunk/subversion/bindings/swig/python/tests/delta.py
    subversion/trunk/subversion/bindings/swig/python/tests/fs.py
    subversion/trunk/subversion/bindings/swig/python/tests/mergeinfo.py
    subversion/trunk/subversion/bindings/swig/python/tests/ra.py
    subversion/trunk/subversion/bindings/swig/python/tests/repository.py
    subversion/trunk/subversion/bindings/swig/python/tests/run_all.py
    
subversion/trunk/subversion/bindings/swig/python/tests/trac/versioncontrol/main.py
    
subversion/trunk/subversion/bindings/swig/python/tests/trac/versioncontrol/svn_fs.py
    
subversion/trunk/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py
    subversion/trunk/subversion/bindings/swig/python/tests/utils.py
    subversion/trunk/subversion/bindings/swig/python/tests/wc.py
    subversion/trunk/subversion/bindings/swig/svn_client.i
    subversion/trunk/subversion/libsvn_fs_x/   (props changed)
    subversion/trunk/subversion/libsvn_subr/utf8proc/   (props changed)

Propchange: subversion/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Nov  4 05:59:36 2019
@@ -41,6 +41,7 @@ mkmf.log
 .cdtproject
 .settings
 .cproject
+py3c
 zlib
 sqlite-amalgamation
 serf

Propchange: subversion/trunk/
------------------------------------------------------------------------------
  Merged /subversion/branches/swig-py3:r1813660-1869353

Modified: subversion/trunk/INSTALL
URL: 
http://svn.apache.org/viewvc/subversion/trunk/INSTALL?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/INSTALL (original)
+++ subversion/trunk/INSTALL Mon Nov  4 05:59:36 2019
@@ -147,6 +147,11 @@ I.    INTRODUCTION
          for other languages, you need to have those languages
          available at build time.
 
+      * py3c (OPTIONAL, but REQUIRED for python bindings)
+
+        The Python 3 Compatibility layer for C extensions is required to build
+        the python language bindings.
+
       * KDE Framework 5, libsecret, GNOME Keyring (OPTIONAL for client)
 
          Subversion contains optional support for storing passwords in
@@ -414,9 +419,6 @@ I.    INTRODUCTION
       test suite is written in Python, as is part of Subversion's build
       system.
 
-      Note that Python 3.x on Windows is not supported.
-
-
       11. Perl 5.8 or newer (Windows only)  (OPTIONAL)
 
       To build Subversion under any of the MS Windows platforms, you
@@ -533,6 +535,16 @@ I.    INTRODUCTION
       If configure should use the version bundled with the sources, use:
         --with-lz4=internal
 
+      23. py3c (OPTIONAL)
+
+      Subversion uses the py3c compatibility library when building the Python
+      language bindings. Configure will attempt to locate the system library by
+      default using pkg-config and known paths.
+
+      If it is installed in a non-standard location, then use:
+
+        --with-py3c=/path/to/py3c/prefix
+
   D. Documentation
 
       The primary documentation for Subversion is the free book

Modified: subversion/trunk/Makefile.in
URL: 
http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Mon Nov  4 05:59:36 2019
@@ -148,11 +148,13 @@ BOOST_TEST_CPPFLAGS = @BOOST_CPPFLAGS@ -
 BOOST_TEST_LDFLAGS = @BOOST_LDFLAGS@ @BOOST_UNIT_TEST_FRAMEWORK_LIB@
 
 SWIG = @SWIG@
-SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@ -I$(SWIG_SRC_DIR)/python/libsvn_swig_py
+SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@ @SVN_PY3C_INCLUDES@ 
-I$(SWIG_SRC_DIR)/python/libsvn_swig_py
 SWIG_PY_COMPILE = @SWIG_PY_COMPILE@
 SWIG_PY_LINK = @SWIG_PY_LINK@
 SWIG_PY_LIBS = @SWIG_PY_LIBS@
+SWIG_PY_ERRMSG = @SWIG_PY_ERRMSG@
 SWIG_PL_INCLUDES = @SWIG_PL_INCLUDES@
+SWIG_PL_ERRMSG = @SWIG_PL_ERRMSG@
 SWIG_RB_INCLUDES = @SWIG_RB_INCLUDES@ -I$(SWIG_SRC_DIR)/ruby/libsvn_swig_ruby
 SWIG_RB_COMPILE = @SWIG_RB_COMPILE@
 SWIG_RB_LINK = @SWIG_RB_LINK@
@@ -161,6 +163,7 @@ SWIG_RB_SITE_LIB_DIR = @SWIG_RB_SITE_LIB
 SWIG_RB_SITE_ARCH_DIR = @SWIG_RB_SITE_ARCH_DIR@
 SWIG_RB_TEST_VERBOSE = @SWIG_RB_TEST_VERBOSE@
 SWIG_RB_RI_DATADIR = $(DESTDIR)$(datadir)/ri/$(RUBY_MAJOR).$(RUBY_MINOR)/site
+SWIG_RB_ERRMSG = @SWIG_RB_ERRMSG@
 
 CTYPESGEN = @CTYPESGEN@
 CTYPES_PYTHON_SRC_DIR = $(abs_srcdir)/subversion/bindings/ctypes-python
@@ -200,6 +203,7 @@ SWIG_FEATURES = @SWIG_FEATURES@
 SWIG_PY_FEATURES = @SWIG_PY_FEATURES@
 SWIG_PL_FEATURES = @SWIG_PL_FEATURES@
 SWIG_RB_FEATURES = @SWIG_RB_FEATURES@
+SWIG_PY_OPTS = @SWIG_PY_OPTS@
 
 COMPILE = $(CC) $(CMODEFLAGS) $(CPPFLAGS) $(CMAINTAINERFLAGS) $(CFLAGS) 
$(INCLUDES)
 COMPILE_NOWARN = $(CC) $(CMODEFLAGS) $(CPPFLAGS) $(CNOWARNFLAGS) $(CFLAGS) 
$(INCLUDES)
@@ -908,6 +912,7 @@ EXTRACLEAN_SWIG_PL=rm -f $(SWIG_PL_SRC_D
 # Makefile does not exist, DO NOT try to make it. But, if it doesn't exist,
 # then the directory is probably clean anyway.
 clean-swig-pl:
+       rm -f .swig_pl_checked
        if test -z "$(RELEASE_MODE)"; then \
          $(EXTRACLEAN_SWIG_PL); \
        fi
@@ -939,9 +944,10 @@ check-swig-py: swig-py
        cd $(SWIG_PY_DIR); \
          $(PYTHON) $(SWIG_PY_SRC_DIR)/tests/run_all.py
 
-EXTRACLEAN_SWIG_PY=rm -rf $(SWIG_PY_SRC_DIR)/svn_*.c $(SWIG_PY_SRC_DIR)/core.c 
\
-                          $(SWIG_PY_SRC_DIR)/[a-z]*.py
+EXTRACLEAN_SWIG_PY=rm -rf $(SWIG_PY_DIR)/svn_*.c $(SWIG_PY_DIR)/core.c \
+                          $(SWIG_PY_DIR)/[a-z]*.py
 clean-swig-py:
+       rm -f .swig_py_checked
        rm -rf $(SWIG_PY_DIR)/libsvn
        if test -z "$(RELEASE_MODE)"; then \
          $(EXTRACLEAN_SWIG_PY); \
@@ -974,6 +980,7 @@ check-swig-rb: swig-rb svnserve
 EXTRACLEAN_SWIG_RB=rm -f $(SWIG_RB_SRC_DIR)/svn_*.c $(SWIG_RB_SRC_DIR)/core.c
 
 clean-swig-rb:
+       rm -f .swig_rb_checked
        rm -rf $(SWIG_RB_DIR)/test/repos $(SWIG_RB_DIR)/test/wc
        if test -z "$(RELEASE_MODE)"; then \
          $(EXTRACLEAN_SWIG_RB); \

Modified: subversion/trunk/aclocal.m4
URL: 
http://svn.apache.org/viewvc/subversion/trunk/aclocal.m4?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/aclocal.m4 (original)
+++ subversion/trunk/aclocal.m4 Mon Nov  4 05:59:36 2019
@@ -44,6 +44,7 @@ sinclude(build/ac-macros/java.m4)
 sinclude(build/ac-macros/sasl.m4)
 sinclude(build/ac-macros/serf.m4)
 sinclude(build/ac-macros/sqlite.m4)
+sinclude(build/ac-macros/py3c.m4)
 sinclude(build/ac-macros/swig.m4)
 sinclude(build/ac-macros/zlib.m4)
 sinclude(build/ac-macros/lz4.m4)

Modified: subversion/trunk/build.conf
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Mon Nov  4 05:59:36 2019
@@ -101,7 +101,7 @@ test-scripts =
 
 bdb-test-scripts =
 
-swig-python-opts = $(SWIG_FEATURES) -python $(SWIG_PY_FEATURES) -classic
+swig-python-opts = $(SWIG_FEATURES) $(SWIG_PY_OPTS) $(SWIG_PY_FEATURES)
 swig-perl-opts = $(SWIG_FEATURES) -perl $(SWIG_PL_FEATURES) -nopm -noproxy
 swig-ruby-opts = $(SWIG_FEATURES) -ruby $(SWIG_RB_FEATURES)
 swig-languages = python perl ruby

Modified: subversion/trunk/build/ac-macros/swig.m4
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/swig.m4?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/swig.m4 (original)
+++ subversion/trunk/build/ac-macros/swig.m4 Mon Nov  4 05:59:36 2019
@@ -102,6 +102,8 @@ AC_DEFUN(SVN_FIND_SWIG,
  
   SWIG_PY_COMPILE="none"
   SWIG_PY_LINK="none"
+  SWIG_PY_OPTS="none"
+  SWIG_PY_ERRMSG="check config.log for details"
   if test "$PYTHON" != "none"; then
     AC_MSG_NOTICE([Configuring python swig binding])
 
@@ -111,25 +113,66 @@ AC_DEFUN(SVN_FIND_SWIG,
     SWIG_PY_INCLUDES="\$(SWIG_INCLUDES) $ac_cv_python_includes"
 
     if test "$ac_cv_python_includes" = "none"; then
+      SWIG_PY_ERRMSG="no distutils found"
       AC_MSG_WARN([python bindings cannot be built without distutils module])
-    fi
+    else
 
-    AC_CACHE_CHECK([for compiling Python extensions], [ac_cv_python_compile],[
-      ac_cv_python_compile="`$PYTHON ${abs_srcdir}/build/get-py-info.py 
--compile`"
-    ])
-    SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
+      python_header_found="no"
 
-    AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
-      ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py --link`"
-    ])
-    SWIG_PY_LINK="$ac_cv_python_link"
+      save_cppflags="$CPPFLAGS"
+      CPPFLAGS="$CPPFLAGS $ac_cv_python_includes"
+      AC_CHECK_HEADER(Python.h, [
+        python_header_found="yes"
+      ])
+      CPPFLAGS="$save_cppflags"
+
+      if test "$python_header_found" = "no"; then
+        SWIG_PY_ERRMSG="no Python.h found"
+        AC_MSG_WARN([Python.h not found; disabling python swig bindings])
+      else
+        SVN_PY3C()
+
+        if test "$py3c_found" = "no"; then
+          SWIG_PY_ERRMSG="py3c library not found"
+          AC_MSG_WARN([py3c library not found; disabling python swig bindings])
+        else
+          AC_CACHE_CHECK([for compiling Python extensions], 
[ac_cv_python_compile],[
+            ac_cv_python_compile="`$PYTHON ${abs_srcdir}/build/get-py-info.py 
--compile`"
+          ])
+          SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
+      
+          AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
+            ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py 
--link`"
+          ])
+          SWIG_PY_LINK="$ac_cv_python_link"
+      
+          AC_CACHE_CHECK([for linking Python libraries], [ac_cv_python_libs],[
+            ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py 
--libs`"
+          ])
+          SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`"
+
+          AC_CACHE_CHECK([for Python >= 3], [ac_cv_python_is_py3],[
+            ac_cv_python_is_py3="no"
+            $PYTHON -c 'import sys; sys.exit(0x3000000 > sys.hexversion)' && \
+               ac_cv_python_is_py3="yes"
+          ])
+
+          if test "$ac_cv_python_is_py3" = "yes"; then
+             SWIG_PY_OPTS="-python -py3"
+          else
+             SWIG_PY_OPTS="-python -classic"
+          fi
+
+          dnl SWIG Python bindings successfully configured, clear the error 
message
+          SWIG_PY_ERRMSG=""
+        fi
+            
+      fi
+    fi
 
-    AC_CACHE_CHECK([for linking Python libraries], [ac_cv_python_libs],[
-      ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py --libs`"
-    ])
-    SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`"
   fi
 
+  SWIG_PL_ERRMSG="check config.log for details"
   if test "$PERL" != "none"; then
     AC_MSG_CHECKING([perl version])
     dnl Note that the q() bit is there to avoid unbalanced brackets
@@ -140,6 +183,9 @@ AC_DEFUN(SVN_FIND_SWIG,
       SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$PERL -MExtUtils::Embed -e ccopts`"
       SWIG_PL_LINK="`$PERL -MExtUtils::Embed -e ldopts`"
       SWIG_PL_LINK="`SVN_REMOVE_STANDARD_LIB_DIRS($SWIG_PL_LINK)`"
+
+      dnl SWIG Perl bindings successfully configured, clear the error message
+      SWIG_PL_ERRMSG=""
     else
       AC_MSG_WARN([perl bindings require perl 5.8.0 or newer.])
     fi
@@ -147,6 +193,7 @@ AC_DEFUN(SVN_FIND_SWIG,
 
   SWIG_RB_COMPILE="none"
   SWIG_RB_LINK="none"
+  SWIG_RB_ERRMSG="check config.log for details"
   if test "$RUBY" != "none"; then
     if test x"$SWIG_VERSION" = x"3""00""008"; then
       # Use a local variable to escape the '#' sign.
@@ -264,14 +311,20 @@ int main()
                   [svn_ruby_test_verbose="$svn_cv_ruby_test_verbose"])
       SWIG_RB_TEST_VERBOSE="$svn_ruby_test_verbose"
       AC_MSG_RESULT([$SWIG_RB_TEST_VERBOSE])
+
+    dnl SWIG Ruby bindings successfully configured, clear the error message
+    SWIG_RB_ERRMSG=""
   fi
   AC_SUBST(SWIG)
   AC_SUBST(SWIG_PY_INCLUDES)
   AC_SUBST(SWIG_PY_COMPILE)
   AC_SUBST(SWIG_PY_LINK)
   AC_SUBST(SWIG_PY_LIBS)
+  AC_SUBST(SWIG_PY_OPTS)
+  AC_SUBST(SWIG_PY_ERRMSG)
   AC_SUBST(SWIG_PL_INCLUDES)
   AC_SUBST(SWIG_PL_LINK)
+  AC_SUBST(SWIG_PL_ERRMSG)
   AC_SUBST(SWIG_RB_LINK)
   AC_SUBST(SWIG_RB_LIBS)
   AC_SUBST(SWIG_RB_INCLUDES)
@@ -279,4 +332,5 @@ int main()
   AC_SUBST(SWIG_RB_SITE_LIB_DIR)
   AC_SUBST(SWIG_RB_SITE_ARCH_DIR)
   AC_SUBST(SWIG_RB_TEST_VERBOSE)
+  AC_SUBST(SWIG_RB_ERRMSG)
 ])

Modified: subversion/trunk/build/generator/gen_base.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_base.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_base.py (original)
+++ subversion/trunk/build/generator/gen_base.py Mon Nov  4 05:59:36 2019
@@ -1273,7 +1273,8 @@ class IncludeDependencyInfo:
     Return a dictionary with included full file names as keys and None as
     values."""
     hdrs = { }
-    for line in fileinput.input(fname):
+
+    for line in fileinput.FileInput(fname, 
openhook=fileinput.hook_encoded("utf-8")):
       match = self._re_include.match(line)
       if not match:
         continue

Modified: subversion/trunk/build/generator/gen_make.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_make.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_make.py (original)
+++ subversion/trunk/build/generator/gen_make.py Mon Nov  4 05:59:36 2019
@@ -208,7 +208,9 @@ class Generator(gen_base.GeneratorBase):
       swig_lang_deps[objname.lang].append(str(objname))
 
     for lang in self.swig.langs:
-      data.swig_langs.append(_eztdata(short=self.swig.short[lang],
+      data.swig_langs.append(_eztdata(name=lang,
+                                      short=self.swig.short[lang],
+                                      
short_upper=self.swig.short[lang].upper(),
                                       deps=swig_lang_deps[lang]))
 
     ########################################

Modified: subversion/trunk/build/generator/gen_vcnet_vcproj.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_vcnet_vcproj.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_vcnet_vcproj.py (original)
+++ subversion/trunk/build/generator/gen_vcnet_vcproj.py Mon Nov  4 05:59:36 
2019
@@ -120,10 +120,13 @@ class Generator(gen_win.WinGeneratorBase
       'instrument_purify_quantify' : self.instrument_purify_quantify,
       'version' : self.vcproj_version,
       'toolset_version' : 'v' + self.vcproj_version.replace('.',''),
+      'user_macros': self.user_macros,
       }
 
     if self.vcproj_extension == '.vcproj':
       self.write_with_template(fname, 'templates/vcnet_vcproj.ezt', data)
+      self.write_with_template(os.path.splitext(fname)[0] + '.vsprops', 
+                               'templates/vcnet_vsprops.ezt', data)
     else:
       self.write_with_template(fname, 'templates/vcnet_vcxproj.ezt', data)
       self.write_with_template(fname + '.filters', 
'templates/vcnet_vcxproj_filters.ezt', data)

Modified: subversion/trunk/build/generator/gen_win.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Mon Nov  4 05:59:36 2019
@@ -158,6 +158,13 @@ class WinGeneratorBase(gen_win_dependenc
     ### implement this from scratch using the algorithms described in
     ### http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
 
+    # Ensure data is in byte representation.  If it doesn't have an encode
+    # attribute, assume it is already in the correct form.
+    try:
+      data = data.encode('utf8')
+    except AttributeError:
+      pass
+
     myhash = hashlib_md5(data).hexdigest()
 
     guid = ("{%s-%s-%s-%s-%s}" % (myhash[0:8], myhash[8:12],
@@ -777,6 +784,10 @@ class WinGeneratorBase(gen_win_dependenc
         lang_subdir = 'perl5'
       else:
         lang_subdir = target.lang
+        
+      if target.lang == "python":
+        lib = self._libraries['py3c']
+        fakeincludes.extend(lib.include_dirs)
 
       # After the language specific includes include the generic libdir,
       # to allow overriding a generic with a per language include

Modified: subversion/trunk/build/generator/gen_win_dependencies.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win_dependencies.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win_dependencies.py (original)
+++ subversion/trunk/build/generator/gen_win_dependencies.py Mon Nov  4 
05:59:36 2019
@@ -32,6 +32,7 @@ import fnmatch
 import re
 import subprocess
 import string
+from collections import namedtuple
 
 if sys.version_info[0] >= 3:
   # Python >=3.0
@@ -46,6 +47,8 @@ else:
 import gen_base
 import ezt
 
+UserMacro = namedtuple('UserMacro', ['name', 'value'])
+
 class SVNCommonLibrary:
 
   def __init__(self, name, include_dirs, lib_dir, lib_name, version=None,
@@ -117,6 +120,7 @@ class GenDependenciesBase(gen_base.Gener
         'swig',
         'perl',
         'python',
+        'py3c',
         'ruby',
         'java_sdk',
         'openssl',
@@ -148,6 +152,7 @@ class GenDependenciesBase(gen_base.Gener
     self.jdk_path = None
     self.junit_path = None
     self.swig_path = None
+    self.py3c_path = None
     self.vs_version = '2002'
     self.sln_version = '7.00'
     self.vcproj_version = '7.00'
@@ -167,6 +172,7 @@ class GenDependenciesBase(gen_base.Gener
     self.instrument_purify_quantify = None
     self.sasl_path = None
     self.cpp_defines = []
+    self.user_macros = []
 
     # NLS options
     self.enable_nls = None
@@ -198,6 +204,8 @@ class GenDependenciesBase(gen_base.Gener
         self.zlib_path = val
       elif opt == '--with-swig':
         self.swig_path = val
+      elif opt == '--with-py3c':
+        self.py3c_path = val
       elif opt == '--with-sqlite':
         self.sqlite_path = val
       elif opt == '--with-sasl':
@@ -329,7 +337,9 @@ class GenDependenciesBase(gen_base.Gener
     # Swig (optional) dependencies
     if self._find_swig(show_warnings):
       self._find_perl(show_warnings)
-      self._find_python(show_warnings)
+      # py3c is required to build python bindings, show check it first
+      if self._find_py3c(show_warnings):
+        self._find_python(show_warnings)
       self._find_ruby(show_warnings)
 
   def _find_apr(self):
@@ -1026,10 +1036,53 @@ class GenDependenciesBase(gen_base.Gener
       lib_dir = os.path.join(sysconfig.PREFIX, "libs")
     except ImportError:
       return
+    
+    if sys.version_info[0] >= 3:
+      self.user_macros.append(UserMacro("SWIG_PY_OPTS", "-python -py3"))
+    else:    
+      self.user_macros.append(UserMacro("SWIG_PY_OPTS", "-python -classic"))
 
     self._libraries['python'] = SVNCommonLibrary('python', inc_dir, lib_dir, 
None,
                                                  sys.version.split(' ')[0])
 
+  def _find_py3c(self, show_warnings):
+    "Find the py3c library which is used in SWIG python bindings"
+    show_warnings = True
+    # Assume a default path, unless otherwise specified
+    py3c_path = "py3c"
+    
+    if self.py3c_path:
+      py3c_path = self.py3c_path
+     
+    py3c_path = os.path.abspath(py3c_path)
+    inc_path = os.path.join(py3c_path, 'include')
+    py3c_hdr_path = os.path.join(inc_path, 'py3c.h')
+    
+    pc_path = os.path.join(py3c_path, 'py3c.pc.in')
+    
+    if not os.path.isfile(py3c_hdr_path):
+      if show_warnings:
+        print('WARNING: "%s" not found' % py3c_hdr_path)
+        print('Use "--with-py3c" to configure py3c location.')
+      return False
+      
+    with open(pc_path) as fp:
+      txt = fp.read()
+      
+    ver_match = re.search(r'Version:\s+([0-9.]+)', txt)
+    
+    if not ver_match:
+      if show_warnings:
+        print("WARNING: Failed to find version in '%s'" % pc_path)
+      return False
+      
+    py3c_version = ver_match.group(1)
+      
+    self._libraries['py3c'] = SVNCommonLibrary('py3c', inc_path, None,
+                                               None, py3c_version)
+                                               
+    return True
+      
   def _find_jdk(self, show_warnings):
     "Find details about an installed jdk"
 
@@ -1080,7 +1133,7 @@ class GenDependenciesBase(gen_base.Gener
       outfp = subprocess.Popen([os.path.join(jdk_path, 'bin', 'javac.exe'),
                                '-version'], stdout=subprocess.PIPE,
                                stderr=subprocess.STDOUT).stdout
-      line = outfp.read()
+      line = outfp.read().decode('utf8')
       if line:
         vermatch = re.search(r'(([0-9]+(\.[0-9]+)+)(_[._0-9]+)?)', line, re.M)
       else:
@@ -1138,7 +1191,7 @@ class GenDependenciesBase(gen_base.Gener
     try:
       fp = subprocess.Popen([self.swig_exe, '-version'],
                             stdout=subprocess.PIPE).stdout
-      txt = fp.read()
+      txt = fp.read().decode('utf8')
       if txt:
         vermatch = re.search(r'^SWIG\ Version\ (\d+)\.(\d+)\.(\d+)', txt, re.M)
       else:
@@ -1166,7 +1219,7 @@ class GenDependenciesBase(gen_base.Gener
     try:
       fp = subprocess.Popen([self.swig_exe, '-swiglib'],
                             stdout=subprocess.PIPE).stdout
-      lib_dir = fp.readline().strip()
+      lib_dir = fp.readline().decode('utf8').strip()
       fp.close()
     except OSError:
       lib_dir = None

Modified: subversion/trunk/build/generator/swig/__init__.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/swig/__init__.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/swig/__init__.py (original)
+++ subversion/trunk/build/generator/swig/__init__.py Mon Nov  4 05:59:36 2019
@@ -62,7 +62,7 @@ class Generator:
     if os.access(self.swig_path, os.X_OK):
       # ### TODO: What's the reason for this os.access() check?  It was added
       # ### in r873265 (== r33191).
-      self.swig_libdir = subprocess.check_output([self.swig_path, 
"-swiglib"]).strip()
+      self.swig_libdir = subprocess.check_output([self.swig_path, 
"-swiglib"]).decode('utf8').strip()
     else:
       self.swig_libdir = None
 
@@ -71,7 +71,7 @@ class Generator:
     """Get the version number of SWIG"""
 
     if not self._swigVersion:
-      swig_version = subprocess.check_output([self.swig_path, "-version"])
+      swig_version = subprocess.check_output([self.swig_path, 
"-version"]).decode('utf8')
       m = re.search("Version (\d+).(\d+).(\d+)", swig_version)
       if m:
         self._swigVersion = tuple(map(int, m.groups()))

Modified: subversion/trunk/build/generator/swig/header_wrappers.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/swig/header_wrappers.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/swig/header_wrappers.py (original)
+++ subversion/trunk/build/generator/swig/header_wrappers.py Mon Nov  4 
05:59:36 2019
@@ -265,7 +265,13 @@ class Generator(generator.swig.Generator
       self.proxy_filename(base_fname))
 
     # Open a temporary output file
-    self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir)
+    if sys.version_info[0] >= 3:
+      self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir,
+                                          mode="w+",
+                                          encoding="utf8")
+    else:
+      self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir)
+
     self.ofile.write('/* Proxy classes for %s\n' % base_fname)
     self.ofile.write(' * DO NOT EDIT -- AUTOMATICALLY GENERATED\n')
     self.ofile.write(' * BY build/generator/swig/header_wrappers.py */\n')

Modified: subversion/trunk/build/generator/templates/build-outputs.mk.ezt
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/templates/build-outputs.mk.ezt?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/templates/build-outputs.mk.ezt (original)
+++ subversion/trunk/build/generator/templates/build-outputs.mk.ezt Mon Nov  4 
05:59:36 2019
@@ -70,8 +70,18 @@ RELEASE_MODE = 1
 # Section 3: SWIG autogen rules
 ########################################
 [for swig_langs]
-autogen-swig-[swig_langs.short]:[for swig_langs.deps] [swig_langs.deps][end]
+.swig_[swig_langs.short]_checked:
+       @if [ -n "$(SWIG_[swig_langs.short_upper]_ERRMSG)" ]; then \
+         echo "SWIG [swig_langs.name] disabled at configure time: 
$(SWIG_[swig_langs.short_upper]_ERRMSG)" >&2; \
+         exit 1; \
+       fi
+       @touch $@
+
+autogen-swig-[swig_langs.short]: .swig_[swig_langs.short]_checked [for 
swig_langs.deps] [swig_langs.deps][end]
 autogen-swig: autogen-swig-[swig_langs.short]
+
+# Ensure the swig build targets depend on the configuration check
+swig-[swig_langs.short]: .swig_[swig_langs.short]_checked
 [end]
 
 

Modified: subversion/trunk/build/generator/templates/vcnet_vcproj.ezt
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/templates/vcnet_vcproj.ezt?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/templates/vcnet_vcproj.ezt (original)
+++ subversion/trunk/build/generator/templates/vcnet_vcproj.ezt Mon Nov  4 
05:59:36 2019
@@ -33,6 +33,7 @@
                        
OutputDirectory="..\..\..\[configs.name]\[target.output_dir]"
                        BuildLogFile="$(IntDir)\BuildLog_$(ProjectName).htm"
                        
IntermediateDirectory="..\..\..\[configs.name]\[target.intermediate_dir]\[target.proj_name]"
+                       InheritedPropertySheets=".\[target.proj_name].vsprops"
                        ConfigurationType="[target_type]"[is configs.name 
"Release"]
                        WholeProgramOptimization="FALSE"[end]>
                        <Tool
@@ -59,7 +60,7 @@
                                
DisableSpecificWarnings="4100;4127;4206;4512;4701;4706;4800"
                                Detect64BitPortabilityProblems="FALSE"
                                AdditionalOptions="
-                               /we4002 /we4003 /we4013 /we4020 /we4022 /we4024 
/we4028 /we4029 /we4030 /we4031 /we4033 /we4047 /we4089 /we4113 /we4115 /we4204 
/we4715"
+                               /we4002 /we4003 /we4013 /we4020 /we4022 /we4024 
/we4028 /we4029 /we4030 /we4031 /we4033 /we4047 /we4089 /we4113 /we4204 /we4715"
                                DebugInformationFormat="3"
                                
ProgramDataBaseFileName="$(IntDir)\[target.output_pdb]"
                                [if-any 
configs.forced_include_files]ForcedIncludeFiles="[for 
configs.forced_include_files][configs.forced_include_files][if-index 
configs.forced_include_files last][else];[end][end]"

Modified: subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt (original)
+++ subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt Mon Nov  4 
05:59:36 2019
@@ -43,7 +43,9 @@
 [for platforms][for configs]  <ImportGroup Label="PropertySheets" 
Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" 
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" 
Label="LocalAppDataPlatform" />
   </ImportGroup>
-[end][end]  <PropertyGroup Label="UserMacros" />
+[end][end]  <PropertyGroup Label="UserMacros">
+[for user_macros]    
<[user_macros.name]>[user_macros.value]</[user_macros.name]>
+[end]  </PropertyGroup>
 [for platforms][for configs]  <PropertyGroup 
Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">
     <OutDir>$(SolutionDir)[configs.name]\[target.output_dir]\</OutDir>
     
<IntDir>$(SolutionDir)[configs.name]\obj\[target.intermediate_dir]\[target.proj_name]\</IntDir>
@@ -63,7 +65,7 @@
       <WarningLevel>Level4</WarningLevel>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       
<DisableSpecificWarnings>4100;4127;4206;4512;4701;4706;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-      
<TreatSpecificWarningsAsErrors>4002;4003;4013;4020;4022;4024;4028;4029;4030;4031;4033;4047;4089;4113;4115;4133;4204;4700;4715;4789;%(TreatSpecificWarningsAsErrors)</TreatSpecificWarningsAsErrors>
+      
<TreatSpecificWarningsAsErrors>4002;4003;4013;4020;4022;4024;4028;4029;4030;4031;4033;4047;4089;4113;4133;4204;4700;4715;4789;%(TreatSpecificWarningsAsErrors)</TreatSpecificWarningsAsErrors>
 [if-any configs.forced_include_files]      <ForcedIncludeFiles>[for 
configs.forced_include_files][configs.forced_include_files];[end]%(ForcedIncludeFiles)</ForcedIncludeFiles>
 [end]    </ClCompile>
     <ResourceCompile>

Modified: subversion/trunk/build/get-py-info.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/get-py-info.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/build/get-py-info.py (original)
+++ subversion/trunk/build/get-py-info.py Mon Nov  4 05:59:36 2019
@@ -81,20 +81,8 @@ def link_options():
   # Initialize config variables
   assert os.name == "posix"
   options = sysconfig.get_config_var('LDSHARED').split()
-  fwdir = sysconfig.get_config_var('PYTHONFRAMEWORKDIR')
 
-  if fwdir and fwdir != "no-framework":
-
-    # Setup the framework prefix
-    fwprefix = sysconfig.get_config_var('PYTHONFRAMEWORKPREFIX')
-    if fwprefix != "/System/Library/Frameworks":
-      add_option_if_missing(options, "-F%s" % fwprefix)
-
-    # Load in the framework
-    fw = sysconfig.get_config_var('PYTHONFRAMEWORK')
-    add_option(options, "-framework", fw)
-
-  elif sys.platform == 'darwin':
+  if sys.platform == 'darwin':
 
     # Load bundles from python
     python_exe = os.path.join(sysconfig.get_config_var("BINDIR"),

Modified: subversion/trunk/configure.ac
URL: 
http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Mon Nov  4 05:59:36 2019
@@ -1273,7 +1273,7 @@ AS_HELP_STRING([--enable-gprof],
 # Scripting and Bindings languages
 
 # Python: Used for testsuite, and bindings
-
+AC_ARG_VAR([PYTHON], [Python interpreter command])
 
 PYTHON="`$abs_srcdir/build/find_python.sh`"
 if test -z "$PYTHON"; then
@@ -1641,7 +1641,7 @@ fi
 AC_SUBST(SVN_CONFIG_SCRIPT_FILES)
 
 # Ensure that SWIG is checked after reconfiguration.
-rm -f .swig_checked
+rm -f .swig_checked .swig_pl_checked .swig_py_checked .swig_rb_checked
 
 dnl Provide ${host} for use in compiled code (for svn --version)
 AC_DEFINE_UNQUOTED([SVN_BUILD_HOST], "${host}",

Modified: subversion/trunk/gen-make.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/gen-make.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/gen-make.py (original)
+++ subversion/trunk/gen-make.py Mon Nov  4 05:59:36 2019
@@ -175,6 +175,8 @@ def _usage_exit(err=None):
   print("")
   print("  --with-swig=DIR")
   print("           look for the swig program in DIR")
+  print("  --with-py3c=DIR")
+  print("           look for the py3c library in DIR")
   print("")
   print("  --with-sqlite=DIR")
   print("           look for sqlite in DIR")
@@ -249,6 +251,7 @@ if __name__ == '__main__':
                             'with-jdk=',
                             'with-junit=',
                             'with-swig=',
+                            'with-py3c=',
                             'with-sqlite=',
                             'with-sasl=',
                             'with-apr_memcache=',

Modified: subversion/trunk/get-deps.sh
URL: 
http://svn.apache.org/viewvc/subversion/trunk/get-deps.sh?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/get-deps.sh (original)
+++ subversion/trunk/get-deps.sh Mon Nov  4 05:59:36 2019
@@ -33,6 +33,7 @@
 
 APR_VERSION=${APR_VERSION:-"1.4.6"}
 APU_VERSION=${APU_VERSION:-"1.5.1"}
+PY3C_VERSION=${PY3C_VERSION:='1.1'}
 SERF_VERSION=${SERF_VERSION:-"1.3.8"}
 ZLIB_VERSION=${ZLIB_VERSION:-"1.2.8"}
 SQLITE_VERSION=${SQLITE_VERSION:-"3.8.11.1"}
@@ -43,6 +44,7 @@ APR_ICONV_VERSION=${APR_ICONV_VERSION:-"
 
 APR=apr-${APR_VERSION}
 APR_UTIL=apr-util-${APU_VERSION}
+PY3C=py3c-${PY3C_VERSION}
 SERF=serf-${SERF_VERSION}
 ZLIB=zlib-${ZLIB_VERSION}
 SQLITE_VERSION_LIST=`echo $SQLITE_VERSION | sed -e 's/\./ /g'`
@@ -66,7 +68,7 @@ APACHE_MIRROR=https://archive.apache.org
 # helpers
 usage() {
     echo "Usage: $0"
-    echo "Usage: $0 [ apr | serf | zlib | sqlite ] ..."
+    echo "Usage: $0 [ apr | py3c | serf | zlib | sqlite ] ..."
     exit $1
 }
 
@@ -84,6 +86,19 @@ get_apr() {
     test -d $BASEDIR/apr-util || mv $APR_UTIL apr-util
 }
 
+get_py3c() {
+    test -d $BASEDIR/py3c && return
+    py3cdist=v${PY3C_VERSION}.tar.gz
+
+    cd $TEMPDIR
+    $HTTP_FETCH https://github.com/encukou/py3c/archive/${py3cdist}
+    cd $BASEDIR
+
+    gzip -dc $TEMPDIR/${py3cdist} | tar -xf -
+
+    mv $PY3C py3c
+}
+
 get_serf() {
     test -d $BASEDIR/serf && return
 
@@ -125,7 +140,7 @@ get_sqlite() {
 get_deps() {
     mkdir -p $TEMPDIR
 
-    for i in zlib serf sqlite-amalgamation apr apr-util; do
+    for i in zlib serf sqlite-amalgamation py3c apr apr-util; do
       if [ -d $i ]; then
         echo "Local directory '$i' already exists; the downloaded copy won't 
be used" >&2
       fi
@@ -141,6 +156,7 @@ get_deps() {
       done
     else
       get_apr
+      get_py3c
       get_serf
       get_zlib
       get_sqlite

Modified: subversion/trunk/subversion/bindings/swig/INSTALL
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/INSTALL?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/INSTALL (original)
+++ subversion/trunk/subversion/bindings/swig/INSTALL Mon Nov  4 05:59:36 2019
@@ -98,6 +98,17 @@ Step 1:  Install a suitable version of S
       from the command line. SWIG should report that it is version 1.3.24
       or newer.
 
+Step 1a: Install py3c library if building Python SWIG bindings.
+
+    * Check your distribution packages first for a suitable version, and if 
found
+      install from there.
+
+    * To install from source, download the latest release from
+      https://github.com/encukou/py3c.
+
+    * This is a header-only library, so no configuring or compiling is
+      necessary, simply 'make install'.
+      
 Step 2:  Build and Install Subversion.
 
   See Subversion's own INSTALL file for details.
@@ -226,6 +237,9 @@ BUILDING SWIG BINDINGS FOR SVN ON WINDOW
            http://www.python.org/
            http://www.activestate.com/ActivePerl/
 
+       If you plan to build python bindings, you will also need to download and
+       extract the py3c library from https://github.com/encukou/py3c/releases.
+       
        NOTE: Our Python SWIG bindings will currently NOT compile in Debug mode
              unless you have python24_d.lib (which binary distributions of
              Python do not contain).  Therefore, the Python bindings will only
@@ -241,6 +255,11 @@ BUILDING SWIG BINDINGS FOR SVN ON WINDOW
        Example:
 
         > gen-make.py <other options> --with-swig="C:\Program Files\SWIG-2.0.2"
+        
+       If you are building python bindings, point to the py3c directory as 
well:
+       
+        > gen-make.py <other options> --with-swig="C:\Program 
Files\SWIG-2.0.2" \
+                                      --with-py3c="C:\SVN\py3c"
 
    4.  If you haven't already built Subversion, you should do so now.
        Instructions are in the main INSTALL file.

Modified: subversion/trunk/subversion/bindings/swig/core.i
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/core.i?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/core.i (original)
+++ subversion/trunk/subversion/bindings/swig/core.i Mon Nov  4 05:59:36 2019
@@ -381,6 +381,7 @@
     if (PyLong_Check($input)) {
         temp = PyLong_AsUnsignedLong($input);
     }
+%#if IS_PY3 != 1
     else if (PyInt_Check($input)) {
         /* wish there was a PyInt_AsUnsignedLong but there isn't
            the mask version doesn't do bounds checking for us.
@@ -389,6 +390,7 @@
            problem goes away because PyInt is gone anyway. */
         temp = PyInt_AsUnsignedLongMask($input);
     }
+%#endif
     else {
         PyErr_SetString(PyExc_TypeError,
                         "expecting an integer for the buffer size");
@@ -418,7 +420,7 @@
 
 #ifdef SWIGPYTHON
 %typemap(argout) (char *buffer, apr_size_t *len) {
-  %append_output(PyString_FromStringAndSize($1, *$2));
+  %append_output(PyBytes_FromStringAndSize($1, *$2));
   free($1);
 }
 #endif
@@ -440,13 +442,24 @@
 */
 #ifdef SWIGPYTHON
 %typemap(in) (const char *data, apr_size_t *len) ($*2_type temp) {
-    if (!PyString_Check($input)) {
+    Py_ssize_t length;
+    if (PyBytes_Check($input)) {
+        if (PyBytes_AsStringAndSize($input, (char **)&$1, &length) == -1) {
+            SWIG_fail;
+        }
+    }
+    else if (PyUnicode_Check($input)) {
+        $1 = (char *)PyStr_AsUTF8AndSize($input, &length);
+        if (PyErr_Occurred()) {
+            SWIG_fail;
+        }
+    }
+    else {
         PyErr_SetString(PyExc_TypeError,
-                        "expecting a string for the buffer");
+                        "expecting a bytes or str object for the buffer");
         SWIG_fail;
     }
-    $1 = PyString_AS_STRING($input);
-    temp = PyString_GET_SIZE($input);
+    temp = ($*2_type)length;
     $2 = ($2_ltype)&temp;
 }
 #endif
@@ -499,8 +512,8 @@
        SWIG_fail;
     }
 
-    if (PyString_Check($input)) {
-        char *value = PyString_AS_STRING($input);
+    if (PyBytes_Check($input)) {
+        const char *value = PyBytes_AsString($input);
         $1 = apr_pstrdup(_global_pool, value);
     }
     else if (PyLong_Check($input)) {
@@ -605,7 +618,7 @@
 */
 #ifdef SWIGPYTHON
 %typemap(in) FILE * {
-    $1 = PyFile_AsFile($input);
+    $1 = svn_swig_py_as_file($input);
     if ($1 == NULL) {
         PyErr_SetString(PyExc_ValueError, "Must pass in a valid file object");
         SWIG_fail;

Modified: subversion/trunk/subversion/bindings/swig/include/proxy.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/proxy.py?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/proxy.py (original)
+++ subversion/trunk/subversion/bindings/swig/include/proxy.py Mon Nov  4 
05:59:36 2019
@@ -12,23 +12,70 @@
     if "_is_valid" in self.__dict__:
       assert self.__dict__["_is_valid"](), "Variable has already been deleted"
 
-  def __getattr__(self, name):
-    """Get an attribute from this object"""
-    self.assert_valid()
-
-    value = _swig_getattr(self, self.__class__, name)
-
-    # If we got back a different object than we have, we need to copy all our
-    # metadata into it, so that it looks identical
-    members = self.__dict__.get("_members")
-    if members is not None:
-      _copy_metadata_deep(value, members.get(name))
+  def _retrieve_swig_value(self, name, value):
+    # If we got back a different object than we have cached, we need to copy
+    # all our metadata into it, so that it looks identical to the one
+    # originally set.
+    members = self.__dict__.get('_members')
+    if members is not None and name in members:
+      _copy_metadata_deep(value, members[name])
 
     # Verify that the new object is good
     _assert_valid_deep(value)
 
     return value
 
+  # SWIG classes generated with -classic do not define this variable,
+  # so set it to 0 when it doesn't exist
+  try:
+    _newclass
+  except NameError:
+    _newclass = 0
+
+  # Attribute access must be intercepted to ensure that objects coming from
+  # read attribute access match those that are set with write attribute access.
+  # Specifically the metadata, such as the associated apr_pool object, should
+  # match the originally assigned object.
+  #
+  # For classic classes it is enough to use __getattr__ to intercept swig
+  # derived attributes. However, with new style classes SWIG makes use of
+  # descriptors which mean that __getattr__ is never called. Therefore,
+  # __getattribute__ must be used for the interception.
+
+  if _newclass:
+    def __getattribute__(self, name):
+      """Manage access to all attributes of this object."""
+
+      # Start by mimicing __getattr__ behavior: immediately return __dict__ or
+      # items directly present in __dict__
+      mydict = object.__getattribute__(self, '__dict__')
+
+      if name == "__dict__":
+        return mydict
+
+      if name in mydict:
+        return mydict[name]
+
+      object.__getattribute__(self, 'assert_valid')()
+
+      try:
+        value = object.__getattribute__(self, name)
+      except AttributeError:
+        value = _swig_getattr(self,
+                              object.__getattribute__(self, '__class__'),
+                              name)
+
+      fn = object.__getattribute__(self, '_retrieve_swig_value')
+      return fn(name, value)
+  else:
+    def __getattr__(self, name):
+      """Get an attribute from this object"""
+      self.assert_valid()
+
+      value = _swig_getattr(self, self.__class__, name)
+
+      return self._retrieve_swig_value(name, value)
+
   def __setattr__(self, name, value):
     """Set an attribute on this object"""
     self.assert_valid()

Modified: subversion/trunk/subversion/bindings/swig/include/proxy.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/proxy.swg?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/proxy.swg (original)
+++ subversion/trunk/subversion/bindings/swig/include/proxy.swg Mon Nov  4 
05:59:36 2019
@@ -36,8 +36,8 @@
     if value is None or old_value is None or value is old_value: return
     
     if isinstance(value, dict):
-      for k, v in value.iteritems():
-        _copy_metadata_deep(v, old_value[k])
+      for k in value:
+        _copy_metadata_deep(value[k], old_value[k])
     elif isinstance(value, list):
       for v, old_v in zip(value, old_value):
         _copy_metadata_deep(v, old_v)
@@ -50,14 +50,20 @@
   def _assert_valid_deep(value):
     """Assert value's validity, recursively traversing lists and dicts."""
     if isinstance(value, dict):
-      for v in value.itervalues():
-        _assert_valid_deep(v)
+      for k in value:
+        _assert_valid_deep(value[k])
     elif isinstance(value, list):
       for v in value:
         _assert_valid_deep(v)
-    else:
-      if hasattr(value, "assert_valid"):
-        value.assert_valid()
+    # Ensure that the passed in value isn't a type, which could have an
+    # assert_valid attribute, but it can not be called without an instance.
+    elif type(value) != type:
+      try:
+        fn = value.assert_valid
+      except AttributeError:
+        pass
+      else:
+        fn()
 %}
 
 /* Default code for all wrapped proxy classes in Python.

Modified: subversion/trunk/subversion/bindings/swig/include/proxy_apr.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/proxy_apr.swg?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/proxy_apr.swg (original)
+++ subversion/trunk/subversion/bindings/swig/include/proxy_apr.swg Mon Nov  4 
05:59:36 2019
@@ -84,6 +84,7 @@ class GenericSWIGWrapper:
   def set_parent_pool(self, pool):
     """Set the parent pool of this object"""
     self._parent_pool = pool
+    self._is_valid = weakref.ref(pool._is_valid)
 
   def valid(self):
     """Is this object valid?"""
@@ -99,8 +100,14 @@ class GenericSWIGWrapper:
     return self.this
 
 def _mark_weakpool_invalid(weakpool):
-  if weakpool and weakpool() and hasattr(weakpool(), "_is_valid"):
-    del weakpool()._is_valid
+  if weakpool:
+    pool = weakpool()
+    if pool:
+      try:
+        del pool._is_valid
+      except AttributeError:
+        pass
+       
 
 %}
 
@@ -133,7 +140,11 @@ struct apr_pool_t {
       def valid(self):
         """Check whether this memory pool and its parents
         are still valid"""
-        return hasattr(self,"_is_valid")
+        try:
+          self._is_valid
+          return True
+        except AttributeError:
+          return False
 
       def assert_valid(self):
         """Assert that this memory_pool is still valid."""
@@ -164,10 +175,15 @@ struct apr_pool_t {
           self._svn_swig_py_clear_application_pool()
 
         # Mark self as invalid
-        if hasattr(self, "_parent_pool"):
+        try:
           del self._parent_pool
-        if hasattr(self, "_is_valid"):
+        except AttributeError:
+          pass
+
+        try:
           del self._is_valid
+        except AttributeError:
+          pass
 
       def __del__(self):
         """Automatically destroy memory pools, if necessary"""
@@ -200,8 +216,11 @@ struct apr_pool_t {
       def _wrap(self, obj):
         """Mark a SWIG object as owned by this pool"""
         self.assert_valid()
-        if hasattr(obj, "set_parent_pool"):
-          obj.set_parent_pool(self)
+        
+        fn = getattr(obj, 'set_parent_pool', None)
+
+        if fn is not None:
+          fn(self)
           return obj
         elif obj is None:
           return None

Modified: subversion/trunk/subversion/bindings/swig/include/svn_containers.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_containers.swg?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_containers.swg 
(original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_containers.swg Mon 
Nov  4 05:59:36 2019
@@ -527,7 +527,10 @@
   apr_array_header_t **logfiles,
   apr_array_header_t **names_p,
   apr_array_header_t **targets_p,
-  apr_array_header_t **args_p
+  apr_array_header_t **args_p,
+  apr_array_header_t **props_conflicted,
+  apr_array_header_t **possible_moved_to_repos_relpaths,
+  apr_array_header_t **possible_moved_to_abspaths
 };
 
 /* -----------------------------------------------------------------------
@@ -577,6 +580,40 @@
 }
 #endif
 
+/* -----------------------------------------------------------------------
+   apr_array_header_t **options
+   For svn_client_conflict_option_t
+*/
+
+#ifdef SWIGPYTHON
+%typemap(argout) apr_array_header_t **options {
+  %append_output
+    (svn_swig_py_pointerlist_to_list(*$1,
+                                     $descriptor(svn_client_conflict_option_t 
*),
+                                     _global_py_pool));
+  if (PyErr_Occurred()) {
+    SWIG_fail;
+  }
+}
+#endif
+
+/* -----------------------------------------------------------------------
+   apr_array_header_t **versions_p
+   For svn_client__shelf_get_all_versions
+*/
+
+#ifdef SWIGPYTHON
+%typemap(argout) apr_array_header_t **versions_p {
+  %append_output
+    (svn_swig_py_pointerlist_to_list(*$1,
+                                     $descriptor(svn_client__shelf_version_t 
*),
+                                     _global_py_pool));
+  if (PyErr_Occurred()) {
+    SWIG_fail;
+  }
+}
+#endif
+
 /* =======================================================================
    %typemap(in) apr_array_header_t *
 */

Modified: subversion/trunk/subversion/bindings/swig/include/svn_global.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_global.swg?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_global.swg (original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_global.swg Mon Nov  4 
05:59:36 2019
@@ -31,6 +31,12 @@
 #define SVN_DEPRECATED
 #endif
 
+#ifdef SWIGPYTHON
+%begin %{
+#define SWIG_PYTHON_STRICT_BYTE_CHAR
+%}
+#endif
+
 %include typemaps.i
 %include constraints.i
 %include exception.i
@@ -54,6 +60,7 @@
 #ifdef SWIGPYTHON
 %{
 #include "swigutil_py.h"
+#include "swigutil_py3c.h"
 %}
 #endif
 #ifdef SWIGPERL
@@ -135,9 +142,8 @@ static PyObject * _global_py_pool = NULL
 /* Python format specifiers. Use Python instead of SWIG to parse
    these basic types, because Python reports better error messages
    (with correct argument numbers). */
-%typemap (in, parse="s")
-  char *, char const *, char * const, char const * const "";
 %typemap (in, parse="c") char "";
+
 %typemap (in, fragment=SWIG_As_frag(long)) long
 {
   $1 = ($1_ltype)SWIG_As(long)($input);

Modified: subversion/trunk/subversion/bindings/swig/include/svn_string.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_string.swg?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_string.swg (original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_string.swg Mon Nov  4 
05:59:36 2019
@@ -36,9 +36,8 @@ typedef struct svn_string_t svn_string_t
     if (*$1 == NULL) {
         Py_INCREF(Py_None);
         s = Py_None;
-    }
-    else {
-        s = PyString_FromStringAndSize((*$1)->data, (*$1)->len);
+    } else {
+        s = PyBytes_FromStringAndSize((*$1)->data, (*$1)->len);
         if (s == NULL)
             SWIG_fail;
     }
@@ -75,14 +74,20 @@ typedef struct svn_string_t svn_string_t
 
 #ifdef SWIGPYTHON
 %typemap(in) svn_stringbuf_t * {
-    if (!PyString_Check($input)) {
-        PyErr_SetString(PyExc_TypeError, "not a string");
+    if (!PyBytes_Check($input)) {
+        PyErr_SetString(PyExc_TypeError, "not a bytes object");
         SWIG_fail;
     }
-    $1 = svn_stringbuf_ncreate(PyString_AS_STRING($input),
-                               PyString_GET_SIZE($input),
-                               /* ### gah... what pool to use? */
-                               _global_pool);
+    {
+      Py_ssize_t strBufLen;
+      char *strBufChar;
+      if (-1 == PyBytes_AsStringAndSize($input, &strBufChar, &strBufLen)) {
+        SWIG_fail;
+      }
+      $1 = svn_stringbuf_ncreate(strBufChar, strBufLen,
+                                 /* ### gah... what pool to use? */
+                                 _global_pool);
+    }
 }
 #endif
 
@@ -139,7 +144,7 @@ typedef struct svn_string_t svn_string_t
 
 #ifdef SWIGPYTHON
 %typemap(out) svn_stringbuf_t * {
-    $result = PyString_FromStringAndSize($1->data, $1->len);
+    $result = PyBytes_FromStringAndSize($1->data, (Py_ssize_t)($1->len));
 }
 #endif
 
@@ -174,12 +179,16 @@ typedef struct svn_string_t svn_string_t
     if ($input == Py_None)
         $1 = NULL;
     else {
-        if (!PyString_Check($input)) {
-            PyErr_SetString(PyExc_TypeError, "not a string");
+        Py_ssize_t pyStrLen;
+        if (!PyBytes_Check($input)) {
+            PyErr_SetString(PyExc_TypeError, "not a bytes object");
+            SWIG_fail;
+        }
+        if (PyBytes_AsStringAndSize($input, (char **)&(value.data),
+                                    &pyStrLen) == -1) {
             SWIG_fail;
         }
-        value.data = PyString_AS_STRING($input);
-        value.len = PyString_GET_SIZE($input);
+        value.len = pyStrLen;
         $1 = &value;
     }
 }
@@ -223,7 +232,7 @@ typedef struct svn_string_t svn_string_t
 
 #ifdef SWIGPYTHON
 %typemap(out) svn_string_t * {
-    $result = PyString_FromStringAndSize($1->data, $1->len);
+    $result = PyBytes_FromStringAndSize($1->data, $1->len);
 }
 #endif
 #ifdef SWIGPERL
@@ -242,6 +251,26 @@ typedef struct svn_string_t svn_string_t
 }
 #endif
 
+ /* -----------------------------------------------------------------------
+   Type: char * (input)
+*/
+#ifdef SWIGPYTHON
+%typemap (in) IN_STRING
+{
+    $1 = svn_swig_py_string_to_cstring($input, FALSE, "$symname", "$1_name");
+    if (PyErr_Occurred()) SWIG_fail;
+}
+
+%typemap (freearg) IN_STRING "";
+
+%apply IN_STRING {
+    const char *,
+    char *,
+    char const *,
+    char * const,
+    char const * const
+};
+#endif
 /* -----------------------------------------------------------------------
    define a way to return a 'const char *'
 */
@@ -253,7 +282,7 @@ typedef struct svn_string_t svn_string_t
         s = Py_None;
     }
     else {
-        s = PyString_FromString(*$1);
+        s = PyBytes_FromString(*$1);
         if (s == NULL)
             SWIG_fail;
     }
@@ -283,4 +312,8 @@ typedef struct svn_string_t svn_string_t
 #endif
 
 /* svn_wc_get_ancestry() lacks a 'const' */
-%apply const char **OUTPUT { const char **, char **url };
+%apply const char **OUTPUT {
+  const char **,
+  char **url,
+  char **log_message
+};

Modified: subversion/trunk/subversion/bindings/swig/include/svn_swigcompat.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_swigcompat.swg?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_swigcompat.swg 
(original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_swigcompat.swg Mon 
Nov  4 05:59:36 2019
@@ -45,7 +45,7 @@
 #if SWIG_VERSION <= 0x010327
 #ifdef SWIGPYTHON
 %define %set_constant(name, value)
-PyDict_SetItemString(d, name, value);
+PyDict_SetItem(d, PyBytes_FromString(name), value);
 %enddef
 #endif
 #endif

Modified: subversion/trunk/subversion/bindings/swig/include/svn_types.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_types.swg?rev=1869354&r1=1869353&r2=1869354&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_types.swg (original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_types.swg Mon Nov  4 
05:59:36 2019
@@ -93,6 +93,7 @@
 %apply SWIGTYPE **OUTPARAM {
   /* apr */
   apr_file_t **,
+  apr_hash_t **,
   /* svn_types.h */
   svn_commit_info_t **,
   svn_dirent_t **,
@@ -116,10 +117,16 @@
   void **credentials,
   void **iter_baton,
   void **token,
+  /* svn_checksum */
+  svn_checksum_t **,
   /* svn_client */
   svn_client_commit_info_t **,
+  svn_client_conflict_t **,
+  svn_client_conflict_option_t **,
   svn_client_ctx_t **,
   const svn_client_commit_item3_t **,
+  svn_client__shelf_t **,
+  svn_client__shelf_version_t **,
   /* svn_delta */
   const svn_delta_editor_t **,
   svn_txdelta_stream_t **,
@@ -129,6 +136,7 @@
   svn_txdelta_window_handler_t *,
 #endif
   void **handler_baton,
+  void **handler2_baton,
   void **root_baton,
   void **child_baton,
   void **file_baton,
@@ -142,6 +150,9 @@
   svn_fs_root_t **,
   svn_fs_txn_t **,
   void **contents_baton_p,
+  /* svn_io */
+  svn_io_dirent2_t **,
+  svn_stream_mark_t **,
   /* svn_ra */
   svn_ra_callbacks2_t **,
   svn_ra_plugin_t **,
@@ -335,7 +346,11 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
    Create a typemap for specifying string args that may be NULL.
 */
 #ifdef SWIGPYTHON
-%typemap(in, parse="z") const char *MAY_BE_NULL "";
+%typemap(in) const char *MAY_BE_NULL
+{
+    $1 = svn_swig_py_string_to_cstring($input, TRUE, "$symname", "$1_name");
+    if (PyErr_Occurred()) SWIG_fail;
+}
 #endif
 
 #ifdef SWIGPERL
@@ -464,12 +479,15 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
 */
 #ifdef SWIGPYTHON
 %typemap(in) (const char *PTR, apr_size_t LEN) {
-    if (!PyString_Check($input)) {
-        PyErr_SetString(PyExc_TypeError, "expecting a string");
+    Py_ssize_t pyStrLen;
+    if (!PyBytes_Check($input)) {
+        PyErr_SetString(PyExc_TypeError, "expecting a bytes");
+        SWIG_fail;
+    }
+    if (PyBytes_AsStringAndSize($input, &$1, &pyStrLen) == -1) {
         SWIG_fail;
     }
-    $1 = PyString_AS_STRING($input);
-    $2 = PyString_GET_SIZE($input);
+    $2 = pyStrLen;
 }
 #endif
 
@@ -1102,7 +1120,7 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
 #ifdef SWIGPYTHON
 %typemap(argout) unsigned char digest[ANY]
 {
-  %append_output(PyString_FromStringAndSize((char *)$1, APR_MD5_DIGESTSIZE));
+  %append_output(PyBytes_FromStringAndSize((const char *)$1, 
APR_MD5_DIGESTSIZE));
 }
 #endif
 
@@ -1175,7 +1193,7 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
     if ($input == Py_None) {
         $1 = NULL;
     } else {
-        $1 = (unsigned char *) PyString_AsString($input);
+        $1 = (unsigned char *) PyBytes_AsString($input);
         if ($1 == NULL) SWIG_fail;
     }
 }


Reply via email to