This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Barney Stratford
Recipients Barney Stratford, martin.panter, twouters
Date 2015-08-02.16:37:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438533443.6.0.457480320473.issue24727@psf.upfronthosting.co.za>
In-reply-to
Content
You're absolutely right. I had elided the details of the locking from my original use case, but now I look at it again, I see that even what I did have wasn't enough.

I've made a new patch that takes a lock properly. A non-blocking acquisition of the lock will serve the same purpose as looking to see if there is a line being read, and will also prevent the interpreter from starting to read a new line while the text is being printed.

My use case now looks like this.

reading_lock = threading.Lock ()
readline.set_lock (reading_lock)

def describe (indicator):
	if reading_lock.acquire (False):
		print (indicator.description)
		reading_lock.release ()
	else:
		print ()
		print (indicator.description)
		readline.forced_update_display ()
History
Date User Action Args
2015-08-02 16:37:23Barney Stratfordsetrecipients: + Barney Stratford, twouters, martin.panter
2015-08-02 16:37:23Barney Stratfordsetmessageid: <1438533443.6.0.457480320473.issue24727@psf.upfronthosting.co.za>
2015-08-02 16:37:23Barney Stratfordlinkissue24727 messages
2015-08-02 16:37:23Barney Stratfordcreate