Jun Omae wrote on Sun, 10 May 2020 13:27 +0900:
> +++ subversion/bindings/swig/include/svn_global.swg (working copy)
> @@ -242,3 +242,40 @@
> +#ifdef SWIGPYTHON
> +/* Since Python 3.8+ on Windows, DLL dependencies when loading *.pyd file
> + * searches only the system paths, the directory containing the *.pyd file and
> + * the directories added with os.add_dll_directory().
> + * See also https://bugs.python.org/issue36085.
> + */
> +%define SVN_PYTHON_MODULEIMPORT
> +"
> +def _dll_paths():
> + import os
> + if hasattr(os, 'add_dll_directory'): # Python 3.8+ on Windows
> + cookies = []
> + for path in os.environ.get('PATH', '').split(';'):
Use os.pathsep in the split() call? That would make the code
self-documenting and be forward compatible with… well, with anything
that implements os.add_dll_directory() and uses another value of
os.pathsep. I guess Cygwin's Python package might fit this bill.
> + if path and os.path.isabs(path):
> + try:
> + cookie = os.add_dll_directory(path)
> + except:
> + continue
Should this really catch _all_ exceptions?
> + else:
> + cookies.append(cookie)
> + return cookies
> + else:
> + return ()
Cheers,
Daniel
Received on 2020-05-10 17:57:33 CEST