Description
In games/Tic-Tac-Toe/Tic-Tac-Toe.py lines 38 and 45, bare except: pass blocks catch ALL exceptions during font creation, not just font-related errors. This means any unexpected error (e.g., a typo in the font path, permission error, or a bug in the rendering logic) is silently swallowed.
Code
try:
font = pygame.font.SysFont('arial', 50, bold=True)
except:
pass
try:
font = pygame.font.SysFont('helvetica', 50, bold=True)
except:
pass
Impact
If a non-font error occurs during these try blocks (e.g., a NameError if pygame isn't properly imported, or a permission error), the game silently continues with no font set, leading to confusing behavior later. Developers cannot diagnose issues because errors are completely hidden.
Expected Behavior
Catch only the specific font-related exception (pygame.error) so other errors propagate:
try:
font = pygame.font.SysFont('arial', 50, bold=True)
except pygame.error:
pass
Labels
bug, GSSoC
Description
In
games/Tic-Tac-Toe/Tic-Tac-Toe.pylines 38 and 45, bareexcept: passblocks catch ALL exceptions during font creation, not just font-related errors. This means any unexpected error (e.g., a typo in the font path, permission error, or a bug in the rendering logic) is silently swallowed.Code
Impact
If a non-font error occurs during these try blocks (e.g., a NameError if pygame isn't properly imported, or a permission error), the game silently continues with no font set, leading to confusing behavior later. Developers cannot diagnose issues because errors are completely hidden.
Expected Behavior
Catch only the specific font-related exception (
pygame.error) so other errors propagate:Labels
bug, GSSoC