Paul Winkler wrote at 2005-5-26 19:57 -0400:
...
Make it so! :-)
_marker = [] def hasattr(obj, attr, marker):
I introduced a bug here (noticed by "Alec Mitchell"). The "marker" argument should have been "_marker=_marker".
... Are you currently running zope with a patch like this?
No, because I never really met an "hasattr" bug (although I acknowledge that it may happen).
Have you noticed any performance difference? the zope 2.6 source code contains over 700 calls to hasattr()...
We replace a small C-implemented function with a small Python one. Although the Python function may be about 10 times slower, the overall effect is almost surely negligible. A higher risk comes from the fact that some Python packages may rely on the broken "hasattr" behaviour. That's the reason why the problem is not fixed in Python itself. -- Dieter