Message11409

Author zyasoft
Recipients trickyturtle, zyasoft
Date 2017-05-27.18:04:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1495908269.66.0.417276490561.issue2595@psf.upfronthosting.co.za>
In-reply-to
Content
isdir is implemented in Lib/genericpath.py with the following code:

def isdir(s):
    """Return true if the pathname refers to an existing directory."""
    try:
        st = os.stat(s)
    except os.error:
        return False
    return stat.S_ISDIR(st.st_mode)

In turn the core of the stat function is implemented here; Note that we have differentiated stat functions as well for file descriptors (fstat) and symbolic links (lstat), as well as for Windows (WindowsStatFunction):

https://github.com/jythontools/jython/blob/master/src/org/python/modules/posix/PosixModule.java#L1512

Perhaps Z/OS does not support "unix:*" attributes, or only does so partially. We do know that Java does support https://docs.oracle.com/javase/7/docs/api/java/io/File.html#isDirectory(), and in general the Java implementation will always be more reliable than using other predicates, *if available*.

So that is my recommendation: customize genericpath.py usage to use Java where possible, possibly by some specific Jython extensions in PosixModule.java.
History
Date User Action Args
2017-05-27 18:04:29zyasoftsetmessageid: <1495908269.66.0.417276490561.issue2595@psf.upfronthosting.co.za>
2017-05-27 18:04:29zyasoftsetrecipients: + zyasoft, trickyturtle
2017-05-27 18:04:29zyasoftlinkissue2595 messages
2017-05-27 18:04:28zyasoftcreate