Skip to content

add tobytes to support numpy>=2.3.0 #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OpenGL/GL/ARB/shader_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ def glGetActiveUniformARB(baseOperation,program, index,bufSize=None):
bufSize = int(glGetObjectParameterivARB( program, GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB))
if index < max_index and index >= 0:
length,name,size,type = baseOperation( program, index, bufSize )
if hasattr(name,'tostring'):
name = name.tostring().rstrip(b'\000')
if hasattr(name,'tobytes'):
name = name.tobytes().rstrip(b'\000')
elif hasattr(name,'value'):
name = name.value
return name,size,type
Expand Down
4 changes: 2 additions & 2 deletions OpenGL/GL/ARB/vertex_shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def glGetActiveAttribARB(baseOperation, program, index):
length = int(glGetObjectParameterivARB( program, GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB))
if index < max_index and index >= 0 and length > 0:
length,name,size,type = baseOperation( program, index )
if hasattr(name,'tostring'):
name = name.tostring().rstrip(b'\000')
if hasattr(name,'tobytes'):
name = name.tobytes().rstrip(b'\000')
elif hasattr(name,'value'):
name = name.value
return name,size,type
Expand Down
8 changes: 4 additions & 4 deletions OpenGL/GL/VERSION/GL_2_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ def glGetActiveAttrib(baseOperation, program, index, bufSize=None,*args):
if bufSize <= 0:
raise RuntimeError( 'Active attribute length reported', bufsize )
name,size,type = baseOperation( program, index, bufSize, *args )[1:]
if hasattr(name,'tostring'):
name = name.tostring().rstrip(b'\000')
if hasattr(name,'tobytes'):
name = name.tobytes().rstrip(b'\000')
elif hasattr(name,'value'):
name = name.value
return name,size,type
Expand Down Expand Up @@ -408,8 +408,8 @@ def glGetActiveUniform(baseOperation,program, index,bufSize=None,*args):
bufSize = int(glGetProgramiv( program, GL_ACTIVE_UNIFORM_MAX_LENGTH))
if index < max_index and index >= 0:
length,name,size,type = baseOperation( program, index, bufSize, *args )
if hasattr(name,'tostring'):
name = name.tostring().rstrip(b'\000')
if hasattr(name,'tobytes'):
name = name.tobytes().rstrip(b'\000')
elif hasattr(name,'value'):
name = name.value
return name,size,type
Expand Down
8 changes: 4 additions & 4 deletions OpenGL/GLES2/VERSION/GLES2_2_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ def glGetActiveUniform(baseOperation,program, index,bufSize=None,*args):
bufSize = int(glGetProgramiv( program, GL_ACTIVE_UNIFORM_MAX_LENGTH))
if index < max_index and index >= 0:
length,name,size,type = baseOperation( program, index, bufSize, *args )
if hasattr(name,'tostring'):
name = name.tostring().rstrip(b'\000')
if hasattr(name,'tobytes'):
name = name.tobytes().rstrip(b'\000')
elif hasattr(name,'value'):
name = name.value
return name,size,type
Expand Down Expand Up @@ -383,8 +383,8 @@ def glGetActiveAttrib(baseOperation, program, index, bufSize=None,*args):
if bufSize <= 0:
raise RuntimeError( 'Active attribute length reported', bufsize )
name,size,type = baseOperation( program, index, bufSize, *args )[1:]
if hasattr(name,'tostring'):
name = name.tostring().rstrip(b'\000')
if hasattr(name,'tobytes'):
name = name.tobytes().rstrip(b'\000')
elif hasattr(name,'value'):
name = name.value
return name,size,type
Expand Down
4 changes: 2 additions & 2 deletions OpenGL/arrays/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def asArray(self, value, typeCode=None):
"""Convert given value to an array value of given typeCode"""
if isinstance(value, bytes):
return value
elif hasattr(value, 'tostring'):
return value.tostring()
elif hasattr(value, 'tobytes'):
return value.tobytes()
elif hasattr(value, 'raw'):
return value.raw
# could convert types to string here, but we're not registered for
Expand Down