[issue12403] Mention sys.displayhook in code module docs and the compile builtin docs

2021-05-18 Thread Norman Lorrain


Change by Norman Lorrain :


--
keywords: +patch
nosy: +Norman Lorrain
nosy_count: 7.0 -> 8.0
pull_requests: +24834
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26217

___
Python tracker 

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



[issue12403] Mention sys.displayhook in code module docs and the compile builtin docs

2021-04-26 Thread Sergey B Kirpichev


Change by Sergey B Kirpichev :


--
nosy: +Sergey.Kirpichev

___
Python tracker 

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



[issue12403] Mention sys.displayhook in code module docs and the compile builtin docs

2021-04-21 Thread Irit Katriel


Irit Katriel  added the comment:

The patch for the code module doc needs to be converted into a github PR.

A new patch is needed for the compile builtin documentation: 
https://docs.python.org/3/library/functions.html#compile
This could be added at the end of the third paragraph, where it says that in 
'single' mode non-None results are printed - clarify that sys.displayhook is 
used for that.

(See these unit tests for examples: 
https://github.com/python/cpython/blob/09b90a037d18f5d4acdf1b14082e57bda78e85d3/Lib/test/test_sys.py#L26)

--
keywords: +easy -patch
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.1, Python 
3.3

___
Python tracker 

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



[issue12403] Mention sys.displayhook in code module docs and the compile builtin docs

2012-08-27 Thread Aaron Iles

Aaron Iles added the comment:

I've submitted a patch which adds a section to the code module's documentation 
on overriding console output. It attempts to catalogue when sys.stderr, 
sys.excepthook and sys.displayhook are used to print console output.

--
keywords: +patch
nosy: +aliles
Added file: http://bugs.python.org/file27014/p1346072775.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12403
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12403] Mention sys.displayhook in code module docs and the compile builtin docs

2011-06-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Well, the code is being executed by an exec call on a code object that was 
compiled with the 'single' flag, which is what causes non-None values to get 
printed.  The compile docs aren't clear on how printed is implemented, but 
the answer is that it calls sys.displayhook.  So the way to control that part 
of the output is to assign your own function to sys.displayhook.  None of this 
is documented, and it should be (it took me a while to figure it out, and I had 
a suspicions about how it worked), so I'm changing this to a documentation bug.

However, you mention in the other ticket that are trying to do the interactive 
interpreter trick through a socket.  For that application I think you want to 
ignore both the write method and sys.displayhook, and instead directly patch 
sys.stdout and sys.stderr. Otherwise you'd also miss output sent to those 
destinations via print statements or writing directly to the sys objects, which 
would confuse the user of your interface since the in the normal interactive 
prompt those show up on the console.

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python, r.david.murray
stage:  - needs patch
title: Allow overriding of writing to stdout in code.InteractiveConsole - 
Mention sys.displayhook in code module docs and the compile builtin docs
type: feature request - behavior
versions: +Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12403
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12403] Mention sys.displayhook in code module docs and the compile builtin docs

2011-06-25 Thread Miki Tebeka

Miki Tebeka miki.teb...@gmail.com added the comment:

Yeah, I though about using dup2 from stdout/stderr to the socket. However this 
means I can connect only one client at a time. Which was an issue I was trying 
to avoid. Didn't think about print statements though ...

Thanks.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12403
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12403] Mention sys.displayhook in code module docs and the compile builtin docs

2011-06-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Well, sys.stdout and sys.stderr don't have to be real file objects.  You could 
substitute a file-like object (one that implements the methods that get called 
during the interpretation loop) that does your multiplexing.  That kind of 
trick is one of the things that makes Python so much fun to work with :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12403
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com