Skip to content

Conversation

@Nepomuk5665
Copy link

Summary

This PR fixes a bug in stone/backends/python_rsrc/stone_validators.py where an except clause was using list syntax instead of tuple syntax for catching multiple exceptions.

The Bug

On line 714, the code was:

except [AttributeError, ValueError]:

This is invalid Python syntax. When Python attempts to execute this code, it raises:

TypeError: catching classes that do not inherit from BaseException is not allowed

The Fix

Changed to proper tuple syntax:

except (AttributeError, ValueError):

Verification

# Before (broken)
try:
    raise ValueError('test')
except [ValueError, AttributeError]:  # TypeError!
    print('caught')

# After (working)
try:
    raise ValueError('test')
except (ValueError, AttributeError):  # Works correctly
    print('caught')

Impact

This bug would cause HashRedactor.apply() to fail entirely whenever an AttributeError or ValueError is raised during hashing, preventing proper redaction of sensitive data.

The except clause at line 714 in HashRedactor.apply() was using list
syntax [AttributeError, ValueError] instead of tuple syntax
(AttributeError, ValueError). Using a list causes a TypeError at
runtime: 'catching classes that do not inherit from BaseException
is not allowed'.

This bug would prevent the HashRedactor from properly catching
AttributeError or ValueError, causing the redaction to fail entirely
when these exceptions occur.
@CLAassistant
Copy link

CLAassistant commented Jan 24, 2026

CLA assistant check
All committers have signed the CLA.

@alyx-db
Copy link

alyx-db commented Jan 26, 2026

@Nepomuk5665

Thanks for your submission! I'll pass this along to the team for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants