Skip to content

Implement hasattr builtin function#66

Open
friendlymatthew wants to merge 1 commit intomainfrom
hasattr
Open

Implement hasattr builtin function#66
friendlymatthew wants to merge 1 commit intomainfrom
hasattr

Conversation

@friendlymatthew
Copy link
Member

This PR implements hasattr(object,name) which returns True if the object has the named attribute, False otherwise. Unlike #65, this function never raises an AttributeError

This implementation calls py_get_attr() directly and converts the result to a boolean rather than reusing builtin_getattr(), since the functions have different signatures to validate

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 23, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing hasattr (873ee89) with main (7909646)

Summary

✅ 11 untouched benchmarks

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.

1 participant