diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-01-31 17:19:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-31 17:19:33 (GMT) |
commit | c66f9f8d3909f588c251957d499599a1680e2320 (patch) | |
tree | 57c7d5786f605365cc9fc5eff0ef327997803ada /Modules/_decimal/_decimal.c | |
parent | a29ddf407831c9103e4df4850df6d67b4352f4f9 (diff) | |
download | cpython-c66f9f8d3909f588c251957d499599a1680e2320.zip cpython-c66f9f8d3909f588c251957d499599a1680e2320.tar.gz cpython-c66f9f8d3909f588c251957d499599a1680e2320.tar.bz2 |
bpo-25988: Emit a warning when use or import ABCs from 'collections'. (#5460)
Diffstat (limited to 'Modules/_decimal/_decimal.c')
-rw-r--r-- | Modules/_decimal/_decimal.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index fddb39e..5bce780 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -5521,6 +5521,7 @@ PyInit__decimal(void) PyObject *numbers = NULL; PyObject *Number = NULL; PyObject *collections = NULL; + PyObject *collections_abc = NULL; PyObject *MutableMapping = NULL; PyObject *obj = NULL; DecCondMap *cm; @@ -5595,7 +5596,8 @@ PyInit__decimal(void) Py_CLEAR(obj); /* MutableMapping */ - ASSIGN_PTR(MutableMapping, PyObject_GetAttrString(collections, + ASSIGN_PTR(collections_abc, PyImport_ImportModule("collections.abc")); + ASSIGN_PTR(MutableMapping, PyObject_GetAttrString(collections_abc, "MutableMapping")); /* Create SignalDict type */ ASSIGN_PTR(PyDecSignalDict_Type, @@ -5606,6 +5608,7 @@ PyInit__decimal(void) /* Done with collections, MutableMapping */ Py_CLEAR(collections); + Py_CLEAR(collections_abc); Py_CLEAR(MutableMapping); @@ -5765,6 +5768,7 @@ error: Py_CLEAR(Number); /* GCOV_NOT_REACHED */ Py_CLEAR(Rational); /* GCOV_NOT_REACHED */ Py_CLEAR(collections); /* GCOV_NOT_REACHED */ + Py_CLEAR(collections_abc); /* GCOV_NOT_REACHED */ Py_CLEAR(MutableMapping); /* GCOV_NOT_REACHED */ Py_CLEAR(SignalTuple); /* GCOV_NOT_REACHED */ Py_CLEAR(DecimalTuple); /* GCOV_NOT_REACHED */ |