Skip to content

Commit c32c4f0

Browse files
author
Release Manager
committed
gh-35760: gap: adapt get_global to use official libgap API URL: #35760 Reported by: Max Horn Reviewer(s): Frédéric Chapoton
2 parents 643bb2c + 7d97f68 commit c32c4f0

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/sage/libs/gap/libgap.pyx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ from .gap_includes cimport *
217217
from .util cimport *
218218
from .element cimport *
219219

220+
from sage.cpython.string cimport str_to_bytes
220221
from sage.structure.parent cimport Parent
221222
from sage.structure.element cimport Vector
222223
from sage.rings.integer_ring import ZZ
@@ -478,9 +479,7 @@ class Gap(Parent):
478479
1
479480
sage: libgap.unset_global('FooBar')
480481
sage: libgap.get_global('FooBar')
481-
Traceback (most recent call last):
482-
...
483-
GAPError: Error, VAL_GVAR: No value bound to FooBar
482+
NULL
484483
"""
485484
is_bound = self.function_factory('IsBoundGlobal')
486485
bind_global = self.function_factory('BindGlobal')
@@ -503,9 +502,7 @@ class Gap(Parent):
503502
1
504503
sage: libgap.unset_global('FooBar')
505504
sage: libgap.get_global('FooBar')
506-
Traceback (most recent call last):
507-
...
508-
GAPError: Error, VAL_GVAR: No value bound to FooBar
505+
NULL
509506
"""
510507
is_readonlyglobal = self.function_factory('IsReadOnlyGlobal')
511508
make_readwrite = self.function_factory('MakeReadWriteGlobal')
@@ -535,12 +532,9 @@ class Gap(Parent):
535532
1
536533
sage: libgap.unset_global('FooBar')
537534
sage: libgap.get_global('FooBar')
538-
Traceback (most recent call last):
539-
...
540-
GAPError: Error, VAL_GVAR: No value bound to FooBar
535+
NULL
541536
"""
542-
value_global = self.function_factory('ValueGlobal')
543-
return value_global(variable)
537+
return make_any_gap_element(self, GAP_ValueGlobalVariable(str_to_bytes(variable)))
544538

545539
def global_context(self, variable, value):
546540
"""

0 commit comments

Comments
 (0)