Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the behavior of the mark functions to allow calling them even when tracing is not active and only issue warnings instead of raising exceptions. Key changes include:
- Adding an is_active() function to check the tracing state.
- Modifying the mark(), mark_range(), and _mark_stack() functions to issue RuntimeWarning when tracing is disabled.
- Adding new tests to verify the new warning-based behavior.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/test_etw.py | Added tests to verify that mark functions warn when not active. |
| src/etwtrace/init.py | Updated mark functions to warn instead of raising errors and added is_active(). |
Comments suppressed due to low confidence (3)
src/etwtrace/init.py:177
- Update the documentation for 'mark' to state that when the global tracer is not enabled, the function now issues a RuntimeWarning instead of raising a RuntimeError.
def mark(name):
src/etwtrace/init.py:191
- Clarify the docstring for 'mark_range' to explain that it warns and returns a _NullRange when the global tracer is not enabled.
def mark_range(name):
src/etwtrace/init.py:201
- Update the documentation for '_mark_stack' to indicate that it now issues a warning when the global tracer is not enabled rather than raising an exception.
def _mark_stack(mark):
finnagin
approved these changes
Jun 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows code to use them unconditionally, and only have to deal with a warning if tracing is not activated.
Adds is_active() function to allow for testing tracing state.
Fixes #17