Skip to content

Commit cfe84e8

Browse files
committed
use sentinel from pure-Python module
1 parent 1c40dad commit cfe84e8

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

Modules/_functoolsmodule.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "pycore_tuple.h" // _PyTuple_ITEMS()
1010
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
1111

12-
static PyObject *_initial_missing;
1312

1413
#include "clinic/_functoolsmodule.c.h"
1514
/*[clinic input]
@@ -1067,7 +1066,7 @@ _functools.reduce
10671066
function as func: object
10681067
iterable as seq: object
10691068
/
1070-
initial as result: object(c_default="NULL") = _functools._initial_missing
1069+
initial as result: object(c_default="NULL") = functools._initial_missing
10711070
10721071
Apply a function of two arguments cumulatively to the items of an iterable, from left to right.
10731072
@@ -1082,7 +1081,7 @@ calculates ((((1 + 2) + 3) + 4) + 5).
10821081
static PyObject *
10831082
_functools_reduce_impl(PyObject *module, PyObject *func, PyObject *seq,
10841083
PyObject *result)
1085-
/*[clinic end generated code: output=30d898fe1267c79d input=7e5eaeb4f8a7a78d]*/
1084+
/*[clinic end generated code: output=30d898fe1267c79d input=5c9088c98ffe2793]*/
10861085
{
10871086
PyObject *args, *it;
10881087

@@ -1983,11 +1982,6 @@ _functools_exec(PyObject *module)
19831982
// lru_list_elem is used only in _lru_cache_wrapper.
19841983
// So we don't expose it in module namespace.
19851984

1986-
_initial_missing = PySentinel_New("_initial_missing", "_functools");
1987-
if (PyModule_Add(module, "_initial_missing", _initial_missing) < 0) {
1988-
Py_XDECREF(_initial_missing);
1989-
return -1;
1990-
}
19911985
return 0;
19921986
}
19931987

Modules/clinic/_functoolsmodule.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)