parent
b174b85c1a
commit
2d0a69a456
281
Modules/_sre.c
281
Modules/_sre.c
|
@ -269,6 +269,10 @@ class _sre.SRE_Scanner "ScannerObject *" "&Scanner_Type"
|
|||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b0230ec19a0deac8]*/
|
||||
|
||||
static PyTypeObject Pattern_Type;
|
||||
static PyTypeObject Match_Type;
|
||||
static PyTypeObject Scanner_Type;
|
||||
|
||||
/*[clinic input]
|
||||
_sre.getcodesize -> int
|
||||
[clinic start generated code]*/
|
||||
|
@ -1426,8 +1430,6 @@ done:
|
|||
|
||||
PyDoc_STRVAR(pattern_doc, "Compiled regular expression objects");
|
||||
|
||||
static PyMethodDef pattern_methods[];
|
||||
|
||||
/* PatternObject's 'groupindex' method. */
|
||||
static PyObject *
|
||||
pattern_groupindex(PatternObject *self)
|
||||
|
@ -1435,52 +1437,6 @@ pattern_groupindex(PatternObject *self)
|
|||
return PyDictProxy_New(self->groupindex);
|
||||
}
|
||||
|
||||
static PyGetSetDef pattern_getset[] = {
|
||||
{"groupindex", (getter)pattern_groupindex, (setter)NULL,
|
||||
"A dictionary mapping group names to group numbers."},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
#define PAT_OFF(x) offsetof(PatternObject, x)
|
||||
static PyMemberDef pattern_members[] = {
|
||||
{"pattern", T_OBJECT, PAT_OFF(pattern), READONLY},
|
||||
{"flags", T_INT, PAT_OFF(flags), READONLY},
|
||||
{"groups", T_PYSSIZET, PAT_OFF(groups), READONLY},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyTypeObject Pattern_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"_" SRE_MODULE ".SRE_Pattern",
|
||||
sizeof(PatternObject), sizeof(SRE_CODE),
|
||||
(destructor)pattern_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
(reprfunc)pattern_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
pattern_doc, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
offsetof(PatternObject, weakreflist), /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
pattern_methods, /* tp_methods */
|
||||
pattern_members, /* tp_members */
|
||||
pattern_getset, /* tp_getset */
|
||||
};
|
||||
|
||||
static int _validate(PatternObject *self); /* Forward */
|
||||
|
||||
/*[clinic input]
|
||||
|
@ -2469,8 +2425,6 @@ PyDoc_STRVAR(match_group_doc,
|
|||
Return subgroup(s) of the match by indices or names.\n\
|
||||
For 0 returns the entire match.");
|
||||
|
||||
static PyMethodDef match_methods[];
|
||||
|
||||
static PyObject *
|
||||
match_lastindex_get(MatchObject *self)
|
||||
{
|
||||
|
@ -2521,57 +2475,6 @@ match_repr(MatchObject *self)
|
|||
}
|
||||
|
||||
|
||||
static PyGetSetDef match_getset[] = {
|
||||
{"lastindex", (getter)match_lastindex_get, (setter)NULL},
|
||||
{"lastgroup", (getter)match_lastgroup_get, (setter)NULL},
|
||||
{"regs", (getter)match_regs_get, (setter)NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
#define MATCH_OFF(x) offsetof(MatchObject, x)
|
||||
static PyMemberDef match_members[] = {
|
||||
{"string", T_OBJECT, MATCH_OFF(string), READONLY},
|
||||
{"re", T_OBJECT, MATCH_OFF(pattern), READONLY},
|
||||
{"pos", T_PYSSIZET, MATCH_OFF(pos), READONLY},
|
||||
{"endpos", T_PYSSIZET, MATCH_OFF(endpos), READONLY},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
/* FIXME: implement setattr("string", None) as a special case (to
|
||||
detach the associated string, if any */
|
||||
|
||||
static PyTypeObject Match_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL,0)
|
||||
"_" SRE_MODULE ".SRE_Match",
|
||||
sizeof(MatchObject), sizeof(Py_ssize_t),
|
||||
(destructor)match_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
(reprfunc)match_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
match_doc, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
match_methods, /* tp_methods */
|
||||
match_members, /* tp_members */
|
||||
match_getset, /* tp_getset */
|
||||
};
|
||||
|
||||
static PyObject*
|
||||
pattern_new_match(PatternObject* pattern, SRE_STATE* state, Py_ssize_t status)
|
||||
{
|
||||
|
@ -2712,46 +2615,6 @@ _sre_SRE_Scanner_search_impl(ScannerObject *self)
|
|||
return match;
|
||||
}
|
||||
|
||||
static PyMethodDef scanner_methods[];
|
||||
|
||||
#define SCAN_OFF(x) offsetof(ScannerObject, x)
|
||||
static PyMemberDef scanner_members[] = {
|
||||
{"pattern", T_OBJECT, SCAN_OFF(pattern), READONLY},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyTypeObject Scanner_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"_" SRE_MODULE ".SRE_Scanner",
|
||||
sizeof(ScannerObject), 0,
|
||||
(destructor)scanner_dealloc,/* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
scanner_methods, /* tp_methods */
|
||||
scanner_members, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
};
|
||||
|
||||
static PyObject *
|
||||
pattern_scanner(PatternObject *self, PyObject *string, Py_ssize_t pos, Py_ssize_t endpos)
|
||||
{
|
||||
|
@ -2792,6 +2655,53 @@ static PyMethodDef pattern_methods[] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static PyGetSetDef pattern_getset[] = {
|
||||
{"groupindex", (getter)pattern_groupindex, (setter)NULL,
|
||||
"A dictionary mapping group names to group numbers."},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
#define PAT_OFF(x) offsetof(PatternObject, x)
|
||||
static PyMemberDef pattern_members[] = {
|
||||
{"pattern", T_OBJECT, PAT_OFF(pattern), READONLY},
|
||||
{"flags", T_INT, PAT_OFF(flags), READONLY},
|
||||
{"groups", T_PYSSIZET, PAT_OFF(groups), READONLY},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyTypeObject Pattern_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"_" SRE_MODULE ".SRE_Pattern",
|
||||
sizeof(PatternObject), sizeof(SRE_CODE),
|
||||
(destructor)pattern_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
(reprfunc)pattern_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
pattern_doc, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
offsetof(PatternObject, weakreflist), /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
pattern_methods, /* tp_methods */
|
||||
pattern_members, /* tp_members */
|
||||
pattern_getset, /* tp_getset */
|
||||
};
|
||||
|
||||
|
||||
static PyMethodDef match_methods[] = {
|
||||
{"group", (PyCFunction) match_group, METH_VARARGS, match_group_doc},
|
||||
_SRE_SRE_MATCH_START_METHODDEF
|
||||
|
@ -2805,12 +2715,101 @@ static PyMethodDef match_methods[] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static PyGetSetDef match_getset[] = {
|
||||
{"lastindex", (getter)match_lastindex_get, (setter)NULL},
|
||||
{"lastgroup", (getter)match_lastgroup_get, (setter)NULL},
|
||||
{"regs", (getter)match_regs_get, (setter)NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
#define MATCH_OFF(x) offsetof(MatchObject, x)
|
||||
static PyMemberDef match_members[] = {
|
||||
{"string", T_OBJECT, MATCH_OFF(string), READONLY},
|
||||
{"re", T_OBJECT, MATCH_OFF(pattern), READONLY},
|
||||
{"pos", T_PYSSIZET, MATCH_OFF(pos), READONLY},
|
||||
{"endpos", T_PYSSIZET, MATCH_OFF(endpos), READONLY},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
/* FIXME: implement setattr("string", None) as a special case (to
|
||||
detach the associated string, if any */
|
||||
|
||||
static PyTypeObject Match_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL,0)
|
||||
"_" SRE_MODULE ".SRE_Match",
|
||||
sizeof(MatchObject), sizeof(Py_ssize_t),
|
||||
(destructor)match_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
(reprfunc)match_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
match_doc, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
match_methods, /* tp_methods */
|
||||
match_members, /* tp_members */
|
||||
match_getset, /* tp_getset */
|
||||
};
|
||||
|
||||
static PyMethodDef scanner_methods[] = {
|
||||
_SRE_SRE_SCANNER_MATCH_METHODDEF
|
||||
_SRE_SRE_SCANNER_SEARCH_METHODDEF
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
#define SCAN_OFF(x) offsetof(ScannerObject, x)
|
||||
static PyMemberDef scanner_members[] = {
|
||||
{"pattern", T_OBJECT, SCAN_OFF(pattern), READONLY},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static PyTypeObject Scanner_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"_" SRE_MODULE ".SRE_Scanner",
|
||||
sizeof(ScannerObject), 0,
|
||||
(destructor)scanner_dealloc,/* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
scanner_methods, /* tp_methods */
|
||||
scanner_members, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
};
|
||||
|
||||
static PyMethodDef _functions[] = {
|
||||
_SRE_COMPILE_METHODDEF
|
||||
_SRE_GETCODESIZE_METHODDEF
|
||||
|
|
|
@ -2682,8 +2682,6 @@ _tkinter_tktimertoken_deletetimerhandler_impl(TkttObject *self)
|
|||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyMethodDef Tktt_methods[];
|
||||
|
||||
static TkttObject *
|
||||
Tktt_New(PyObject *func)
|
||||
{
|
||||
|
@ -2725,22 +2723,6 @@ Tktt_Repr(PyObject *self)
|
|||
v->func == NULL ? ", handler deleted" : "");
|
||||
}
|
||||
|
||||
static PyType_Slot Tktt_Type_slots[] = {
|
||||
{Py_tp_dealloc, Tktt_Dealloc},
|
||||
{Py_tp_repr, Tktt_Repr},
|
||||
{Py_tp_methods, Tktt_methods},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static PyType_Spec Tktt_Type_spec = {
|
||||
"_tkinter.tktimertoken",
|
||||
sizeof(TkttObject),
|
||||
0,
|
||||
Py_TPFLAGS_DEFAULT,
|
||||
Tktt_Type_slots,
|
||||
};
|
||||
|
||||
|
||||
/** Timer Handler **/
|
||||
|
||||
static void
|
||||
|
@ -3001,11 +2983,6 @@ _tkinter_tkapp_willdispatch_impl(TkappObject *self)
|
|||
}
|
||||
|
||||
|
||||
/**** Tkapp Method List ****/
|
||||
|
||||
static PyMethodDef Tkapp_methods[];
|
||||
|
||||
|
||||
/**** Tkapp Type Methods ****/
|
||||
|
||||
static void
|
||||
|
@ -3021,21 +2998,6 @@ Tkapp_Dealloc(PyObject *self)
|
|||
DisableEventHook();
|
||||
}
|
||||
|
||||
static PyType_Slot Tkapp_Type_slots[] = {
|
||||
{Py_tp_dealloc, Tkapp_Dealloc},
|
||||
{Py_tp_methods, Tkapp_methods},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
||||
static PyType_Spec Tkapp_Type_spec = {
|
||||
"_tkinter.tkapp",
|
||||
sizeof(TkappObject),
|
||||
0,
|
||||
Py_TPFLAGS_DEFAULT,
|
||||
Tkapp_Type_slots,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**** Tkinter Module ****/
|
||||
|
@ -3218,6 +3180,24 @@ static PyMethodDef Tktt_methods[] =
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static PyType_Slot Tktt_Type_slots[] = {
|
||||
{Py_tp_dealloc, Tktt_Dealloc},
|
||||
{Py_tp_repr, Tktt_Repr},
|
||||
{Py_tp_methods, Tktt_methods},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static PyType_Spec Tktt_Type_spec = {
|
||||
"_tkinter.tktimertoken",
|
||||
sizeof(TkttObject),
|
||||
0,
|
||||
Py_TPFLAGS_DEFAULT,
|
||||
Tktt_Type_slots,
|
||||
};
|
||||
|
||||
|
||||
/**** Tkapp Method List ****/
|
||||
|
||||
static PyMethodDef Tkapp_methods[] =
|
||||
{
|
||||
_TKINTER_TKAPP_WILLDISPATCH_METHODDEF
|
||||
|
@ -3255,6 +3235,21 @@ static PyMethodDef Tkapp_methods[] =
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static PyType_Slot Tkapp_Type_slots[] = {
|
||||
{Py_tp_dealloc, Tkapp_Dealloc},
|
||||
{Py_tp_methods, Tkapp_methods},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
||||
static PyType_Spec Tkapp_Type_spec = {
|
||||
"_tkinter.tkapp",
|
||||
sizeof(TkappObject),
|
||||
0,
|
||||
Py_TPFLAGS_DEFAULT,
|
||||
Tkapp_Type_slots,
|
||||
};
|
||||
|
||||
static PyMethodDef moduleMethods[] =
|
||||
{
|
||||
_TKINTER__FLATTEN_METHODDEF
|
||||
|
|
Loading…
Reference in New Issue