Author jeff.allen
Recipients Arfrever, jeff.allen, psykiatris, zyasoft
Date 2018-09-28.07:15:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Don't worry: all contributions gratefully received, at whatever pace. The recent changes under #2686 don't fix this, they just removed one confusion factor. (My refactoring was based on main.c in Python 2.7.15, BTW.)

PS jython-jvm9> dist\bin\jython -c "import sys; print 'ps1' in dir(sys)"
PS jython-jvm9> python -c "import sys; print 'ps1' in dir(sys)"

In #2686 I removed a complicating factor where we were setting ps1 and ps2 in the Jython main to empty strings. (This had been an incorrect fix for a different bug.)

Here's how I see this one. When a module is defined in Java, the attributes Python sees will be the instance or static members that appear in the Java class, both data and methods. There is magic in PyType that fills the module __dict__ with entries obtained by inspection, where the key is the name of the Java attribute, and the value is a wrapper (PyReflectedField) that can get and sometimes set the Java member. Here "set" means write the Java member, not (as might be the case in Python) change the entry in the dictionary, so a reference from Java, that knows nothing about the __dict__, sees the changed value. It is hardly ever necessary to permit deletion, but here it is.

So how to represent that? Setting the value to null is a natural choice, but the normal wrapper maps null to None. So we invented the special value AttributeDeleted.INSTANCE ( and use it here for ps* (, but it means we have to give it special treatment, which we've neglected to do in dir().

A change to __rawdir__  to pretend that we didn't see any attribute with value AttributeDeleted.INSTANCE would fix this issue, I think. This test should have a companion that verifies that for dir():
Date User Action Args
2018-09-28 07:15:15jeff.allensetmessageid: <>
2018-09-28 07:15:15jeff.allensetrecipients: + jeff.allen, zyasoft, Arfrever, psykiatris
2018-09-28 07:15:15jeff.allenlinkissue2305 messages
2018-09-28 07:15:14jeff.allencreate