Thanks for the reviewing.
On 2020/05/11 0:57, Daniel Shahaf wrote:
> Jun Omae wrote on Sun, 10 May 2020 13:27 +0900:
>> +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.
Indeed. Revised the patch by your suggestion.
However python3.8 on cygwin doesn't have os.add_dll_directory.
Python 3.8.2 (default, Apr 9 2020, 21:39:49)
[GCC 9.3.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'os' has no attribute 'add_dll_directory'
>> + 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 ()
Okay. Confirmed OSError is raised when os.add_dll_directory() fails (e.g. for non existent directory).
Revised the patch to catch only OSError.
See attached patch py38-windows-add-dll-directory--v2.diff.
Jun Omae <jun66j5_at_gmail.com> (大前 潤)
Received on 2020-05-11 19:08:53 CEST