From 29f6618af1f718beeefb33aa67b7c83a3fd1bf78 Mon Sep 17 00:00:00 2001 From: saikarna913 Date: Wed, 20 Nov 2024 15:29:36 +0530 Subject: [PATCH] Update path.py --- lib/matplotlib/path.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 5f5a0f3de423..e54b2b01ade2 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -282,9 +282,21 @@ def __deepcopy__(self, memo=None): readonly, even if the source `Path` is. """ # Deepcopying arrays (vertices, codes) strips the writeable=False flag. - p = copy.deepcopy(super(), memo) - p._readonly = False - return p + cls = self.__class__ + new_instance = cls.__new__(cls) + + # Add the new instance to the memo dictionary to handle circular references + if memo is None: + memo = {} + memo[id(self)] = new_instance + + # Deepcopy the attributes explicitly + new_instance.vertices = copy.deepcopy(self.vertices, memo) + new_instance.codes = copy.deepcopy(self.codes, memo) + new_instance._readonly = False + + return new_instance + deepcopy = __deepcopy__ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy