Skip to content

Conversation

vediyappanm
Copy link

Description

Replace bare except: with except (ImportError, AttributeError): in timers.py line 28.

Motivation

Bare except clauses catch all exceptions including SystemExit and KeyboardInterrupt,
which can hide bugs. Using specific exception types follows Python best practices
and makes debugging easier.

Changes

  • Line 28: Changed except: to except (ImportError, AttributeError):

Testing

  • Verified import works: python -c "from megatron.core import timers; print('✓ Import successful')"
  • Confirmed function is correctly assigned: dist_all_gather_func: all_gather_into_tensor
  • No breaking changes - maintains backward compatibility

Checklist

  • Code follows project style
  • Commit message in imperative mood
  • No unrelated changes
  • Change is minimal and focused

Replace bare except: with except (ImportError, AttributeError):
to improve error handling and follow Python best practices.

This change maintains backward compatibility while making
debugging easier by only catching expected exceptions.
@copy-pr-bot
Copy link

copy-pr-bot bot commented Oct 12, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@sbhavani sbhavani added the bug Something isn't working label Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants