Skip to content

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Aug 20, 2022

PR types

Bug fixes

PR changes

Others

Describe

  File "/Users/username/Projects/Paddle/tools/CrossStackProfiler/CspFileReader.py", line 366
    except Exception, Argument:
           ^^^^^^^^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized

一个语法错误,之前全量扫描解析 AST 时就发现该文件是无法解析的了(更别说运行时了),flake8 和 black 也都会因为其语法错误而无法成功解析 AST 进一步分析。

@paddle-bot
Copy link

paddle-bot bot commented Aug 20, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Aug 20, 2022
@SigureMo
Copy link
Member Author

SigureMo commented Aug 21, 2022

iScan(PR-CI-iScan-Python)发现了一个明显的逻辑错误

if not self._fileList:
if (self._getId(self._fileList[-1]) -
self._getId(self._fileList[0])) != len(self._fileList) - 1:
raise Exception("The file id should be countious!")

_getId 的声明如下:

def _getId(self, fileName, organizeForm, sed="."):

但上面 self._getId(self._fileList[-1])self._getId(self._fileList[0]) 明显少了必需的位置参数 organizeForm,这里一定会报 TypeError

另外,177 行是判断 _fileList 为空,紧接着 self._fileList[-1]self._fileList[0] 这不是必然报 IndexError 吗?

这个代码文件无论从语法解析阶段还是运行时都是有着明显的错误的,这样的代码真的可以运行吗?

@luotao1 luotao1 self-assigned this Aug 23, 2022
@luotao1 luotao1 requested a review from gongweibao August 23, 2022 03:38
Copy link
Contributor

@gongweibao gongweibao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1
Copy link
Contributor

luotao1 commented Aug 23, 2022

iScan(PR-CI-iScan-Python)发现了一个明显的逻辑错误

  1. @gongweibao 讨论了下,这个profiler工具长时间没有维护了,后续会合入新的profiler工具。
  2. 目前先豁免了iScan报出的错误,不阻碍 @SigureMo 进行AST解析分析,后续进行统一修改。
  3. @lw921014 知晓

@gongweibao gongweibao merged commit dd2f4a1 into PaddlePaddle:develop Aug 23, 2022
@SigureMo SigureMo deleted the fix-syntax-error branch August 23, 2022 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants