ivankorobkov / python-inject

Python dependency injection
Apache License 2.0
671 stars 77 forks source link

Fix crash introduced in Python 3.8 in _AttributeInjection. #78

Open andrewborba10 opened 3 years ago

andrewborba10 commented 3 years ago

Problem: getattr() is now called on all class attributes when building a Mock that has a spec provided. This triggers a crash in _AttributeInjection because Mocks are typically created before the configuration process has completed.

Solution: Stop raising InjectionError when getattr is called on an attribute, and instead return a sentinel type that represents a null value. This allows reflective logic to complete without issue.

ivankorobkov commented 3 years ago

Hi!

I'm a little busy right now. I'll try to take a look this week.

fadedDexofan commented 3 years ago

@ivankorobkov Hi. Any progress in looking? 😀

ivankorobkov commented 3 years ago

@fadedDexofan Hi, I'm sorry guys, I've been really busy for the last couple of months. The PR does not look good to me, so I just can't merge it without some changes. I'll try to look into it today or tomorrow.

philippeboyd commented 2 years ago

@ivankorobkov any news on this?