Skip to content

Commit 4833908

Browse files
fix: Respect hard stack size limit and swallow limit change exception. (#558)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent d805241 commit 4833908

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bigframes/pandas/__init__.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,13 @@ def to_datetime(
714714
# which the applicable limit is now hard coded. See:
715715
# https://github.com/python/cpython/issues/112282
716716
sys.setrecursionlimit(max(10000000, sys.getrecursionlimit()))
717-
resource.setrlimit(
718-
resource.RLIMIT_STACK, (resource.RLIM_INFINITY, resource.RLIM_INFINITY)
719-
)
717+
718+
soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_STACK)
719+
if soft_limit < hard_limit or hard_limit == resource.RLIM_INFINITY:
720+
try:
721+
resource.setrlimit(resource.RLIMIT_STACK, (hard_limit, hard_limit))
722+
except Exception:
723+
pass
720724

721725
# Use __all__ to let type checkers know what is part of the public API.
722726
__all___ = [

0 commit comments

Comments
 (0)