Skip to content

BUG: pylint with merge of pandas==1.1.5 raises a RecursionError #38355

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

Closed
2 of 3 tasks
ikedaosushi opened this issue Dec 8, 2020 · 3 comments
Closed
2 of 3 tasks

BUG: pylint with merge of pandas==1.1.5 raises a RecursionError #38355

ikedaosushi opened this issue Dec 8, 2020 · 3 comments
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@ikedaosushi
Copy link
Contributor

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

pip install pandas==1.1.5 pylint 
# pandas_merge_sample.py
import pandas as pd

pd.merge(None, None)
pylint pandas_merge_sample.py

Problem description

Performing pylint on Python codes that include pandas.merge makes a RecursionError like below.
I'm not sure the error was caused by pandas itself, but at least I can say pylint with pandas==1.1.4 doesn't raise the error, and pylint with pandas==1.1.5 raises.

For pylint side, an issue about it was already opened, so I've opened it just in case for those who will face the same problem.
pylint-dev/pylint#3969

I might think the commit can be related to the problem.
e99e5ab#diff-7c4c2c4161d35fe8d1d71cc86b45abcc642271069f05cf860d9195a304d2ed33

   ...
    res = next(generator)
  File "/private/tmp/pandas-pylint/venv/lib/python3.8/site-packages/astroid/inference.py", line 293, in infer_attribute
    for owner in self.expr.infer(context):
  File "/private/tmp/pandas-pylint/venv/lib/python3.8/site-packages/astroid/util.py", line 160, in limit_inference
    yield from islice(iterator, size)
  File "/private/tmp/pandas-pylint/venv/lib/python3.8/site-packages/astroid/context.py", line 113, in cache_generator
    for result in generator:
  File "/private/tmp/pandas-pylint/venv/lib/python3.8/site-packages/astroid/decorators.py", line 132, in raise_if_nothing_inferred
    yield next(generator)
  File "/private/tmp/pandas-pylint/venv/lib/python3.8/site-packages/astroid/decorators.py", line 93, in wrapped
    generator = _func(node, context, **kwargs)
  File "/private/tmp/pandas-pylint/venv/lib/python3.8/site-packages/astroid/inference.py", line 203, in infer_name
    context = contextmod.copy_context(context)
  File "/private/tmp/pandas-pylint/venv/lib/python3.8/site-packages/astroid/context.py", line 155, in copy_context
    return context.clone()
  File "/private/tmp/pandas-pylint/venv/lib/python3.8/site-packages/astroid/context.py", line 102, in clone
    clone = InferenceContext(self.path, inferred=self.inferred)
RecursionError: maximum recursion depth exceeded

Expected Output

No error will be raised.

Output of pd.show_versions()

INSTALLED VERSIONS
------------------
commit           : b5958ee1999e9aead1938c0bba2b674378807b3d
python           : 3.8.2.final.0
python-bits      : 64
OS               : Darwin
OS-release       : 19.3.0
Version          : Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64
machine          : x86_64
processor        : i386
byteorder        : little
LC_ALL           : en_US.UTF-8
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

pandas           : 1.1.5
numpy            : 1.19.4
pytz             : 2020.4
dateutil         : 2.8.1
pip              : 19.2.3
setuptools       : 41.2.0
Cython           : None
pytest           : None
hypothesis       : None
sphinx           : None
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : None
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : None
IPython          : None
pandas_datareader: None
bs4              : None
bottleneck       : None
fsspec           : None
fastparquet      : None
gcsfs            : None
matplotlib       : None
numexpr          : None
odfpy            : None
openpyxl         : None
pandas_gbq       : None
pyarrow          : None
pytables         : None
pyxlsb           : None
s3fs             : None
scipy            : None
sqlalchemy       : None
tables           : None
tabulate         : None
xarray           : None
xlrd             : None
xlwt             : None
numba            : None
@ikedaosushi ikedaosushi added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 8, 2020
@ikedaosushi ikedaosushi changed the title BUG: pylint with merging of pandas==1.1.5 raises a RecursionError BUG: pylint with merge of pandas==1.1.5 raises a RecursionError Dec 8, 2020
@theholy7
Copy link

theholy7 commented Dec 8, 2020

I just spent hours to find out that pandas was causing this.

@ikedaosushi
Copy link
Contributor Author

This issue is caused by astroid , which is a dependency of pylint , and the root cause has been fixed on astroid 's master already. However the last release of astroid is 2020-04-27, so we have to wait a new release of astroid, or specify the master of astroid in our requirement.txt.
pylint-dev/astroid#804

@ikedaosushi
Copy link
Contributor Author

I found out the issue isn't related to pandas , I'll close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants