- if (!PyArg_ParseTuple(arg, "OO&:zero", &me, convszt, &sz)) goto end;
+ if (!PyArg_ParseTuple(arg, "O&:zero", convszt, &sz)) goto end;
rc = bytestring_pywrap(0, sz);
memset(PyString_AS_STRING(rc), 0, sz);
end:
rc = bytestring_pywrap(0, sz);
memset(PyString_AS_STRING(rc), 0, sz);
end:
zsz = n*xsz; z = bytestring_pywrap(0, zsz); zp = PyString_AS_STRING(z);
if (xsz == 1) memset(zp, *xp, zsz);
else while (zsz) { memcpy(zp, xp, xsz); zp += xsz; zsz -= xsz; }
zsz = n*xsz; z = bytestring_pywrap(0, zsz); zp = PyString_AS_STRING(z);
if (xsz == 1) memset(zp, *xp, zsz);
else while (zsz) { memcpy(zp, xp, xsz); zp += xsz; zsz -= xsz; }
-static PyNumberMethods bytestring_pynumber = {
+static const PyMethodDef bytestring_pymethods[] = {
+#define METHNAME(name) bymeth_##name
+ SMTH (zero, "zero(N) -> 0000...00")
+#undef METHNAME
+ { 0 }
+};
+
+static const PyNumberMethods bytestring_pynumber = {
0, /* @sq_length@ */
bytestring_pyconcat, /* @sq_concat@ */
bytestring_pyrepeat, /* @sq_repeat@ */
0, /* @sq_length@ */
bytestring_pyconcat, /* @sq_concat@ */
bytestring_pyrepeat, /* @sq_repeat@ */
0, /* @mp_length@ */
bytestring_pysubscript, /* @mp_subscript@ */
0, /* @mp_ass_subscript@ */
};
0, /* @mp_length@ */
bytestring_pysubscript, /* @mp_subscript@ */
0, /* @mp_ass_subscript@ */
};
static PyTypeObject bytestring_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
"ByteString", /* @tp_name@ */
static PyTypeObject bytestring_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
"ByteString", /* @tp_name@ */
- &bytestring_pynumber, /* @tp_as_number@ */
- &bytestring_pysequence, /* @tp_as_sequence@ */
- &bytestring_pymapping, /* @tp_as_mapping@ */
+ PYNUMBER(bytestring), /* @tp_as_number@ */
+ PYSEQUENCE(bytestring), /* @tp_as_sequence@ */
+ PYMAPPING(bytestring), /* @tp_as_mapping@ */
- METH (ctstreq, "ctstreq(S, T) -> BOOL")
- METH (_ByteString_zero, "zero(N) -> 0000...00")
+ METH (ctstreq, "ctstreq(S, T) -> BOOL")