summaryrefslogtreecommitdiffstats
path: root/Modules/_decimal
diff options
context:
space:
mode:
authorSergey B Kirpichev <skirpichev@gmail.com>2024-08-19 07:51:38 (GMT)
committerGitHub <noreply@github.com>2024-08-19 07:51:38 (GMT)
commitb9e10d1a0fc4d8428d4b36eb127570a832c26b6f (patch)
tree26cb3c5fe1e4e4c6a23974e4147ac2ac4589e69d /Modules/_decimal
parentbe257c58152e9b960827362b11c9ef2223fd6267 (diff)
downloadcpython-b9e10d1a0fc4d8428d4b36eb127570a832c26b6f.zip
cpython-b9e10d1a0fc4d8428d4b36eb127570a832c26b6f.tar.gz
cpython-b9e10d1a0fc4d8428d4b36eb127570a832c26b6f.tar.bz2
gh-122081: fixed crash in decimal.IEEEContext() (#122082)
* gh-122081: fixed crash in decimal.IEEEContext() Now $ ./configure CFLAGS=-DEXTRA_FUNCTIONALITY -q && make -s && \ ./python -m test test_decimal - PASS * Apply suggestions from code review Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> * Update Misc/NEWS.d/next/Library/2024-07-21-10-45-24.gh-issue-122081.dNrYMq.rst * Apply suggestions from code review --------- Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Diffstat (limited to 'Modules/_decimal')
-rw-r--r--Modules/_decimal/_decimal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 94a2cc2..15855e2 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -1519,7 +1519,7 @@ init_extended_context(PyObject *v)
#ifdef EXTRA_FUNCTIONALITY
/* Factory function for creating IEEE interchange format contexts */
static PyObject *
-ieee_context(PyObject *dummy UNUSED, PyObject *v)
+ieee_context(PyObject *module, PyObject *v)
{
PyObject *context;
mpd_ssize_t bits;
@@ -1536,7 +1536,7 @@ ieee_context(PyObject *dummy UNUSED, PyObject *v)
goto error;
}
- decimal_state *state = get_module_state_by_def(Py_TYPE(v));
+ decimal_state *state = get_module_state(module);
context = PyObject_CallObject((PyObject *)state->PyDecContext_Type, NULL);
if (context == NULL) {
return NULL;