-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable [X refs, Y blocks] ouput in debug builds #61525
Comments
I suggest to disable the [X refs, Y blocks] ouput in debug builds by default, and provide an option to enable it if/when necessary. |
The "refs" output also complicates testing in some cases, e.g. http://hg.python.org/cpython/file/bc4458493024/Lib/test/test_subprocess.py#l61 |
I don't know exactly what the option would be called, but +1 on the idea. Perhaps something under the interpreter's -X option since it's implementation-specific? This output gets in the way a fair bit when debugging interpreter sessions, and Chris brings up a good point about testability. |
Here's a proof of concept that defines a new _print_total_refs() function and calls it through the PRINT_TOTAL_REFS macro, disables printing the refs by default, and adds a "-X showrefcount" option to reenable it. This can also be achieved at runtime by adding/removing 'showrefcount' from the sys._xoptions dict. Things that should be done/decided before the final version:
|
_Py_GetRefTotal() wouldn't be available in non-debug builds IIRC. |
Yes -- I was proposing to make it available on non-debug builds too, unless it has a negative impact on the performance or other similar issues. |
If this is done, it should probably be on by default on all --with-pydebug buildbots. Otherwise I suspect nobody will _ever_ look at its output and we should just remove the feature all together. Being off in the main process on the build bots would still make test_subprocess.py happier though as that test's own child processes wouldn't pass the command line flag to enable it so they wouldn't see it in child process stderr. |
With "on by default" you mean that the output should be disabled or enabled?
IME the refcount is only useful while trying things in the interactive interpreter manually, e.g. try to repeat the same operation and see if the refcount increases or not. In this case the feature would still be useful, so it should be kept. |
Attached updated patch with docs and tests. |
Attached a new patch that addresses a couple of minor things pointed out in the reviews. |
New changeset 367167f93c30 by Ezio Melotti in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: