You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pylint allows the operation (since both bytes and strings support containment checks, and those are the two possible return types from check_output)
Software version
The error was found on Debian 9 with pylint 2.3.1, astroid 2.2.5, and Python 3.5.3.
Additional info
import subprocess
bytes_data = subprocess.check_output(['echo', 'hello']);
text_data = subprocess.check_output(['echo', 'hello'], universal_newlines=True);
print(b'bytes' in bytes_data) # Prints False
print('text' in text_data) # Prints False
'text' in bytes_data # Runtime TypeError
b'bytes' in text_data # Runtime TypeError
$ pylint -E check_pylint_e1135.py
************* Module check_pylint_e1135
check_pylint_e1135.py:6:18: E1135: Value 'bytes_data' doesn't support membership test (unsupported-membership-test)
check_pylint_e1135.py:7:16: E1135: Value 'text_data' doesn't support membership test (unsupported-membership-test)
check_pylint_e1135.py:8:10: E1135: Value 'bytes_data' doesn't support membership test (unsupported-membership-test)
check_pylint_e1135.py:9:12: E1135: Value 'text_data' doesn't support membership test (unsupported-membership-test)
The text was updated successfully, but these errors were encountered:
ncoghlan
changed the title
Incorrect "unsupported-membership-test" warning on subprocess.check-output
Incorrect "unsupported-membership-test" warning on subprocess.check_output
Aug 25, 2019
ncoghlan
changed the title
Incorrect "unsupported-membership-test" warning on subprocess.check_output
Incorrect "unsupported-membership-test" error on subprocess.check_output
Aug 25, 2019
(Migrating from pylint-dev/pylint#3045 (comment))
Steps to reproduce
Current behavior
pylint reports E1135 (unsupported-membership-test)
Expected behavior
pylint allows the operation (since both bytes and strings support containment checks, and those are the two possible return types from
check_output
)Software version
The error was found on Debian 9 with pylint 2.3.1, astroid 2.2.5, and Python 3.5.3.
Additional info
The text was updated successfully, but these errors were encountered: