Skip to content

Conversation

@varunkasyap
Copy link
Contributor

@varunkasyap varunkasyap commented Dec 24, 2025

Reference issue (if any)

None

What does this implement/fix?

This fixes a bug in mne.utils._logging._frame_info where lstrip('mne.') incorrectly removed characters from module names starting with 'm', 'n', 'e', or '.' due to treating the argument as a set of characters rather than a prefix.

Example:
Before: mne.event -> vent
After: mne.event -> event

Additional information

I want to check if I should use removeprefix() instead of replace(), given that removeprefix is not supported in Python versions older than 3.9

@varunkasyap
Copy link
Contributor Author

I want to check if I should use removeprefix() instead of replace(), given that removeprefix is not supported in Python versions older than 3.9

@drammock
Copy link
Member

I want to check if I should use removeprefix() instead of replace(), given that removeprefix is not supported in Python versions older than 3.9

Our minimum version is 3.10 I think, so removeprefix is fine

@varunkasyap
Copy link
Contributor Author

varunkasyap commented Dec 24, 2025

Our minimum version is 3.10 I think, so removeprefix is fine

done, patched with removeprefix()

@varunkasyap
Copy link
Contributor Author

varunkasyap commented Dec 24, 2025

Our minimum version is 3.10 I think, so removeprefix is fine

hi @drammock , in that case as per the # TODO comment, patch is needed here too?

# TODO: no longer needed when py3.9 is minimum supported version
def _empty_hash(kind="md5"):
func = getattr(hashlib, kind)
if "usedforsecurity" in inspect.signature(func).parameters:
return func(usedforsecurity=False)
else:
return func()

@drammock drammock enabled auto-merge (squash) December 26, 2025 15:26
@drammock drammock merged commit 1b3973b into mne-tools:main Dec 26, 2025
32 checks passed
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.

2 participants