Skip to content
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

PSUTIL_DEBUG: print file + line number for C ext modules #2005

Merged
merged 7 commits into from
Oct 25, 2021

Conversation

giampaolo
Copy link
Owner

@giampaolo giampaolo commented Oct 25, 2021

Summary

  • OS: all
  • Bug fix: no
  • Type: core

Description

Define a C macro that prints file name and line number of the debug messages coming from C extension modules when
PSUTIL_DEBUG mode is activated. On UNIX the result looks like this

psutil-debug [psutil/_psutil_linux.c:150]> setmntent() failed (ignored)

On Windows:

psutil-debug [psutil/arch/windows/process_info.c:90]> NtWow64ReadVirtualMemory64(pbi64.PebBaseAddress) -> 998 (Unknown error) (ignored)

Also:

  • disable PSUTIL_DEBUG when running memory leak tests (avoid spamming of messages)
  • mention PSUTIL_DEBUG in doc and CONTRIBUTING.md
  • get rid of PSUTIL_TESTING var
  • add a callable psutil._set_debug() utility function

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
… stderr

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
…NG (it was not used)

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
@giampaolo giampaolo merged commit 0e15b48 into master Oct 25, 2021
@giampaolo giampaolo deleted the debug-c-macro branch October 25, 2021 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant