Wrapper for Singular’s Rings

AUTHORS:

  • Martin Albrecht (2009-07): initial implementation
  • Kwankyu Lee (2010-06): added matrix term order support
sage.libs.singular.ring.currRing_wrapper()

Returns 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 ...
sage.libs.singular.ring.poison_currRing(frame, event, arg)

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
sage.libs.singular.ring.print_currRing()

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
class sage.libs.singular.ring.ring_wrapper_Py

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
<type 'sage.libs.singular.ring.ring_wrapper_Py'>