pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.29k stars 1.13k forks source link

``cannot serialize '_io.TextIOWrapper' object'`` with ``--jobs 0`` #6435

Closed gorricho closed 2 years ago

gorricho commented 2 years ago

Bug description

When using the option --jobs 0, pylint crashes with the following error

Configuration

No response

Command used

pylint -j 0 blah

Pylint output

Traceback (most recent call last):
  File "/blah/.tox/blah/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/blah/.tox/blah/lib/python3.7/site-packages/pylint/__init__.py", line 22, in run_pylint
    PylintRun(argv or sys.argv[1:])
  File "/blah/.tox/blah/lib/python3.7/site-packages/pylint/lint/run.py", line 358, in __init__
    linter.check(args)
  File "/blah/.tox/blah/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 1081, in check
    files_or_modules,
  File "/blah/.tox/blah/lib/python3.7/site-packages/pylint/lint/parallel.py", line 148, in check_parallel
    jobs, initializer=initializer, initargs=[dill.dumps(linter)]
  File "/blah/.tox/blah/lib/python3.7/site-packages/dill/_dill.py", line 304, in dumps
    dump(obj, file, protocol, byref, fmode, recurse, **kwds)#, strictio)
  File "/blah/.tox/blah/lib/python3.7/site-packages/dill/_dill.py", line 276, in dump
    Pickler(file, protocol, **_kwds).dump(obj)
  File "/blah/.tox/blah/lib/python3.7/site-packages/dill/_dill.py", line 498, in dump
    StockPickler.dump(self, obj)
  File "/usr/lib/python3.7/pickle.py", line 437, in dump
    self.save(obj)
  File "/usr/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)
  File "/usr/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)
  File "/usr/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/blah/.tox/blah/lib/python3.7/site-packages/dill/_dill.py", line 990, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/usr/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())
  File "/usr/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)
  File "/usr/lib/python3.7/pickle.py", line 549, in save
    self.save_reduce(obj=obj, *rv)
  File "/usr/lib/python3.7/pickle.py", line 662, in save_reduce
    save(state)
  File "/usr/lib/python3.7/pickle.py", line 504, in save
    f(self, obj) # Call unbound method with explicit self
  File "/blah/.tox/blah/lib/python3.7/site-packages/dill/_dill.py", line 990, in save_module_dict
    StockPickler.save_dict(pickler, obj)
  File "/usr/lib/python3.7/pickle.py", line 859, in save_dict
    self._batch_setitems(obj.items())
  File "/usr/lib/python3.7/pickle.py", line 885, in _batch_setitems
    save(v)
  File "/usr/lib/python3.7/pickle.py", line 524, in save
    rv = reduce(self.proto)
TypeError: cannot serialize '_io.TextIOWrapper' object

Expected behavior

Pylint should finish its analysis successfully, not causing any exception

Pylint version

pylint 2.13.7
astroid 2.11.3
Python 3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0]

OS / Environment

No response

Additional dependencies

No response

DanielNoord commented 2 years ago

Duplicate of #6012.

gorricho commented 2 years ago

Thanks, and sorry, I will track that issue