@@ -583,20 +583,6 @@ def _maybe_copy(self, using_cow: bool, inplace: bool) -> Self:
583
583
blk = self if inplace else self .copy ()
584
584
return blk
585
585
586
- @final
587
- def _get_values_and_refs (self , using_cow , inplace ):
588
- if using_cow :
589
- if inplace and not self .refs .has_reference ():
590
- refs = self .refs
591
- new_values = self .values
592
- else :
593
- refs = None
594
- new_values = self .values .copy ()
595
- else :
596
- refs = None
597
- new_values = self .values if inplace else self .values .copy ()
598
- return new_values , refs
599
-
600
586
@final
601
587
def _get_refs_and_copy (self , using_cow : bool , inplace : bool ):
602
588
refs = None
@@ -738,11 +724,10 @@ def _replace_regex(
738
724
739
725
rx = re .compile (to_replace )
740
726
741
- new_values , refs = self ._get_values_and_refs (using_cow , inplace )
727
+ block = self ._maybe_copy (using_cow , inplace )
742
728
743
- replace_regex (new_values , rx , value , mask )
729
+ replace_regex (block . values , rx , value , mask )
744
730
745
- block = self .make_block (new_values , refs = refs )
746
731
return block .convert (copy = False , using_cow = using_cow )
747
732
748
733
@final
0 commit comments