*.c: Delete some pointless refcount twiddling.
[catacomb-python] / catacomb / __init__.py
index dc5ecbb..08ec3d7 100644 (file)
@@ -275,7 +275,7 @@ def secret_unbox(k, n, c):
 class BaseRat (object):
   """Base class implementing fields of fractions over Euclidean domains."""
   def __new__(cls, a, b):
-    a, b = cls.RING(a), cls.RING(b)
+    a, b = cls.RING._implicit(a), cls.RING._implicit(b)
     q, r = divmod(a, b)
     if r == cls.ZERO: return q
     g = b.gcd(r)
@@ -444,6 +444,8 @@ class _tmp:
       pp.pretty(me.a); pp.text(','); pp.breakable()
       pp.pretty(me.b)
     pp.end_group(ind, ')')
+  def fromstring(str): return _checkend(ECCurve.parse(str))
+  fromstring = staticmethod(fromstring)
   def frombuf(me, s):
     return ecpt.frombuf(me, s)
   def fromraw(me, s):
@@ -508,6 +510,8 @@ class _tmp:
     h ^=   hash(me.curve)
     h ^= 2*hash(me.G) & 0xffffffff
     return h
+  def fromstring(str): return _checkend(ECInfo.parse(str))
+  fromstring = staticmethod(fromstring)
   def group(me):
     return ECGroup(me)
 _augment(ECInfo, _tmp)