@@ -1328,7 +1328,12 @@ def _add_check(check, kind, codes, args):
13281328 codes = ERRORCODE_REGEX .findall (check .__doc__ or '' )
13291329 _add_check (check , args [0 ], codes , args )
13301330 elif inspect .isclass (check ):
1331- if inspect .getargspec (check .__init__ )[0 ][:2 ] == ['self' , 'tree' ]:
1331+ if sys .version_info [0 ] >= 3 :
1332+ parameters = list (inspect .signature (check .__init__ ).parameters )
1333+ else :
1334+ parameters = inspect .getargspec (check .__init__ )[0 ]
1335+
1336+ if parameters [:2 ] == ['self' , 'tree' ]:
13321337 _add_check (check , 'tree' , codes , None )
13331338
13341339
@@ -1504,7 +1509,7 @@ def check_ast(self):
15041509 """Build the file's AST and run all AST checks."""
15051510 try :
15061511 tree = compile ('' .join (self .lines ), '' , 'exec' , PyCF_ONLY_AST )
1507- except (SyntaxError , TypeError ):
1512+ except (ValueError , SyntaxError , TypeError ):
15081513 return self .report_invalid_syntax ()
15091514 for name , cls , __ in self ._ast_checks :
15101515 checker = cls (tree , self .filename )
0 commit comments