Skip to content

Debug cannot be disabled when running MemoryModule #11

@rkbennett

Description

@rkbennett

Once pythonmemorymodule is imported, if you attempt to call the MemoryModule function and explicitly set debugging to False, it is ignored

import pythonmemorymodule
pythonmemorymodule.MemoryModule(data=dll, debug=False)

Running the above will still result in debug level logging being output.

The reason for this appears to be on line 478 of the __init__ file, which has the following content:

self._debug_ = debug or debug_output

The issue is the use of or here, if you explicitly set debug to False, then it checks the value for debug_output, which is set earlier to __debug__. This value always equates to True unless you call python with a -o based on my reading, which makes the debug kwarg not actually do anything because it will always result in a True in most cases.

Ideally, this would be fixed by removing the or and just letting the debug kwarg dictate if debugging is desired. If debug logging is the intended default, then setting the default value of debug to True in the function definition would likely be the better solution.

Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions