这是是一个面向 科学计算 的Python工具包 - #49
Open
chenziqi66 wants to merge 1 commit into
Open
chenziqi66 wants to merge 1 commit into
chenziqi66 wants to merge 1 commit into
Conversation
我发现了如下的几个bug,请你帮我修正 1. Python 3 语法兼容性问题 - print语句 (大量文件) 严重程度: 高 - 导致SyntaxError 这个项目是基于Python 2编写的,在Python 3环境下几乎所有使用 print 语句的地方都会报错,因为Python 3要求 print() 必须带括号。 2. Tab和空格缩进不一致问题 严重程度: 高 - 导致TabError 3. Python 2风格的异常捕获语法 严重程度: 高 - 导致SyntaxError Python 3不再支持 except Exception, msg 语法,必须使用 except Exception as msg 。 4. None比较使用==而不是is 严重程度: 中 - 潜在逻辑错误 PEP 8推荐使用 is None 和 is not None 来比较None对象,使用 == None 在某些情况下可能导致意外行为。 5. 无效的转义序列警告 严重程度: 低 - SyntaxWarning 6. exec语句语法问题 严重程度: 高 - 导致SyntaxError Python 3中exec是函数,必须写成 exec(...) 。 7. print >> 语法 (Python 2风格的重定向输出) 严重程度: 高 - 导致SyntaxError 8. 文件句柄未正确关闭 严重程度: 中 - 资源泄漏 很多地方使用 open() 但没有确保文件被关闭: 约束: 1. 修复前必须先复现bug 2. 所有现有测试必须全部通过 3. 必须为该bug新增专门的测试用例 4.只修改与bug直接相关的代码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
我发现了如下的几个bug,请你帮我修正
这个项目是基于Python 2编写的,在Python 3环境下几乎所有使用 print 语句的地方都会报错,因为Python 3要求 print() 必须带括号。
Python 3不再支持 except Exception, msg 语法,必须使用 except Exception as msg 。
PEP 8推荐使用 is None 和 is not None 来比较None对象,使用 == None 在某些情况下可能导致意外行为。
Python 3中exec是函数,必须写成 exec(...) 。
很多地方使用 open() 但没有确保文件被关闭:
约束: