Author: Amaury Forgeot d'Arc <[email protected]>
Branch: decimal-libmpdec
Changeset: r71446:3a643e398e1d
Date: 2014-05-01 21:30 +0200
http://bitbucket.org/pypy/pypy/changeset/3a643e398e1d/
Log: Add _decimal.Decimal, empty.
diff --git a/pypy/module/_decimal/__init__.py b/pypy/module/_decimal/__init__.py
--- a/pypy/module/_decimal/__init__.py
+++ b/pypy/module/_decimal/__init__.py
@@ -5,5 +5,6 @@
}
interpleveldefs = {
+ 'Decimal': 'interp_decimal.W_Decimal',
'IEEE_CONTEXT_MAX_BITS':
'space.wrap(interp_decimal.IEEE_CONTEXT_MAX_BITS)',
}
diff --git a/pypy/module/_decimal/interp_decimal.py
b/pypy/module/_decimal/interp_decimal.py
--- a/pypy/module/_decimal/interp_decimal.py
+++ b/pypy/module/_decimal/interp_decimal.py
@@ -1,3 +1,13 @@
from rpython.rlib import rmpdec
+from pypy.interpreter.baseobjspace import W_Root
+from pypy.interpreter.typedef import (TypeDef, GetSetProperty, descr_get_dict,
+ descr_set_dict, descr_del_dict)
+
IEEE_CONTEXT_MAX_BITS = rmpdec.MPD_IEEE_CONTEXT_MAX_BITS
+
+class W_Decimal(W_Root):
+ pass
+
+W_Decimal.typedef = TypeDef(
+ 'Decimal')
diff --git a/pypy/module/_decimal/test/test_module.py
b/pypy/module/_decimal/test/test_module.py
--- a/pypy/module/_decimal/test/test_module.py
+++ b/pypy/module/_decimal/test/test_module.py
@@ -4,3 +4,7 @@
def test_constants(self):
import _decimal
assert _decimal.IEEE_CONTEXT_MAX_BITS > 3
+
+ def test_type(self):
+ import _decimal
+ assert isinstance(_decimal.Decimal, type)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit