Skip to content

Commit b8099e3

Browse files
committed
add tobytes to support numpy>=2.3.0
1 parent 5dfca47 commit b8099e3

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

OpenGL/GL/ARB/shader_objects.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ def glGetActiveUniformARB(baseOperation,program, index,bufSize=None):
250250
length,name,size,type = baseOperation( program, index, bufSize )
251251
if hasattr(name,'tostring'):
252252
name = name.tostring().rstrip(b'\000')
253+
elif hasattr(name, 'tobytes'):
254+
name = name.tobytes().rstrip(b'\000')
253255
elif hasattr(name,'value'):
254256
name = name.value
255257
return name,size,type

OpenGL/GL/ARB/vertex_shader.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ def glGetActiveAttribARB(baseOperation, program, index):
137137
length,name,size,type = baseOperation( program, index )
138138
if hasattr(name,'tostring'):
139139
name = name.tostring().rstrip(b'\000')
140+
elif hasattr(name, 'tobytes'):
141+
name = name.tobytes().rstrip(b'\000')
140142
elif hasattr(name,'value'):
141143
name = name.value
142144
return name,size,type

OpenGL/GL/VERSION/GL_2_0.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ def glGetActiveAttrib(baseOperation, program, index, bufSize=None,*args):
381381
name,size,type = baseOperation( program, index, bufSize, *args )[1:]
382382
if hasattr(name,'tostring'):
383383
name = name.tostring().rstrip(b'\000')
384+
elif hasattr(name, 'tobytes'):
385+
name = name.tobytes().rstrip(b'\000')
384386
elif hasattr(name,'value'):
385387
name = name.value
386388
return name,size,type
@@ -410,6 +412,8 @@ def glGetActiveUniform(baseOperation,program, index,bufSize=None,*args):
410412
length,name,size,type = baseOperation( program, index, bufSize, *args )
411413
if hasattr(name,'tostring'):
412414
name = name.tostring().rstrip(b'\000')
415+
elif hasattr(name, 'tobytes'):
416+
name = name.tobytes().rstrip(b'\000')
413417
elif hasattr(name,'value'):
414418
name = name.value
415419
return name,size,type

OpenGL/GLES2/VERSION/GLES2_2_0.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ def glGetActiveUniform(baseOperation,program, index,bufSize=None,*args):
355355
length,name,size,type = baseOperation( program, index, bufSize, *args )
356356
if hasattr(name,'tostring'):
357357
name = name.tostring().rstrip(b'\000')
358+
elif hasattr(name, 'tobytes'):
359+
name = name.tobytes().rstrip(b'\000')
358360
elif hasattr(name,'value'):
359361
name = name.value
360362
return name,size,type
@@ -385,6 +387,8 @@ def glGetActiveAttrib(baseOperation, program, index, bufSize=None,*args):
385387
name,size,type = baseOperation( program, index, bufSize, *args )[1:]
386388
if hasattr(name,'tostring'):
387389
name = name.tostring().rstrip(b'\000')
390+
elif hasattr(name, 'tobytes'):
391+
name = name.tobytes().rstrip(b'\000')
388392
elif hasattr(name,'value'):
389393
name = name.value
390394
return name,size,type

OpenGL/arrays/strings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def asArray(self, value, typeCode=None):
5858
return value
5959
elif hasattr(value, 'tostring'):
6060
return value.tostring()
61+
elif hasattr(value, 'tobytes'):
62+
return value.tobytes()
6163
elif hasattr(value, 'raw'):
6264
return value.raw
6365
# could convert types to string here, but we're not registered for

0 commit comments

Comments
 (0)