From dc1432177fa0be9012729cef3b5bd3690e8f8175 Mon Sep 17 00:00:00 2001 From: Brock Date: Mon, 10 Nov 2025 13:32:01 -0800 Subject: [PATCH 1/2] PERF: missing break in maybe_convert_objects --- pandas/_libs/lib.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/_libs/lib.pyx b/pandas/_libs/lib.pyx index 5b975d14475d5..de1a5574531e3 100644 --- a/pandas/_libs/lib.pyx +++ b/pandas/_libs/lib.pyx @@ -2725,6 +2725,7 @@ def maybe_convert_objects(ndarray[object] objects, # e.g. test_out_of_s_bounds_datetime64 seen.object_ = True break + break else: seen.object_ = True break From dbe89de5f7b80ee6b50df945932b168417aecc41 Mon Sep 17 00:00:00 2001 From: Brock Date: Mon, 10 Nov 2025 14:23:49 -0800 Subject: [PATCH 2/2] 4 breaks down to 1 --- pandas/_libs/lib.pyx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pandas/_libs/lib.pyx b/pandas/_libs/lib.pyx index de1a5574531e3..7f1b772f38185 100644 --- a/pandas/_libs/lib.pyx +++ b/pandas/_libs/lib.pyx @@ -2716,7 +2716,6 @@ def maybe_convert_objects(ndarray[object] objects, if convert_non_numeric: if getattr(val, "tzinfo", None) is not None: seen.datetimetz_ = True - break else: seen.datetime_ = True try: @@ -2724,11 +2723,9 @@ def maybe_convert_objects(ndarray[object] objects, except OutOfBoundsDatetime: # e.g. test_out_of_s_bounds_datetime64 seen.object_ = True - break - break else: seen.object_ = True - break + break elif is_period_object(val): if convert_non_numeric: seen.period_ = True