Skip to content

Bug in ARR: Pandas Dataframes causes a infinite recursion when inspect.members is run on it #40

@RandoNandoz

Description

@RandoNandoz

When using the ARR on a dataframe, it causes infinite recursion due to recursive calls to self._reconstruct_object_instance.

Image

Stacktrace:


/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/bin/python /Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py --target test_wrapper.py::TestForWrapper.test_wrapper_generated_test -- --jb-swapdiff 
Testing started at 1:14 p.m. ...
Launching pytest with arguments --jb-swapdiff test_wrapper.py::TestForWrapper::test_wrapper_generated_test --no-header --no-summary -q in /Users/randyzhu/Desktop/2025S-Explotest/explotest/tests

============================= test session starts ==============================
collecting ... collected 2 items

test_wrapper.py::TestForWrapper::test_wrapper_generated_test[<lambda>0] 
test_wrapper.py::TestForWrapper::test_wrapper_generated_test[<lambda>1] 

================= 1 failed, 1 passed, 2953 warnings in 26.83s ==================
/Users/randyzhu/Desktop/2025S-Explotest/explotest/test_data
Out[8]: np.float64(82.99999113727489)
PASSED [ 50%]/Users/randyzhu/Desktop/2025S-Explotest/explotest/test_data
Out[8]: np.float64(82.99999113727489)
FAILED [100%]
tests/test_wrapper.py:70 (TestForWrapper.test_wrapper_generated_test[<lambda>1])
self = <test_wrapper.TestForWrapper object at 0x10d2f4e10>
run_program = <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x108bc1310>

    def test_wrapper_generated_test(self, run_program):
>       result: GeneratedTest = generate_tests_wrapper(run_program)()

/Users/randyzhu/Desktop/2025S-Explotest/explotest/tests/test_wrapper.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/ipy/wrapper.py:70: in generate_tests
    generated_test = tg.generate(ipy_frontend.function_params_and_args())
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/test_generator.py:60: in generate
    asts = self.reconstructor.asts(bindings)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/reconstructor.py:21: in asts
    fixtures.append(self._ast(parameter, argument))
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:26: in _ast
    return self._reconstruct_object_instance(parameter, argument)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:103: in _reconstruct_object_instance
[1000+ lines]
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:103: in _reconstruct_object_instance
    self._reconstruct_object_instance(attribute_name, attribute_value)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:103: in _reconstruct_object_instance
    self._reconstruct_object_instance(attribute_name, attribute_value)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:103: in _reconstruct_object_instance
    self._reconstruct_object_instance(attribute_name, attribute_value)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:103: in _reconstruct_object_instance
    self._reconstruct_object_instance(attribute_name, attribute_value)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:103: in _reconstruct_object_instance
    self._reconstruct_object_instance(attribute_name, attribute_value)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:103: in _reconstruct_object_instance
    self._reconstruct_object_instance(attribute_name, attribute_value)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:103: in _reconstruct_object_instance
    self._reconstruct_object_instance(attribute_name, attribute_value)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/src/explotest/argument_reconstruction_reconstructor.py:49: in _reconstruct_object_instance
    attributes = inspect.getmembers(obj, predicate=lambda x: not callable(x))
/opt/homebrew/Cellar/python@3.13/3.13.3_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/inspect.py:624: in getmembers
    return _getmembers(object, predicate, getattr)
/opt/homebrew/Cellar/python@3.13/3.13.3_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/inspect.py:602: in _getmembers
    value = getter(object, key)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/pandas/core/base.py:1087: in is_unique
    return self.nunique(dropna=False) == len(self)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/pandas/core/base.py:1063: in nunique
    uniqs = self.unique()
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/pandas/core/series.py:2407: in unique
    return super().unique()
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/pandas/core/base.py:1025: in unique
    result = algorithms.unique1d(values)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/pandas/core/algorithms.py:401: in unique
    return unique_with_mask(values)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/pandas/core/algorithms.py:436: in unique_with_mask
    hashtable, values = _get_hashtable_algo(values)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/pandas/core/algorithms.py:275: in _get_hashtable_algo
    ndtype = _check_object_for_strings(values)
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/pandas/core/algorithms.py:292: in _check_object_for_strings
    ndtype = values.dtype.name
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/numpy/_core/_dtype.py:367: in _name_get
    if _name_includes_bit_suffix(dtype):
/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/numpy/_core/_dtype.py:343: in _name_includes_bit_suffix
    elif np.issubdtype(dtype, np.flexible) and _isunsized(dtype):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

arg1 = dtype('float64'), arg2 = <class 'numpy.flexible'>

    @set_module('numpy')
    def issubdtype(arg1, arg2):
        r"""
        Returns True if first argument is a typecode lower/equal in type hierarchy.
    
        This is like the builtin :func:`issubclass`, but for `dtype`\ s.
    
        Parameters
        ----------
        arg1, arg2 : dtype_like
            `dtype` or object coercible to one
    
        Returns
        -------
        out : bool
    
        See Also
        --------
        :ref:`arrays.scalars` : Overview of the numpy type hierarchy.
    
        Examples
        --------
        `issubdtype` can be used to check the type of arrays:
    
        >>> ints = np.array([1, 2, 3], dtype=np.int32)
        >>> np.issubdtype(ints.dtype, np.integer)
        True
        >>> np.issubdtype(ints.dtype, np.floating)
        False
    
        >>> floats = np.array([1, 2, 3], dtype=np.float32)
        >>> np.issubdtype(floats.dtype, np.integer)
        False
        >>> np.issubdtype(floats.dtype, np.floating)
        True
    
        Similar types of different sizes are not subdtypes of each other:
    
        >>> np.issubdtype(np.float64, np.float32)
        False
        >>> np.issubdtype(np.float32, np.float64)
        False
    
        but both are subtypes of `floating`:
    
        >>> np.issubdtype(np.float64, np.floating)
        True
        >>> np.issubdtype(np.float32, np.floating)
        True
    
        For convenience, dtype-like objects are allowed too:
    
        >>> np.issubdtype('S1', np.bytes_)
        True
        >>> np.issubdtype('i4', np.signedinteger)
        True
    
        """
>       if not issubclass_(arg1, generic):
E       RecursionError: maximum recursion depth exceeded

/Users/randyzhu/Desktop/2025S-Explotest/explotest/.venv/lib/python3.13/site-packages/numpy/_core/numerictypes.py:529: RecursionError

Process finished with exit code 1

Associated test: test_wrapper_generated_test

Metadata

Metadata

Assignees

Labels

p3Low priority issue

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions