Message12128

Author jeff.allen
Recipients Arfrever, jeff.allen, psykiatris, zyasoft
Date 2018-09-30.14:49:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538318954.75.0.545547206417.issue2305@psf.upfronthosting.co.za>
In-reply-to
Content
As explained above, you don't want to delete it properly from the dictionary, just have it ignored.

This code looks up the name, and if there's an entry in the dictionary, rather than remove the entry, it sets the member that to the special value AttributeDeleted.INSTANCE. Note that the __dict__ entry is a descriptor that manipulates the field Java sees, so we have to call its __set__ method, to set the new value, not just write in the distionary.

I don't understand the "fix fix fix" comment. (It has been there a long time.) AFAIK this code is ok. The problem is that dir() does not ignore the entry when AttributeDeleted.INSTANCE is stored there.

There was confusion in the old main() about two things that "interactive" means: 1. stdin/out is thought to be a terminal; and 2. Jython should start an interactive session on stdin/out to receive commands to execute them. Only the second sense is relevant to whether sys.ps1 and ps2 exist.

Code given with -c does not execute in an interactive session, so ps1, ps2 don't exist. If you give the -i option, they still don't exist while -c's code executes, but they will during the interactive session that follows.
History
Date User Action Args
2018-09-30 14:49:14jeff.allensetmessageid: <1538318954.75.0.545547206417.issue2305@psf.upfronthosting.co.za>
2018-09-30 14:49:14jeff.allensetrecipients: + jeff.allen, zyasoft, Arfrever, psykiatris
2018-09-30 14:49:14jeff.allenlinkissue2305 messages
2018-09-30 14:49:13jeff.allencreate