When run in parallel mode pylint now pickles the data passed to subprocesses with the dill package. The dill package has therefore been added as a dependency.
Pylint fails to pickle pylint.lint.pylinter.PyLinter.reporter, which is a pylama Reporter object:
Traceback (most recent call last):
File "/Users/*/.local/share/virtualenvs/*/bin/pylama", line 8, in <module>
sys.exit(shell())
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/pylama/main.py", line 115, in shell
errors = check_paths(
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/pylama/main.py", line 68, in check_paths
errors += run(path=path, code=code, rootdir=rootdir, options=options)
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/pylama/core.py", line 36, in run
linter.run_check(ctx)
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/pylama/lint/pylama_pylint.py", line 69, in run_check
Run([ctx.temp_filename] + args, reporter=reporter, exit=False)
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/pylint/lint/run.py", line 358, in __init__
linter.check(args)
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1077, in check
check_parallel(
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/pylint/lint/parallel.py", line 149, in check_parallel
jobs, initializer=initializer, initargs=[dill.dumps(linter)]
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/dill/_dill.py", line 304, in dumps
dump(obj, file, protocol, byref, fmode, recurse, **kwds)#, strictio)
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/dill/_dill.py", line 276, in dump
Pickler(file, protocol, **_kwds).dump(obj)
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/dill/_dill.py", line 498, in dump
StockPickler.dump(self, obj)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 485, in dump
self.save(obj)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 601, in save
self.save_reduce(obj=obj, *rv)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 715, in save_reduce
save(state)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 558, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/dill/_dill.py", line 990, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 969, in save_dict
self._batch_setitems(obj.items())
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 995, in _batch_setitems
save(v)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 601, in save
self.save_reduce(obj=obj, *rv)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 685, in save_reduce
save(cls)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 558, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/*/.local/share/virtualenvs/*/lib/python3.8/site-packages/dill/_dill.py", line 1440, in save_type
StockPickler.save_global(pickler, obj, name=name)
File "/Users/*/.pyenv/versions/3.8.2/lib/python3.8/pickle.py", line 1068, in save_global
raise PicklingError(
_pickle.PicklingError: Can't pickle <class 'pylama.lint.pylama_pylint.Linter.run_check.<locals>.Reporter'>: it's not found as pylama.lint.pylama_pylint.Linter.run_check.<locals>.Reporter
Suggestions
Moving Reporter from Linter.run_check to Linter will resolve the problem.
Context
Python version == 3.8.2 Pylama version == 8.3.8 Pylint version >= 2.13.0
Problem
From the Pylint changelog:
Pylint fails to pickle
pylint.lint.pylinter.PyLinter.reporter
, which is a pylamaReporter
object:Suggestions
Reporter
fromLinter.run_check
toLinter
will resolve the problem.pylint<=2.12.2
for the time being.