catacomb/__init__.py, mp.c: Remove `L' suffix from `repr' output.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 21 Nov 2019 22:44:15 +0000 (22:44 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 11 Apr 2020 11:44:21 +0000 (12:44 +0100)
Python 3 doesn't produce an `L', and it doesn't really help anything.

catacomb/__init__.py
mp.c
t/t-mp.py

index 4a98ced..5483cca 100644 (file)
@@ -460,7 +460,7 @@ class _tmp:
 _augment(Field, _tmp)
 
 class _tmp:
-  def __repr__(me): return '%s(%sL)' % (_clsname(me), me.p)
+  def __repr__(me): return '%s(%s)' % (_clsname(me), me.p)
   def __hash__(me): return 0x114401de ^ hash(me.p)
   def _repr_pretty_(me, pp, cyclep):
     ind = _pp_bgroup_tyname(pp, me)
@@ -471,7 +471,7 @@ class _tmp:
 _augment(PrimeField, _tmp)
 
 class _tmp:
-  def __repr__(me): return '%s(%#xL)' % (_clsname(me), me.p)
+  def __repr__(me): return '%s(%#x)' % (_clsname(me), me.p)
   def ec(me, a, b): return ECBinProjCurve(me, a, b)
   def _repr_pretty_(me, pp, cyclep):
     ind = _pp_bgroup_tyname(pp, me)
diff --git a/mp.c b/mp.c
index 8f66d17..e14b720 100644 (file)
--- a/mp.c
+++ b/mp.c
@@ -199,7 +199,7 @@ static void mp_pydealloc(PyObject *o)
 }
 
 static PyObject *mp_pyrepr(PyObject *o)
-  { return mp_topystring(MP_X(o), 10, "MP(", 0, "L)"); }
+  { return mp_topystring(MP_X(o), 10, "MP(", 0, ")"); }
 
 static PyObject *mp_pystr(PyObject *o)
   { return mp_topystring(MP_X(o), 10, 0, 0, 0); }
@@ -1902,7 +1902,7 @@ static const PyTypeObject mpcrt_pytype_skel = {
 /*----- Binary polynomials ------------------------------------------------*/
 
 static PyObject *gf_pyrepr(PyObject *o)
-  { return mp_topystring(MP_X(o), 16, "GF(", "0x", "L)"); }
+  { return mp_topystring(MP_X(o), 16, "GF(", "0x", ")"); }
 
 static PyObject *gf_pyrichcompare(PyObject *x, PyObject *y, int op)
 {
index a88fa8d..ec84d74 100644 (file)
--- a/t/t-mp.py
+++ b/t/t-mp.py
@@ -69,7 +69,7 @@ class TestMP (U.TestCase):
   def test_string(me):
     y = C.MP(6556380541834372447694561492436749633)
     me.assertEqual(str(y), '6556380541834372447694561492436749633')
-    me.assertEqual(repr(y), 'MP(6556380541834372447694561492436749633L)')
+    me.assertEqual(repr(y), 'MP(6556380541834372447694561492436749633)')
     me.assertEqual(hex(y), '0x4eeb684a0954ec4ceb255e3e9778d41')
     me.assertEqual(oct(y), '047353320450112516611472622536175135706501')
 
@@ -411,7 +411,7 @@ class TestGF (U.TestCase):
   def test_string(me):
     y = C.GF(0x4eeb684a0954ec4ceb255e3e9778d41)
     me.assertEqual(str(y), '0x4eeb684a0954ec4ceb255e3e9778d41')
-    me.assertEqual(repr(y), 'GF(0x4eeb684a0954ec4ceb255e3e9778d41L)')
+    me.assertEqual(repr(y), 'GF(0x4eeb684a0954ec4ceb255e3e9778d41)')
     me.assertEqual(hex(y), '0x4eeb684a0954ec4ceb255e3e9778d41')
     me.assertEqual(oct(y), '047353320450112516611472622536175135706501')