-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interaction of LOP with builtins is badly broken #31
Comments
Oooof ... looks like python2 os.stat will raise It would look like it fails at the argument parsing. The problem is that the proxies (cext, simple and slots) all implement Something like this would work with the pure python implementations but it's destructive you see ... import os
from lazy_object_proxy.slots import Proxy
del Proxy.__index__ # DESTRUCTIVE
class PathProxy(Proxy):
def __fspath__(self):
return str(self)
os.stat(PathProxy(lambda: '.')) |
Thank you for the info. Can it be solved by
|
Annotations wouldn't help at all. os.stat's checks basically do this:
Python is pretty broken with regard to capability checking (iow: checking if an object can do something or has a certain special method). While you can have a descriptor as a special method, and make it raise AttributeError most of the python code written in C will happily only check the existence of a slot for special method and forget about that silly descriptor stuff. |
FYI v1.5.0 adds support for |
Will try, thank you for getting me know. Though I am not sure if it will work for the versions of python not checking |
The text was updated successfully, but these errors were encountered: