__getattr__ cannot be accessed from python by looking it up on the type
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.2k
- Forks
- 1k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 66
Description
Bug Description
getattr cannot be accessed via the type's getattr slot0 wrapper.. Accessing getattr in this manner is possible for a class defined in pure Python.
Steps to Reproduce
Adding the following test to test_getattr in test_proto_methods.rs, leads to an AttributeError instead of a TypeError
py_expect_exception!(
py,
example_py,
"type(example_py).__getattr__(object(), 'test')",
PyTypeError
);
Backtrace
Your operating system and version
Ubuntu within the WSL
Your Python version (python --version)
Python 3.14
Your Rust version (rustc --version)
1.95
Your PyO3 version
0.28.3
How did you install python? Did you use a virtualenv?
apt and I used a venv
Additional Info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test_getattr in test_proto_methods.rs and run the existing test to reproduce the AttributeError. Compare the type(example_py).getattr behavior with the expected PyTypeError for a pure-Python class, then confirm the test passes with the corrected slot access behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100