summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-27 14:12:47 (GMT)
committerGitHub <noreply@github.com>2018-11-27 14:12:47 (GMT)
commit1005c84535191a72ebb7587d8c5636a065b7ed79 (patch)
treea5c6672e5a207440935066aff09accd8cfa24615 /Python
parent480833808e918a1dcebbbcfd07d5a8de3c5c2a66 (diff)
downloadcpython-1005c84535191a72ebb7587d8c5636a065b7ed79.zip
cpython-1005c84535191a72ebb7587d8c5636a065b7ed79.tar.gz
cpython-1005c84535191a72ebb7587d8c5636a065b7ed79.tar.bz2
bpo-34100: Partially revert merge_consts_recursive() (GH-10743)
Partically revert commit c2e1607a51d7a17f143b5a34e8cff7c6fc58a091 to fix a reference leak.
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/Python/compile.c b/Python/compile.c
index acb5cfe..7d51819 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1240,56 +1240,6 @@ merge_consts_recursive(struct compiler *c, PyObject *o)
Py_DECREF(u);
}
}
- else if (PyFrozenSet_CheckExact(o)) {
- // We register items in the frozenset, but don't rewrite
- // the frozenset when the item is already registered
- // because frozenset is rare and difficult.
-
- // *key* is tuple. And it's first item is frozenset of
- // constant keys.
- // See _PyCode_ConstantKey() for detail.
- assert(PyTuple_CheckExact(key));
- assert(PyTuple_GET_SIZE(key) == 2);
-
- Py_ssize_t len = PySet_GET_SIZE(o);
- if (len == 0) {
- return key;
- }
- PyObject *tuple = PyTuple_New(len);
- if (tuple == NULL) {
- Py_DECREF(key);
- return NULL;
- }
- Py_ssize_t i = 0, pos = 0;
- PyObject *item;
- Py_hash_t hash;
- while (_PySet_NextEntry(o, &pos, &item, &hash)) {
- PyObject *k = merge_consts_recursive(c, item);
- if (k == NULL) {
- Py_DECREF(tuple);
- Py_DECREF(key);
- return NULL;
- }
- PyObject *u;
- if (PyTuple_CheckExact(k)) {
- u = PyTuple_GET_ITEM(k, 1);
- }
- else {
- u = k;
- }
- Py_INCREF(u);
- PyTuple_SET_ITEM(tuple, i, u);
- i++;
- }
-
- PyObject *new = PyFrozenSet_New(tuple);
- Py_DECREF(tuple);
- if (new == NULL) {
- Py_DECREF(key);
- return NULL;
- }
- PyTuple_SET_ITEM(key, 1, new);
- }
return key;
}