Wrapper for Singular’s Rings

AUTHORS:

  • Martin Albrecht (2009-07): initial implementation

  • Kwankyu Lee (2010-06): added matrix term order support

  • Miguel Marco (2021): added transcendental extensions over Q

sage.libs.singular.ring.currRing_wrapper()[source]

Return a wrapper for the current ring, for use in debugging ring_refcount_dict.

EXAMPLES:

sage: from sage.libs.singular.ring import currRing_wrapper
sage: currRing_wrapper()
The ring pointer ...
>>> from sage.all import *
>>> from sage.libs.singular.ring import currRing_wrapper
>>> currRing_wrapper()
The ring pointer ...
sage.libs.singular.ring.poison_currRing(frame, event, arg)[source]

Poison the currRing pointer.

This function sets the currRing to an illegal value. By setting it as the python debug hook, you can poison the currRing before every evaluated Python command (but not within Cython code).

INPUT:

  • frame, event, arg – the standard arguments for the CPython debugger hook; they are not used

OUTPUT:

Returns itself, which ensures that poison_currRing() will stay in the debugger hook.

EXAMPLES:

sage: previous_trace_func = sys.gettrace()   # None if no debugger running
sage: from sage.libs.singular.ring import poison_currRing
sage: sys.settrace(poison_currRing)
sage: sys.gettrace()
<built-in function poison_currRing>
sage: sys.settrace(previous_trace_func)  # switch it off again
>>> from sage.all import *
>>> previous_trace_func = sys.gettrace()   # None if no debugger running
>>> from sage.libs.singular.ring import poison_currRing
>>> sys.settrace(poison_currRing)
>>> sys.gettrace()
<built-in function poison_currRing>
>>> sys.settrace(previous_trace_func)  # switch it off again
sage.libs.singular.ring.print_currRing()[source]

Print the currRing pointer.

EXAMPLES:

sage: from sage.libs.singular.ring import print_currRing
sage: print_currRing()   # random output
DEBUG: currRing == 0x7fc6fa6ec480

sage: from sage.libs.singular.ring import poison_currRing
sage: _ = poison_currRing(None, None, None)
sage: print_currRing()
DEBUG: currRing == 0x0
>>> from sage.all import *
>>> from sage.libs.singular.ring import print_currRing
>>> print_currRing()   # random output
DEBUG: currRing == 0x7fc6fa6ec480

>>> from sage.libs.singular.ring import poison_currRing
>>> _ = poison_currRing(None, None, None)
>>> print_currRing()
DEBUG: currRing == 0x0
class sage.libs.singular.ring.ring_wrapper_Py[source]

Bases: object

Python object wrapping the ring pointer.

This is useful to store ring pointers in Python containers.

You must not construct instances of this class yourself, use wrap_ring() instead.

EXAMPLES:

sage: from sage.libs.singular.ring import ring_wrapper_Py
sage: ring_wrapper_Py
<class 'sage.libs.singular.ring.ring_wrapper_Py'>
>>> from sage.all import *
>>> from sage.libs.singular.ring import ring_wrapper_Py
>>> ring_wrapper_Py
<class 'sage.libs.singular.ring.ring_wrapper_Py'>