If I try to use PyChecker on my code that uses Zope
(2.6.2), I get the following warnings and error:
warning: couldn't find real module for class <extension
class Base at 401eb480> (module name: None)
warning: couldn't find real module for class <extension
class ExtensionClass at 401eb620> (module name: None)
Traceback (most recent call last):
File "/usr/lib/site-python/pychecker/checker.py",
line 673, in ?
sys.exit(main(sys.argv))
File "/usr/lib/site-python/pychecker/checker.py",
line 659, in main
warnings = warn.find(getAllModules(), _cfg,
suppressions)
File "/usr/lib/site-python/pychecker/warn.py", line
593, in find
globalRefs, warnings, suppressions)
File "/usr/lib/site-python/pychecker/warn.py", line
494, in _findClassWarnings
_checkOverridenMethods(method.function,
baseClasses, warnings)
File "/usr/lib/site-python/pychecker/warn.py", line
339, in _checkOverridenMethods
if func.func_name != utils.INIT and
File "/usr/lib/site-python/pychecker/function.py",
line 142, in same_signature
return _co_flags_equal(base_func_code,
func.func_code) and
File "/usr/lib/site-python/pychecker/function.py",
line 130, in _co_flags_equal
return (o1.co_flags & _CO_FLAGS_MASK) ==
(o2.co_flags & _CO_FLAGS_MASK)
AttributeError: FuncCode instance has no attribute
'co_flags'
Logged In: YES
user_id=50945
Btw, here is a simple 2-line example file to demonstrate the
problem:
import ZODB
from OFS.Folder import Folder
Logged In: YES
user_id=1168720
On my Debian system, I can reproduce this with Python 2.2
and Zope 2.6.4 and then with Python 2.3 and 2.4 and Zope
2.7.4, using the short example submitted by spiv in late 2003.
Logged In: YES
user_id=1168720
The Zope class Shared.DC.Scripts.Signature.FuncCode is the
cause of this problem and a number of other similar problems
in the code. It is missing quite a few attributes that
pychecker relies on.
I have submitted patch #1168816 which proposes one way to
deal with this problem, basically by ignoring "broken" Zope
classes when we have the chance rather than blowing out or
having to special-case every piece of code that uses a
missing attribute. After my patch is applied, pychecker
completes normally, although there are a huge number of
Zope-related warnings.