Skip to content

Commit bdd1338

Browse files
author
Erlend E. Aasland
committed
Address Heimes' review: Drop using _PyType_GetModuleByDef
1 parent 0f10f7d commit bdd1338

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Modules/_sre.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,6 @@ get_sre_module_state(PyObject *m)
264264
}
265265

266266
static struct PyModuleDef sremodule;
267-
#define get_sre_module_state_by_type(tp) \
268-
(get_sre_module_state(_PyType_GetModuleByDef(tp, &sremodule)))
269267
#define get_sre_module_state_by_class(cls) \
270268
(get_sre_module_state(PyType_GetModule(cls)))
271269

@@ -275,11 +273,11 @@ static PyObject *pattern_scanner(_sremodulestate *, PatternObject *, PyObject *,
275273

276274
/*[clinic input]
277275
module _sre
278-
class _sre.SRE_Pattern "PatternObject *" "get_sre_module_state_by_type(tp)->Pattern_Type"
279-
class _sre.SRE_Match "MatchObject *" "get_sre_module_state_by_type(tp)->Match_Type"
280-
class _sre.SRE_Scanner "ScannerObject *" "get_sre_module_state_by_type(tp)->Scanner_Type"
276+
class _sre.SRE_Pattern "PatternObject *" "get_sre_module_state_by_class(tp)->Pattern_Type"
277+
class _sre.SRE_Match "MatchObject *" "get_sre_module_state_by_class(tp)->Match_Type"
278+
class _sre.SRE_Scanner "ScannerObject *" "get_sre_module_state_by_class(tp)->Scanner_Type"
281279
[clinic start generated code]*/
282-
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8b48770d8db721b4]*/
280+
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=fe2966e32b66a231]*/
283281

284282
/*[clinic input]
285283
_sre.getcodesize -> int
@@ -2593,7 +2591,7 @@ static PyObject*
25932591
pattern_richcompare(PyObject *lefto, PyObject *righto, int op)
25942592
{
25952593
PyTypeObject *tp = Py_TYPE(lefto);
2596-
_sremodulestate *module_state = get_sre_module_state_by_type(tp);
2594+
_sremodulestate *module_state = get_sre_module_state_by_class(tp);
25972595
PatternObject *left, *right;
25982596
int cmp;
25992597

0 commit comments

Comments
 (0)