There was an error while loading. Please reload this page.
1 parent c2d3d6b commit f3a381eCopy full SHA for f3a381e
2 files changed
Lib/test/test_decimal.py
@@ -3963,15 +3963,21 @@ def test_flag_comparisons(self):
3963
d.update(c.flags)
3964
self.assertEqual(d, c.flags)
3965
self.assertEqual(c.flags, d)
3966
+ self.assertEqual(frozendict(d), c.flags)
3967
+ self.assertEqual(c.flags, frozendict(d))
3968
3969
d[Inexact] = True
3970
self.assertNotEqual(d, c.flags)
3971
self.assertNotEqual(c.flags, d)
3972
+ self.assertNotEqual(frozendict(d), c.flags)
3973
+ self.assertNotEqual(c.flags, frozendict(d))
3974
3975
# Invalid SignalDict
3976
d = {Inexact:False}
3977
3978
3979
3980
3981
3982
d = ["xyz"]
3983
Modules/_decimal/_decimal.c
@@ -552,7 +552,7 @@ dict_as_flags(decimal_state *state, PyObject *val)
552
uint32_t flags = 0;
553
int x;
554
555
- if (!PyDict_Check(val)) {
+ if (!PyAnyDict_Check(val)) {
556
PyErr_SetString(PyExc_TypeError,
557
"argument must be a signal dict");
558
return DEC_INVALID_SIGNALS;
@@ -802,7 +802,7 @@ signaldict_richcompare(PyObject *v, PyObject *w, int op)
802
if (PyDecSignalDict_Check(state, w)) {
803
res = (SdFlags(v)==SdFlags(w)) ^ (op==Py_NE) ? Py_True : Py_False;
804
}
805
- else if (PyDict_Check(w)) {
+ else if (PyAnyDict_Check(w)) {
806
uint32_t flags = dict_as_flags(state, w);
807
if (flags & DEC_ERRORS) {
808
if (flags & DEC_INVALID_SIGNALS) {
0 commit comments