Skip to content

Commit 21bb63e

Browse files
recursion test prints more info
1 parent 9868119 commit 21bb63e

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

bigframes/operations/aggregations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def output_type(self, *input_types: dtypes.ExpressionType) -> dtypes.ExpressionT
205205
return dtypes.TIMEDELTA_DTYPE
206206

207207
if dtypes.is_numeric(input_types[0]):
208-
if pd.api.types.is_bool_dtype(input_types[0]):
208+
if pd.api.types.is_bool_dtype(input_types[0]): # type: ignore
209209
return dtypes.INT_DTYPE
210210
return input_types[0]
211211

@@ -224,7 +224,7 @@ def output_type(self, *input_types: dtypes.ExpressionType) -> dtypes.ExpressionT
224224
# These will change if median is changed to exact implementation.
225225
if not dtypes.is_orderable(input_types[0]):
226226
raise TypeError(f"Type {input_types[0]} is not orderable")
227-
if pd.api.types.is_bool_dtype(input_types[0]):
227+
if pd.api.types.is_bool_dtype(input_types[0]): # type: ignore
228228
return dtypes.INT_DTYPE
229229
else:
230230
return input_types[0]

tests/system/small/test_dataframe.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5754,18 +5754,28 @@ def test_df_dot_operator_series(
57545754
)
57555755

57565756

5757-
# TODO(tswast): We may be able to re-enable this test after we break large
5758-
# queries up in https://github.com/googleapis/python-bigquery-dataframes/pull/427
5759-
@pytest.mark.skipif(
5760-
sys.version_info >= (3, 12),
5761-
# See: https://github.com/python/cpython/issues/112282
5762-
reason="setrecursionlimit has no effect on the Python C stack since Python 3.12.",
5763-
)
57645757
def test_recursion_limit(scalars_df_index):
57655758
scalars_df_index = scalars_df_index[["int64_too", "int64_col", "float64_col"]]
57665759
for i in range(400):
57675760
scalars_df_index = scalars_df_index + 4
5768-
scalars_df_index.to_pandas()
5761+
try:
5762+
scalars_df_index.to_pandas()
5763+
except Exception:
5764+
import sys
5765+
5766+
try:
5767+
import resource
5768+
except ImportError:
5769+
# resource is only available on Unix-like systems.
5770+
# https://docs.python.org/3/library/resource.html
5771+
resource = None # type: ignore
5772+
print(f"recursion limit: {sys.getrecursionlimit()}")
5773+
if resource is not None:
5774+
soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_STACK)
5775+
print(f"stack limits: {soft_limit}, {hard_limit}")
5776+
else:
5777+
print("resource module not available")
5778+
raise
57695779

57705780

57715781
@pytest.mark.skipif(

0 commit comments

Comments
 (0)