New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[easy] undefined name in Lib/test/mock_socket.py #84642
Comments
pyflakes found the following issues in sendall(): Lib/test/mock_socket.py:95:21 undefined name 'data' Code: def sendall(self, buffer, flags=None):
self.last = data
self.output.append(data)
return len(data)
def send(self, data, flags=None):
self.last = data
self.output.append(data)
return len(data) I guess that sendall() buffer parameter should be renamed to data. |
Another one: Lib/test/test_frame.py:53:17 undefined name 'inner' I guess that self.inner() should be used instead of inner(). In practice, it's dead code, but fixing it would make pyflakes happier :-) |
Another one: Lib/test/test_json/test_recursion.py:55:24 undefined name 'pyjson' Code: def test_defaultrecursion(self):
class RecursiveJSONEncoder(self.json.JSONEncoder):
recurse = False
def default(self, o):
if o is JSONTestObject:
if self.recurse:
return [JSONTestObject]
else:
return 'JSONTestObject'
return pyjson.JSONEncoder.default(o) Here I'm not sure. *Maybe* pyjson.JSONEncoder should be replaced with self.json.JSONEncoder? |
Another one: Lib/unittest/test/test_program.py:191:40 undefined name 'hasInstallHandler' Code: def testBufferCatchFailfast(self):
program = self.program
for arg, attr in (('buffer', 'buffer'), ('failfast', 'failfast'),
('catch', 'catchbreak')):
if attr == 'catch' and not hasInstallHandler:
continue
... attr is never equal to 'catch' and so it's just dead code which can be removed. |
Hello, |
@vstinner https://github.com/python/cpython/blob/3.8/Lib/test/mock_socket.py#L95 |
It's deadcode, I don't think that it's worth it. But it's up to you. If you consider that it's worth it, go ahead and backport the fix. |
Thanks for the fix Furkan Önder! |
You are welcome :=) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: