From c4db57ea8c684471d374047d54f4c184be83ad9d Mon Sep 17 00:00:00 2001
From: Robert Haase <haesleinhuepf@users.noreply.github.com>
Date: Mon, 16 Aug 2021 18:26:38 +0200
Subject: [PATCH] make _new_with_changes function also work in a subclass
 (#509)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* make function also work in a subclass

* Use __class__ instead of type()

Co-authored-by: Andreas Klöckner <inform@tiker.net>

Co-authored-by: Andreas Klöckner <inform@tiker.net>
---
 pyopencl/array.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyopencl/array.py b/pyopencl/array.py
index fb80f2d7..905d8583 100644
--- a/pyopencl/array.py
+++ b/pyopencl/array.py
@@ -636,7 +636,7 @@ class Array:
         else:
             events = self.events
 
-        return Array(None, shape, dtype, allocator=allocator,
+        return self.__class__(None, shape, dtype, allocator=allocator,
                 strides=strides, data=data, offset=offset,
                 events=events,
                 _fast=fast, _context=self.context, _queue=queue, _size=size)
-- 
GitLab