[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

There is another problem: PySys_WriteStderr is faster than your gc_log, which 
can potentially slow down heavy GC-based programs, even if the file descriptor 
is not used.

--

___
Python tracker 

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

There are several problems with this change:

1) The lifetime of the file descriptor. The file descriptor is borrowed, which 
normally will lead to not being properly cleaned upon failure or interpreter 
deallocation.

2) The statistics you are trying to fetch via parsing the file are actually 
available through better APIS:

https://docs.python.org/3/library/gc.html#gc.callbacks
and
https://docs.python.org/3/library/gc.html#gc.get_stats

3) The stderr output is not stable or considered to be stable between releases. 
The main purpose is to serve as a quick way to debug or check for statistics 
without using proper callbacks, but enything more involved needs to use the 
callbacks.

Based on these, I am afraid I don't feel comfortable supporting this patch :(

--

___
Python tracker 

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

Sorry, parameter type is `TextIOWrapper`, not `TestIOWrapper`

--

___
Python tracker 

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

Thank you for the reminder.

At first, I wanted to analyze the effectiveness of GC through logs.
However, because GC through the stderr output, these logs are mixed in with 
other output(such as warnings). This make it difficult to handle them 
automaticaly.

So, i added an `TestIOWrapper` parameter(Not just file streams, but also other 
io, sockets, buffer and so on) to `set_debug` function in gcmodule.c, to 
redirect GC logs.

I think this will help developers monitor the GC more easily, for example when 
they deal with a memory leak.

Of course, the default will remain the same as the previous behavior , log via 
stderr :)

--

___
Python tracker 

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks for opening this issue..I think you need to elaborate a bit more about 
this feature you are suggesting. In general we don't allow this kind of 
facilities to redirect to file stream anywhere else in the interpreter.

--
nosy: +pablogsal

___
Python tracker 

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


--
keywords: +patch
pull_requests: +28077
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29848

___
Python tracker 

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread penguin_wwy


New submission from penguin_wwy <940375...@qq.com>:

Set up file stream for redirecting logs by adding a parameter in `set_debug`.

The stderr is used by default.

--
components: Library (Lib)
messages: 407286
nosy: penguin_wwy
priority: normal
severity: normal
status: open
title: Set up file stream for redirecting GC logs
type: enhancement
versions: Python 3.11

___
Python tracker 

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