[issue24727] Expand readline module

2015-08-02 Thread Barney Stratford

Barney Stratford added the comment:

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 ()

--
Added file: http://bugs.python.org/file40104/patch.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24727] Expand readline module

2015-08-01 Thread Martin Panter

Martin Panter added the comment:

Suggest you integrate your rl_forced_update_display() wrapper and documentation 
with the existing patches in Issue 23067.

Regarding the reading_line() flag, your use case seems a bit racy to me. Can’t 
the other thread start reading a line after reading_line() returns false and 
before your print() statement happens?

--
dependencies: +Export readline forced_update_display
nosy: +vadmium

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24727] Expand readline module

2015-07-27 Thread R. David Murray

Changes by R. David Murray :


--
versions:  -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24727] Expand readline module

2015-07-26 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +twouters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24727] Expand readline module

2015-07-26 Thread Barney Stratford

Changes by Barney Stratford :


--
components: +Extension Modules -Library (Lib)

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24727] Expand readline module

2015-07-26 Thread Barney Stratford

New submission from Barney Stratford:

I have a use case where a daemon thread needs to write periodic updates to 
sys.stdout. I'd prefer it not to print in the middle of a command being typed. 
In order to achieve this, I have added to the readline module. There is now a 
function to determine whether we are reading a line, and one to call 
rl_forced_update_display. These functions enable me to say (in the daemon 
thread):

def describe (indicator):
if readline.reading_line ():
print ()
print (indicator.description)
readline.forced_update_display ()
else:
print (indicator.description)


I have read PEP7, and have made patchtest on my patch.

--
components: Library (Lib)
files: patch.txt
messages: 247424
nosy: Barney Stratford
priority: normal
severity: normal
status: open
title: Expand readline module
type: enhancement
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40029/patch.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com