|
From: Dustin L. <qh...@gm...> - 2011-04-15 20:13:56
|
Here is the use case and a fix for this error. Let me know if there is a
more efficient way to present this.
groucho:~/projects/python/pychecker/pychecker-0.8.19
$ cat ../test_checkbuiltins.py
def foo_func():
s = "foo"
return '%s' % s.center(1)
groucho:~/projects/python/pychecker/pychecker-0.8.19
$ python pychecker/checker.py ../test_checkbuiltins.py
Processing module test_checkbuiltins (../test_checkbuiltins.py)...
Warnings...
../test_checkbuiltins.py:3: INTERNAL ERROR -- STOPPED PROCESSING FUNCTION --
Traceback (most recent call last):
File "pychecker/warn.py", line 242, in _checkFunction
_checkCode(code, codeSource)
File "pychecker/warn.py", line 153, in _checkCode
dispatch_func(oparg, operand, codeSource, code)
File "pychecker/CodeChecks.py", line 1690, in _CALL_FUNCTION
_handleFunctionCall(codeSource, code, oparg)
File "pychecker/CodeChecks.py", line 474, in _handleFunctionCall
check_arg_count)
File "pychecker/CodeChecks.py", line 256, in _checkBuiltin
methodInfo[1], methodInfo[2])
IndexError: tuple index out of range
groucho:~/projects/python/pychecker/pychecker-0.8.19
$ diff -p pychecker/python.py ../pychecker-0.8.19-FIXED/pychecker/python.py
*** pychecker/python.py 2011-01-06 15:59:52.000000000 -0700
--- ../pychecker-0.8.19-FIXED/pychecker/python.py 2011-04-15
13:59:18.000000000 -0600
*************** if utils.pythonVersion() >= utils.PYTHON
*** 165,173 ****
if utils.pythonVersion() >= utils.PYTHON_2_4:
_STRING_METHODS['rsplit'] = (types.StringType, 0, 2)
! _STRING_METHODS['center'] = (types.StringType, 1, 2),
! _STRING_METHODS['ljust'] = (types.StringType, 1, 2),
! _STRING_METHODS['rjust'] = (types.StringType, 1, 2),
BUILTIN_METHODS = { types.DictType :
{ 'clear': (types.NoneType, 0, 0),
--- 165,173 ----
if utils.pythonVersion() >= utils.PYTHON_2_4:
_STRING_METHODS['rsplit'] = (types.StringType, 0, 2)
! _STRING_METHODS['center'] = (types.StringType, 1, 2)
! _STRING_METHODS['ljust'] = (types.StringType, 1, 2)
! _STRING_METHODS['rjust'] = (types.StringType, 1, 2)
BUILTIN_METHODS = { types.DictType :
{ 'clear': (types.NoneType, 0, 0),
--
Dustin Lee
qhfgva=rot13(dustin)
|