Skip to content

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

Closed
@ikedaosushi

Description

@ikedaosushi
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions