mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-24 23:09:02 +00:00
Backporting METH_FASTCALL from Python 3.7 (#317)
* dict copy speedup refer to bpo-31179 or python/cpython@boa7a037b8fde * __build_class__() uses METH_FASTCALL refer python/cpython@69de71b255 refer python/cpython@773dc6dd06 a single test related to __prepare__ fails. * type_prepare uses METH_FASTCALL refer python/cpython@d526cfe546 refer python/cpython@80ab22fa2c the prepare-related test still fails. It's just related to the error message format though. * separate into ParseStack and ParseStackAndKeywords refer python/cpython@6518a93cb1 refer python/cpython@3e1fad6913 refer python/cpython@c0083fc47d * Add _PyArg_NoStackKeywords refer python/cpython@29d39cc8f5 * _PyStack_UnpackDict now returns int refer python/cpython@998c20962c * METH_FASTCALL changes to .inc files done via python's Argument Clinic tool, refer python/cpython@259f0e4437 * Added _PyArg_UnpackStack refer python/cpython@fe54dda08 * Argument Clinic FASTCALL again refer python/cpython@0c4a828ca * Argument Clinic for ordered dictionary object refer python/cpython@b05cbac052 * speed up getargs refer python/cpython@1741441649 * FASTCALL for sorted, next, and getattr refer python/cpython@5a60ecaa7a refer python/cpython@fda6d0acf0 refer python/cpython@84b388bb80 * Optimize methoddescr_call refer python/cpython@2a1b676d1f refer python/cpython@c52572319c refer python/cpython@35ecebe165 refer python/cpython@8128d5a491 * cleanup _PyMethodDef_RawFastCallDict refer python/cpython@0a2e46835d refer python/cpython@98ccba8344 refer python/cpython@c89ef828cf refer python/cpython@250e4b0063 * print now uses METH_FASTCALL refer python/cpython@c3858bd7c6 refer python/cpython@bd584f169f refer python/cpython@06d34393c2 * _struct module now uses Argument Clinic refer python/cpython@3f2d10132d * make deque methods faster refer python/cpython@dd407d5006 * recursive calls in PyObject_Call refer python/cpython@7399a05965 only partially ported, because RawFastCallKeywords hasn't been ported * add macros refer python/cpython@68a001dd59 * all tests pass in MODE=dbg * convert some internal functions to FASTCALL __import__ might need to be changed later, if it is possible to backport the METH_FASTCALL | METH_KEYWORDS flag distinction later. * speed up unpickling refer python/cpython@bee09aecc2 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
This commit is contained in:
parent
6f658f058b
commit
7fe9e70117
71 changed files with 4154 additions and 2450 deletions
17
third_party/python/Include/abstract.h
vendored
17
third_party/python/Include/abstract.h
vendored
|
@ -14,14 +14,17 @@ PyObject *PyObject_Call(PyObject *callable_object, PyObject *args,
|
||||||
|
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyObject *_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs);
|
PyObject *_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs);
|
||||||
|
PyObject *_PyStack_AsTupleSlice(PyObject **stack, Py_ssize_t nargs,
|
||||||
|
Py_ssize_t start, Py_ssize_t end);
|
||||||
|
|
||||||
PyObject *_PyStack_AsDict(PyObject **values, PyObject *kwnames);
|
PyObject *_PyStack_AsDict(PyObject **values, PyObject *kwnames);
|
||||||
|
|
||||||
PyObject ** _PyStack_UnpackDict(
|
int _PyStack_UnpackDict(
|
||||||
PyObject **args,
|
PyObject **args,
|
||||||
Py_ssize_t nargs,
|
Py_ssize_t nargs,
|
||||||
PyObject *kwargs,
|
PyObject *kwargs,
|
||||||
PyObject **kwnames,
|
PyObject ***p_stack,
|
||||||
PyObject *func);
|
PyObject **p_kwnames);
|
||||||
|
|
||||||
PyObject *_PyObject_FastCallDict(PyObject *func, PyObject **args,
|
PyObject *_PyObject_FastCallDict(PyObject *func, PyObject **args,
|
||||||
Py_ssize_t nargs, PyObject *kwargs);
|
Py_ssize_t nargs, PyObject *kwargs);
|
||||||
|
@ -39,6 +42,14 @@ PyObject *_PyObject_FastCallKeywords(PyObject *func, PyObject **args,
|
||||||
PyObject *_PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args,
|
PyObject *_PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args,
|
||||||
PyObject *kwargs);
|
PyObject *kwargs);
|
||||||
|
|
||||||
|
#define _PY_FASTCALL_SMALL_STACK 5
|
||||||
|
|
||||||
|
PyObject *_PyObject_FastCall_Prepend(
|
||||||
|
PyObject *callable,
|
||||||
|
PyObject *obj,
|
||||||
|
PyObject **args,
|
||||||
|
Py_ssize_t nargs);
|
||||||
|
|
||||||
#if IsModeDbg()
|
#if IsModeDbg()
|
||||||
PyObject *_Py_CheckFunctionResult(PyObject *func, PyObject *result,
|
PyObject *_Py_CheckFunctionResult(PyObject *func, PyObject *result,
|
||||||
const char *where);
|
const char *where);
|
||||||
|
|
6
third_party/python/Include/methodobject.h
vendored
6
third_party/python/Include/methodobject.h
vendored
|
@ -93,6 +93,12 @@ typedef struct {
|
||||||
PyObject *m_module; /* The __module__ attribute, can be anything */
|
PyObject *m_module; /* The __module__ attribute, can be anything */
|
||||||
PyObject *m_weakreflist; /* List of weak references */
|
PyObject *m_weakreflist; /* List of weak references */
|
||||||
} PyCFunctionObject;
|
} PyCFunctionObject;
|
||||||
|
PyObject * _PyMethodDef_RawFastCallDict(
|
||||||
|
PyMethodDef *method,
|
||||||
|
PyObject *self,
|
||||||
|
PyObject **args,
|
||||||
|
Py_ssize_t nargs,
|
||||||
|
PyObject *kwargs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int PyCFunction_ClearFreeList(void);
|
int PyCFunction_ClearFreeList(void);
|
||||||
|
|
23
third_party/python/Include/modsupport.h
vendored
23
third_party/python/Include/modsupport.h
vendored
|
@ -47,8 +47,22 @@ PyObject * Py_BuildValue(const char *, ...);
|
||||||
PyObject * _Py_BuildValue_SizeT(const char *, ...);
|
PyObject * _Py_BuildValue_SizeT(const char *, ...);
|
||||||
|
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
int _PyArg_NoKeywords(const char *funcname, PyObject *kw);
|
int _PyArg_UnpackStack(
|
||||||
|
PyObject **args,
|
||||||
|
Py_ssize_t nargs,
|
||||||
|
const char *name,
|
||||||
|
Py_ssize_t min,
|
||||||
|
Py_ssize_t max,
|
||||||
|
...);
|
||||||
|
int _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
|
||||||
|
int _PyArg_NoStackKeywords(const char *funcname, PyObject *kwnames);
|
||||||
int _PyArg_NoPositional(const char *funcname, PyObject *args);
|
int _PyArg_NoPositional(const char *funcname, PyObject *args);
|
||||||
|
#define _PyArg_NoKeywords(funcname, kwargs) \
|
||||||
|
((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
|
||||||
|
#define _PyArg_NoStackKeywords(funcname, kwnames) \
|
||||||
|
((kwnames) == NULL || _PyArg_NoStackKeywords((funcname), (kwnames)))
|
||||||
|
#define _PyArg_NoPositional(funcname, args) \
|
||||||
|
((args) == NULL || _PyArg_NoPositional((funcname), (args)))
|
||||||
#endif
|
#endif
|
||||||
PyObject * Py_VaBuildValue(const char *, va_list);
|
PyObject * Py_VaBuildValue(const char *, va_list);
|
||||||
|
|
||||||
|
@ -66,12 +80,15 @@ typedef struct _PyArg_Parser {
|
||||||
} _PyArg_Parser;
|
} _PyArg_Parser;
|
||||||
#ifdef PY_SSIZE_T_CLEAN
|
#ifdef PY_SSIZE_T_CLEAN
|
||||||
#define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT
|
#define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT
|
||||||
#define _PyArg_ParseStack _PyArg_ParseStack_SizeT
|
#define _PyArg_ParseStack _PyArg_ParseStack_SizeT
|
||||||
|
#define _PyArg_ParseStackAndKeywords _PyArg_ParseStackAndKeywords_SizeT
|
||||||
#define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT
|
#define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT
|
||||||
#endif
|
#endif
|
||||||
int _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
|
int _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
|
||||||
struct _PyArg_Parser *, ...);
|
struct _PyArg_Parser *, ...);
|
||||||
int _PyArg_ParseStack(PyObject **args, Py_ssize_t nargs, PyObject *kwnames,
|
int _PyArg_ParseStack(PyObject **args, Py_ssize_t nargs,
|
||||||
|
const char *format, ...);
|
||||||
|
int _PyArg_ParseStackAndKeywords(PyObject **args, Py_ssize_t nargs, PyObject *kwnames,
|
||||||
struct _PyArg_Parser *, ...);
|
struct _PyArg_Parser *, ...);
|
||||||
int _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *,
|
int _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *,
|
||||||
struct _PyArg_Parser *, va_list);
|
struct _PyArg_Parser *, va_list);
|
||||||
|
|
14
third_party/python/Lib/pickle.py
vendored
14
third_party/python/Lib/pickle.py
vendored
|
@ -1465,12 +1465,16 @@ class _Unpickler:
|
||||||
def load_appends(self):
|
def load_appends(self):
|
||||||
items = self.pop_mark()
|
items = self.pop_mark()
|
||||||
list_obj = self.stack[-1]
|
list_obj = self.stack[-1]
|
||||||
if isinstance(list_obj, list):
|
try:
|
||||||
list_obj.extend(items)
|
extend = list_obj.extend
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
append = list_obj.append
|
extend(items)
|
||||||
for item in items:
|
return
|
||||||
append(item)
|
append = list_obj.append
|
||||||
|
for item in items:
|
||||||
|
append(item)
|
||||||
dispatch[APPENDS[0]] = load_appends
|
dispatch[APPENDS[0]] = load_appends
|
||||||
|
|
||||||
def load_setitem(self):
|
def load_setitem(self):
|
||||||
|
|
50
third_party/python/Lib/test/test_dict.py
vendored
50
third_party/python/Lib/test/test_dict.py
vendored
|
@ -272,11 +272,57 @@ class DictTest(unittest.TestCase):
|
||||||
self.assertEqual(baddict3.fromkeys({"a", "b", "c"}), res)
|
self.assertEqual(baddict3.fromkeys({"a", "b", "c"}), res)
|
||||||
|
|
||||||
def test_copy(self):
|
def test_copy(self):
|
||||||
d = {1:1, 2:2, 3:3}
|
d = {1: 1, 2: 2, 3: 3}
|
||||||
self.assertEqual(d.copy(), {1:1, 2:2, 3:3})
|
self.assertIsNot(d.copy(), d)
|
||||||
|
self.assertEqual(d.copy(), d)
|
||||||
|
self.assertEqual(d.copy(), {1: 1, 2: 2, 3: 3})
|
||||||
|
|
||||||
|
copy = d.copy()
|
||||||
|
d[4] = 4
|
||||||
|
self.assertNotEqual(copy, d)
|
||||||
|
|
||||||
self.assertEqual({}.copy(), {})
|
self.assertEqual({}.copy(), {})
|
||||||
self.assertRaises(TypeError, d.copy, None)
|
self.assertRaises(TypeError, d.copy, None)
|
||||||
|
|
||||||
|
def test_copy_fuzz(self):
|
||||||
|
for dict_size in [10, 100, 1000, 10000, 100000]:
|
||||||
|
dict_size = random.randrange(
|
||||||
|
dict_size // 2, dict_size + dict_size // 2)
|
||||||
|
with self.subTest(dict_size=dict_size):
|
||||||
|
d = {}
|
||||||
|
for i in range(dict_size):
|
||||||
|
d[i] = i
|
||||||
|
|
||||||
|
d2 = d.copy()
|
||||||
|
self.assertIsNot(d2, d)
|
||||||
|
self.assertEqual(d, d2)
|
||||||
|
d2['key'] = 'value'
|
||||||
|
self.assertNotEqual(d, d2)
|
||||||
|
self.assertEqual(len(d2), len(d) + 1)
|
||||||
|
|
||||||
|
def test_copy_maintains_tracking(self):
|
||||||
|
class A:
|
||||||
|
pass
|
||||||
|
|
||||||
|
key = A()
|
||||||
|
|
||||||
|
for d in ({}, {'a': 1}, {key: 'val'}):
|
||||||
|
d2 = d.copy()
|
||||||
|
self.assertEqual(gc.is_tracked(d), gc.is_tracked(d2))
|
||||||
|
|
||||||
|
def test_copy_noncompact(self):
|
||||||
|
# Dicts don't compact themselves on del/pop operations.
|
||||||
|
# Copy will use a slow merging strategy that produces
|
||||||
|
# a compacted copy when roughly 33% of dict is a non-used
|
||||||
|
# keys-space (to optimize memory footprint).
|
||||||
|
# In this test we want to hit the slow/compacting
|
||||||
|
# branch of dict.copy() and make sure it works OK.
|
||||||
|
d = {k: k for k in range(1000)}
|
||||||
|
for k in range(950):
|
||||||
|
del d[k]
|
||||||
|
d2 = d.copy()
|
||||||
|
self.assertEqual(d2, d)
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
d = {}
|
d = {}
|
||||||
self.assertIs(d.get('c'), None)
|
self.assertIs(d.get('c'), None)
|
||||||
|
|
11
third_party/python/Lib/test/test_exceptions.py
vendored
11
third_party/python/Lib/test/test_exceptions.py
vendored
|
@ -1162,27 +1162,20 @@ class ExceptionTests(unittest.TestCase):
|
||||||
# The following line is included in the traceback report:
|
# The following line is included in the traceback report:
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
class BrokenRepr(BrokenDel):
|
|
||||||
def __repr__(self):
|
|
||||||
raise AttributeError("repr() is broken")
|
|
||||||
|
|
||||||
class BrokenExceptionDel:
|
class BrokenExceptionDel:
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
exc = BrokenStrException()
|
exc = BrokenStrException()
|
||||||
# The following line is included in the traceback report:
|
# The following line is included in the traceback report:
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
for test_class in (BrokenDel, BrokenRepr, BrokenExceptionDel):
|
for test_class in (BrokenDel, BrokenExceptionDel):
|
||||||
with self.subTest(test_class):
|
with self.subTest(test_class):
|
||||||
obj = test_class()
|
obj = test_class()
|
||||||
with captured_stderr() as stderr:
|
with captured_stderr() as stderr:
|
||||||
del obj
|
del obj
|
||||||
report = stderr.getvalue()
|
report = stderr.getvalue()
|
||||||
self.assertIn("Exception ignored", report)
|
self.assertIn("Exception ignored", report)
|
||||||
if test_class is BrokenRepr:
|
self.assertIn(test_class.__del__.__qualname__, report)
|
||||||
self.assertIn("<object repr() failed>", report)
|
|
||||||
else:
|
|
||||||
self.assertIn(test_class.__del__.__qualname__, report)
|
|
||||||
self.assertIn("test_exceptions.py", report)
|
self.assertIn("test_exceptions.py", report)
|
||||||
self.assertIn("raise exc", report)
|
self.assertIn("raise exc", report)
|
||||||
if test_class is BrokenExceptionDel:
|
if test_class is BrokenExceptionDel:
|
||||||
|
|
40
third_party/python/Modules/_collectionsmodule.c
vendored
40
third_party/python/Modules/_collectionsmodule.c
vendored
|
@ -936,12 +936,18 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
deque_rotate(dequeobject *deque, PyObject *args)
|
deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
|
||||||
|
PyObject *kwnames)
|
||||||
{
|
{
|
||||||
Py_ssize_t n=1;
|
Py_ssize_t n=1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|n:rotate", &n))
|
if (!_PyArg_NoStackKeywords("rotate", kwnames)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!_PyArg_ParseStack(args, nargs, "|n:rotate", &n)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_deque_rotate(deque, n))
|
if (!_deque_rotate(deque, n))
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1070,7 +1076,8 @@ deque_len(dequeobject *deque)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
deque_index(dequeobject *deque, PyObject *args)
|
deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
|
||||||
|
PyObject *kwnames)
|
||||||
{
|
{
|
||||||
Py_ssize_t i, n, start=0, stop=Py_SIZE(deque);
|
Py_ssize_t i, n, start=0, stop=Py_SIZE(deque);
|
||||||
PyObject *v, *item;
|
PyObject *v, *item;
|
||||||
|
@ -1079,10 +1086,15 @@ deque_index(dequeobject *deque, PyObject *args)
|
||||||
size_t start_state = deque->state;
|
size_t start_state = deque->state;
|
||||||
int cmp;
|
int cmp;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|O&O&:index", &v,
|
if (!_PyArg_NoStackKeywords("index", kwnames)) {
|
||||||
_PyEval_SliceIndexNotNone, &start,
|
|
||||||
_PyEval_SliceIndexNotNone, &stop))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index", &v,
|
||||||
|
_PyEval_SliceIndex, &start,
|
||||||
|
_PyEval_SliceIndex, &stop)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (start < 0) {
|
if (start < 0) {
|
||||||
start += Py_SIZE(deque);
|
start += Py_SIZE(deque);
|
||||||
if (start < 0)
|
if (start < 0)
|
||||||
|
@ -1145,15 +1157,21 @@ PyDoc_STRVAR(index_doc,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
deque_insert(dequeobject *deque, PyObject *args)
|
deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
|
||||||
|
PyObject *kwnames)
|
||||||
{
|
{
|
||||||
Py_ssize_t index;
|
Py_ssize_t index;
|
||||||
Py_ssize_t n = Py_SIZE(deque);
|
Py_ssize_t n = Py_SIZE(deque);
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
PyObject *rv;
|
PyObject *rv;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "nO:insert", &index, &value))
|
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!_PyArg_ParseStack(args, nargs, "nO:insert", &index, &value)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (deque->maxlen == Py_SIZE(deque)) {
|
if (deque->maxlen == Py_SIZE(deque)) {
|
||||||
PyErr_SetString(PyExc_IndexError, "deque already at its maximum size");
|
PyErr_SetString(PyExc_IndexError, "deque already at its maximum size");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1623,9 +1641,9 @@ static PyMethodDef deque_methods[] = {
|
||||||
{"extendleft", (PyCFunction)deque_extendleft,
|
{"extendleft", (PyCFunction)deque_extendleft,
|
||||||
METH_O, extendleft_doc},
|
METH_O, extendleft_doc},
|
||||||
{"index", (PyCFunction)deque_index,
|
{"index", (PyCFunction)deque_index,
|
||||||
METH_VARARGS, index_doc},
|
METH_FASTCALL, index_doc},
|
||||||
{"insert", (PyCFunction)deque_insert,
|
{"insert", (PyCFunction)deque_insert,
|
||||||
METH_VARARGS, insert_doc},
|
METH_FASTCALL, insert_doc},
|
||||||
{"pop", (PyCFunction)deque_pop,
|
{"pop", (PyCFunction)deque_pop,
|
||||||
METH_NOARGS, pop_doc},
|
METH_NOARGS, pop_doc},
|
||||||
{"popleft", (PyCFunction)deque_popleft,
|
{"popleft", (PyCFunction)deque_popleft,
|
||||||
|
@ -1639,7 +1657,7 @@ static PyMethodDef deque_methods[] = {
|
||||||
{"reverse", (PyCFunction)deque_reverse,
|
{"reverse", (PyCFunction)deque_reverse,
|
||||||
METH_NOARGS, reverse_doc},
|
METH_NOARGS, reverse_doc},
|
||||||
{"rotate", (PyCFunction)deque_rotate,
|
{"rotate", (PyCFunction)deque_rotate,
|
||||||
METH_VARARGS, rotate_doc},
|
METH_FASTCALL, rotate_doc},
|
||||||
{"__sizeof__", (PyCFunction)deque_sizeof,
|
{"__sizeof__", (PyCFunction)deque_sizeof,
|
||||||
METH_NOARGS, sizeof_doc},
|
METH_NOARGS, sizeof_doc},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
|
|
3
third_party/python/Modules/_elementtree.c
vendored
3
third_party/python/Modules/_elementtree.c
vendored
|
@ -2807,7 +2807,8 @@ typedef struct {
|
||||||
} XMLParserObject;
|
} XMLParserObject;
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
_elementtree_XMLParser_doctype(XMLParserObject* self, PyObject* args);
|
_elementtree_XMLParser_doctype(XMLParserObject* self, PyObject** args,
|
||||||
|
Py_ssize_t nargs, PyObject* kwnames);
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
|
_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
|
||||||
PyObject *pubid, PyObject *system);
|
PyObject *pubid, PyObject *system);
|
||||||
|
|
|
@ -130,6 +130,11 @@ PyDoc_STRVAR(_io_open__doc__,
|
||||||
#define _IO_OPEN_METHODDEF \
|
#define _IO_OPEN_METHODDEF \
|
||||||
{"open", (PyCFunction)_io_open, METH_FASTCALL, _io_open__doc__},
|
{"open", (PyCFunction)_io_open, METH_FASTCALL, _io_open__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
|
||||||
|
int buffering, const char *encoding, const char *errors,
|
||||||
|
const char *newline, int closefd, PyObject *opener);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
_io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
|
@ -145,7 +150,7 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
int closefd = 1;
|
int closefd = 1;
|
||||||
PyObject *opener = Py_None;
|
PyObject *opener = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&file, &mode, &buffering, &encoding, &errors, &newline, &closefd, &opener)) {
|
&file, &mode, &buffering, &encoding, &errors, &newline, &closefd, &opener)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -154,4 +159,4 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=c5b8fc8b83102bbf input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=79fd04d9c9d8f28f input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -11,6 +11,8 @@ PyDoc_STRVAR(_io__BufferedIOBase_readinto__doc__,
|
||||||
#define _IO__BUFFEREDIOBASE_READINTO_METHODDEF \
|
#define _IO__BUFFEREDIOBASE_READINTO_METHODDEF \
|
||||||
{"readinto", (PyCFunction)_io__BufferedIOBase_readinto, METH_O, _io__BufferedIOBase_readinto__doc__},
|
{"readinto", (PyCFunction)_io__BufferedIOBase_readinto, METH_O, _io__BufferedIOBase_readinto__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__BufferedIOBase_readinto_impl(PyObject *self, Py_buffer *buffer);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__BufferedIOBase_readinto(PyObject *self, PyObject *arg)
|
_io__BufferedIOBase_readinto(PyObject *self, PyObject *arg)
|
||||||
|
@ -90,21 +92,25 @@ PyDoc_STRVAR(_io__Buffered_peek__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO__BUFFERED_PEEK_METHODDEF \
|
#define _IO__BUFFERED_PEEK_METHODDEF \
|
||||||
{"peek", (PyCFunction)_io__Buffered_peek, METH_VARARGS, _io__Buffered_peek__doc__},
|
{"peek", (PyCFunction)_io__Buffered_peek, METH_FASTCALL, _io__Buffered_peek__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_peek_impl(buffered *self, Py_ssize_t size);
|
_io__Buffered_peek_impl(buffered *self, Py_ssize_t size);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_peek(buffered *self, PyObject *args)
|
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t size = 0;
|
Py_ssize_t size = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|n:peek",
|
if (!_PyArg_ParseStack(args, nargs, "|n:peek",
|
||||||
&size)) {
|
&size)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("peek", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__Buffered_peek_impl(self, size);
|
return_value = _io__Buffered_peek_impl(self, size);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -117,21 +123,25 @@ PyDoc_STRVAR(_io__Buffered_read__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO__BUFFERED_READ_METHODDEF \
|
#define _IO__BUFFERED_READ_METHODDEF \
|
||||||
{"read", (PyCFunction)_io__Buffered_read, METH_VARARGS, _io__Buffered_read__doc__},
|
{"read", (PyCFunction)_io__Buffered_read, METH_FASTCALL, _io__Buffered_read__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_read_impl(buffered *self, Py_ssize_t n);
|
_io__Buffered_read_impl(buffered *self, Py_ssize_t n);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_read(buffered *self, PyObject *args)
|
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t n = -1;
|
Py_ssize_t n = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O&:read",
|
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
|
||||||
_PyIO_ConvertSsize_t, &n)) {
|
_PyIO_ConvertSsize_t, &n)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__Buffered_read_impl(self, n);
|
return_value = _io__Buffered_read_impl(self, n);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -232,21 +242,25 @@ PyDoc_STRVAR(_io__Buffered_readline__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO__BUFFERED_READLINE_METHODDEF \
|
#define _IO__BUFFERED_READLINE_METHODDEF \
|
||||||
{"readline", (PyCFunction)_io__Buffered_readline, METH_VARARGS, _io__Buffered_readline__doc__},
|
{"readline", (PyCFunction)_io__Buffered_readline, METH_FASTCALL, _io__Buffered_readline__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_readline_impl(buffered *self, Py_ssize_t size);
|
_io__Buffered_readline_impl(buffered *self, Py_ssize_t size);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_readline(buffered *self, PyObject *args)
|
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t size = -1;
|
Py_ssize_t size = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O&:readline",
|
if (!_PyArg_ParseStack(args, nargs, "|O&:readline",
|
||||||
_PyIO_ConvertSsize_t, &size)) {
|
_PyIO_ConvertSsize_t, &size)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__Buffered_readline_impl(self, size);
|
return_value = _io__Buffered_readline_impl(self, size);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -259,22 +273,26 @@ PyDoc_STRVAR(_io__Buffered_seek__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO__BUFFERED_SEEK_METHODDEF \
|
#define _IO__BUFFERED_SEEK_METHODDEF \
|
||||||
{"seek", (PyCFunction)_io__Buffered_seek, METH_VARARGS, _io__Buffered_seek__doc__},
|
{"seek", (PyCFunction)_io__Buffered_seek, METH_FASTCALL, _io__Buffered_seek__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);
|
_io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_seek(buffered *self, PyObject *args)
|
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *targetobj;
|
PyObject *targetobj;
|
||||||
int whence = 0;
|
int whence = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|i:seek",
|
if (!_PyArg_ParseStack(args, nargs, "O|i:seek",
|
||||||
&targetobj, &whence)) {
|
&targetobj, &whence)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__Buffered_seek_impl(self, targetobj, whence);
|
return_value = _io__Buffered_seek_impl(self, targetobj, whence);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -287,22 +305,26 @@ PyDoc_STRVAR(_io__Buffered_truncate__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO__BUFFERED_TRUNCATE_METHODDEF \
|
#define _IO__BUFFERED_TRUNCATE_METHODDEF \
|
||||||
{"truncate", (PyCFunction)_io__Buffered_truncate, METH_VARARGS, _io__Buffered_truncate__doc__},
|
{"truncate", (PyCFunction)_io__Buffered_truncate, METH_FASTCALL, _io__Buffered_truncate__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_truncate_impl(buffered *self, PyObject *pos);
|
_io__Buffered_truncate_impl(buffered *self, PyObject *pos);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__Buffered_truncate(buffered *self, PyObject *args)
|
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *pos = Py_None;
|
PyObject *pos = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "truncate",
|
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||||
0, 1,
|
0, 1,
|
||||||
&pos)) {
|
&pos)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__Buffered_truncate_impl(self, pos);
|
return_value = _io__Buffered_truncate_impl(self, pos);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -474,4 +496,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=a956f394ecde4cf9 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=c526190c51a616c8 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -159,22 +159,26 @@ PyDoc_STRVAR(_io_BytesIO_read__doc__,
|
||||||
"Return an empty bytes object at EOF.");
|
"Return an empty bytes object at EOF.");
|
||||||
|
|
||||||
#define _IO_BYTESIO_READ_METHODDEF \
|
#define _IO_BYTESIO_READ_METHODDEF \
|
||||||
{"read", (PyCFunction)_io_BytesIO_read, METH_VARARGS, _io_BytesIO_read__doc__},
|
{"read", (PyCFunction)_io_BytesIO_read, METH_FASTCALL, _io_BytesIO_read__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_read_impl(bytesio *self, PyObject *arg);
|
_io_BytesIO_read_impl(bytesio *self, PyObject *arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_read(bytesio *self, PyObject *args)
|
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *arg = Py_None;
|
PyObject *arg = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "read",
|
if (!_PyArg_UnpackStack(args, nargs, "read",
|
||||||
0, 1,
|
0, 1,
|
||||||
&arg)) {
|
&arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_BytesIO_read_impl(self, arg);
|
return_value = _io_BytesIO_read_impl(self, arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -204,22 +208,26 @@ PyDoc_STRVAR(_io_BytesIO_readline__doc__,
|
||||||
"Return an empty bytes object at EOF.");
|
"Return an empty bytes object at EOF.");
|
||||||
|
|
||||||
#define _IO_BYTESIO_READLINE_METHODDEF \
|
#define _IO_BYTESIO_READLINE_METHODDEF \
|
||||||
{"readline", (PyCFunction)_io_BytesIO_readline, METH_VARARGS, _io_BytesIO_readline__doc__},
|
{"readline", (PyCFunction)_io_BytesIO_readline, METH_FASTCALL, _io_BytesIO_readline__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_readline_impl(bytesio *self, PyObject *arg);
|
_io_BytesIO_readline_impl(bytesio *self, PyObject *arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_readline(bytesio *self, PyObject *args)
|
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *arg = Py_None;
|
PyObject *arg = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "readline",
|
if (!_PyArg_UnpackStack(args, nargs, "readline",
|
||||||
0, 1,
|
0, 1,
|
||||||
&arg)) {
|
&arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_BytesIO_readline_impl(self, arg);
|
return_value = _io_BytesIO_readline_impl(self, arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -237,22 +245,26 @@ PyDoc_STRVAR(_io_BytesIO_readlines__doc__,
|
||||||
"total number of bytes in the lines returned.");
|
"total number of bytes in the lines returned.");
|
||||||
|
|
||||||
#define _IO_BYTESIO_READLINES_METHODDEF \
|
#define _IO_BYTESIO_READLINES_METHODDEF \
|
||||||
{"readlines", (PyCFunction)_io_BytesIO_readlines, METH_VARARGS, _io_BytesIO_readlines__doc__},
|
{"readlines", (PyCFunction)_io_BytesIO_readlines, METH_FASTCALL, _io_BytesIO_readlines__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_readlines_impl(bytesio *self, PyObject *arg);
|
_io_BytesIO_readlines_impl(bytesio *self, PyObject *arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_readlines(bytesio *self, PyObject *args)
|
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *arg = Py_None;
|
PyObject *arg = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "readlines",
|
if (!_PyArg_UnpackStack(args, nargs, "readlines",
|
||||||
0, 1,
|
0, 1,
|
||||||
&arg)) {
|
&arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_BytesIO_readlines_impl(self, arg);
|
return_value = _io_BytesIO_readlines_impl(self, arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -304,22 +316,26 @@ PyDoc_STRVAR(_io_BytesIO_truncate__doc__,
|
||||||
"The current file position is unchanged. Returns the new size.");
|
"The current file position is unchanged. Returns the new size.");
|
||||||
|
|
||||||
#define _IO_BYTESIO_TRUNCATE_METHODDEF \
|
#define _IO_BYTESIO_TRUNCATE_METHODDEF \
|
||||||
{"truncate", (PyCFunction)_io_BytesIO_truncate, METH_VARARGS, _io_BytesIO_truncate__doc__},
|
{"truncate", (PyCFunction)_io_BytesIO_truncate, METH_FASTCALL, _io_BytesIO_truncate__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_truncate_impl(bytesio *self, PyObject *arg);
|
_io_BytesIO_truncate_impl(bytesio *self, PyObject *arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_truncate(bytesio *self, PyObject *args)
|
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *arg = Py_None;
|
PyObject *arg = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "truncate",
|
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||||
0, 1,
|
0, 1,
|
||||||
&arg)) {
|
&arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_BytesIO_truncate_impl(self, arg);
|
return_value = _io_BytesIO_truncate_impl(self, arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -339,22 +355,26 @@ PyDoc_STRVAR(_io_BytesIO_seek__doc__,
|
||||||
"Returns the new absolute position.");
|
"Returns the new absolute position.");
|
||||||
|
|
||||||
#define _IO_BYTESIO_SEEK_METHODDEF \
|
#define _IO_BYTESIO_SEEK_METHODDEF \
|
||||||
{"seek", (PyCFunction)_io_BytesIO_seek, METH_VARARGS, _io_BytesIO_seek__doc__},
|
{"seek", (PyCFunction)_io_BytesIO_seek, METH_FASTCALL, _io_BytesIO_seek__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence);
|
_io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_BytesIO_seek(bytesio *self, PyObject *args)
|
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t pos;
|
Py_ssize_t pos;
|
||||||
int whence = 0;
|
int whence = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "n|i:seek",
|
if (!_PyArg_ParseStack(args, nargs, "n|i:seek",
|
||||||
&pos, &whence)) {
|
&pos, &whence)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_BytesIO_seek_impl(self, pos, whence);
|
return_value = _io_BytesIO_seek_impl(self, pos, whence);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -429,4 +449,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=6382e8eb578eea64 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=08139186b009ec47 input=a9049054013a1b77]*/
|
||||||
|
|
39
third_party/python/Modules/_io/clinic/fileio.inc
vendored
39
third_party/python/Modules/_io/clinic/fileio.inc
vendored
|
@ -15,6 +15,9 @@ PyDoc_STRVAR(_io_FileIO_close__doc__,
|
||||||
#define _IO_FILEIO_CLOSE_METHODDEF \
|
#define _IO_FILEIO_CLOSE_METHODDEF \
|
||||||
{"close", (PyCFunction)_io_FileIO_close, METH_NOARGS, _io_FileIO_close__doc__},
|
{"close", (PyCFunction)_io_FileIO_close, METH_NOARGS, _io_FileIO_close__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io_FileIO_close_impl(fileio *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_FileIO_close(fileio *self, PyObject *Py_UNUSED(ignored))
|
_io_FileIO_close(fileio *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -39,6 +42,10 @@ PyDoc_STRVAR(_io_FileIO___init____doc__,
|
||||||
"*opener* must return an open file descriptor (passing os.open as *opener*\n"
|
"*opener* must return an open file descriptor (passing os.open as *opener*\n"
|
||||||
"results in functionality similar to passing None).");
|
"results in functionality similar to passing None).");
|
||||||
|
|
||||||
|
static int
|
||||||
|
_io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
|
||||||
|
int closefd, PyObject *opener);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
_io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
|
@ -196,21 +203,25 @@ PyDoc_STRVAR(_io_FileIO_read__doc__,
|
||||||
"Return an empty bytes object at EOF.");
|
"Return an empty bytes object at EOF.");
|
||||||
|
|
||||||
#define _IO_FILEIO_READ_METHODDEF \
|
#define _IO_FILEIO_READ_METHODDEF \
|
||||||
{"read", (PyCFunction)_io_FileIO_read, METH_VARARGS, _io_FileIO_read__doc__},
|
{"read", (PyCFunction)_io_FileIO_read, METH_FASTCALL, _io_FileIO_read__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_FileIO_read_impl(fileio *self, Py_ssize_t size);
|
_io_FileIO_read_impl(fileio *self, Py_ssize_t size);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_FileIO_read(fileio *self, PyObject *args)
|
_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t size = -1;
|
Py_ssize_t size = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O&:read",
|
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
|
||||||
_PyIO_ConvertSsize_t, &size)) {
|
_PyIO_ConvertSsize_t, &size)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_FileIO_read_impl(self, size);
|
return_value = _io_FileIO_read_impl(self, size);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -268,22 +279,26 @@ PyDoc_STRVAR(_io_FileIO_seek__doc__,
|
||||||
"Note that not all file objects are seekable.");
|
"Note that not all file objects are seekable.");
|
||||||
|
|
||||||
#define _IO_FILEIO_SEEK_METHODDEF \
|
#define _IO_FILEIO_SEEK_METHODDEF \
|
||||||
{"seek", (PyCFunction)_io_FileIO_seek, METH_VARARGS, _io_FileIO_seek__doc__},
|
{"seek", (PyCFunction)_io_FileIO_seek, METH_FASTCALL, _io_FileIO_seek__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence);
|
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_FileIO_seek(fileio *self, PyObject *args)
|
_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *pos;
|
PyObject *pos;
|
||||||
int whence = 0;
|
int whence = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|i:seek",
|
if (!_PyArg_ParseStack(args, nargs, "O|i:seek",
|
||||||
&pos, &whence)) {
|
&pos, &whence)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_FileIO_seek_impl(self, pos, whence);
|
return_value = _io_FileIO_seek_impl(self, pos, whence);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -322,22 +337,26 @@ PyDoc_STRVAR(_io_FileIO_truncate__doc__,
|
||||||
"The current file position is changed to the value of size.");
|
"The current file position is changed to the value of size.");
|
||||||
|
|
||||||
#define _IO_FILEIO_TRUNCATE_METHODDEF \
|
#define _IO_FILEIO_TRUNCATE_METHODDEF \
|
||||||
{"truncate", (PyCFunction)_io_FileIO_truncate, METH_VARARGS, _io_FileIO_truncate__doc__},
|
{"truncate", (PyCFunction)_io_FileIO_truncate, METH_FASTCALL, _io_FileIO_truncate__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_FileIO_truncate_impl(fileio *self, PyObject *posobj);
|
_io_FileIO_truncate_impl(fileio *self, PyObject *posobj);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_FileIO_truncate(fileio *self, PyObject *args)
|
_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *posobj = NULL;
|
PyObject *posobj = NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "truncate",
|
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||||
0, 1,
|
0, 1,
|
||||||
&posobj)) {
|
&posobj)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_FileIO_truncate_impl(self, posobj);
|
return_value = _io_FileIO_truncate_impl(self, posobj);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -367,4 +386,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
|
||||||
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
|
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
|
||||||
#define _IO_FILEIO_TRUNCATE_METHODDEF
|
#define _IO_FILEIO_TRUNCATE_METHODDEF
|
||||||
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
|
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
|
||||||
/*[clinic end generated code: output=51924bc0ee11d58e input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=034d782a0daa82bd input=a9049054013a1b77]*/
|
||||||
|
|
62
third_party/python/Modules/_io/clinic/iobase.inc
vendored
62
third_party/python/Modules/_io/clinic/iobase.inc
vendored
|
@ -12,6 +12,9 @@ PyDoc_STRVAR(_io__IOBase_tell__doc__,
|
||||||
#define _IO__IOBASE_TELL_METHODDEF \
|
#define _IO__IOBASE_TELL_METHODDEF \
|
||||||
{"tell", (PyCFunction)_io__IOBase_tell, METH_NOARGS, _io__IOBase_tell__doc__},
|
{"tell", (PyCFunction)_io__IOBase_tell, METH_NOARGS, _io__IOBase_tell__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_tell_impl(PyObject *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_tell(PyObject *self, PyObject *Py_UNUSED(ignored))
|
_io__IOBase_tell(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -29,6 +32,9 @@ PyDoc_STRVAR(_io__IOBase_flush__doc__,
|
||||||
#define _IO__IOBASE_FLUSH_METHODDEF \
|
#define _IO__IOBASE_FLUSH_METHODDEF \
|
||||||
{"flush", (PyCFunction)_io__IOBase_flush, METH_NOARGS, _io__IOBase_flush__doc__},
|
{"flush", (PyCFunction)_io__IOBase_flush, METH_NOARGS, _io__IOBase_flush__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_flush_impl(PyObject *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_flush(PyObject *self, PyObject *Py_UNUSED(ignored))
|
_io__IOBase_flush(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -46,6 +52,9 @@ PyDoc_STRVAR(_io__IOBase_close__doc__,
|
||||||
#define _IO__IOBASE_CLOSE_METHODDEF \
|
#define _IO__IOBASE_CLOSE_METHODDEF \
|
||||||
{"close", (PyCFunction)_io__IOBase_close, METH_NOARGS, _io__IOBase_close__doc__},
|
{"close", (PyCFunction)_io__IOBase_close, METH_NOARGS, _io__IOBase_close__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_close_impl(PyObject *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_close(PyObject *self, PyObject *Py_UNUSED(ignored))
|
_io__IOBase_close(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -64,6 +73,9 @@ PyDoc_STRVAR(_io__IOBase_seekable__doc__,
|
||||||
#define _IO__IOBASE_SEEKABLE_METHODDEF \
|
#define _IO__IOBASE_SEEKABLE_METHODDEF \
|
||||||
{"seekable", (PyCFunction)_io__IOBase_seekable, METH_NOARGS, _io__IOBase_seekable__doc__},
|
{"seekable", (PyCFunction)_io__IOBase_seekable, METH_NOARGS, _io__IOBase_seekable__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_seekable_impl(PyObject *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_seekable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
_io__IOBase_seekable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -81,6 +93,9 @@ PyDoc_STRVAR(_io__IOBase_readable__doc__,
|
||||||
#define _IO__IOBASE_READABLE_METHODDEF \
|
#define _IO__IOBASE_READABLE_METHODDEF \
|
||||||
{"readable", (PyCFunction)_io__IOBase_readable, METH_NOARGS, _io__IOBase_readable__doc__},
|
{"readable", (PyCFunction)_io__IOBase_readable, METH_NOARGS, _io__IOBase_readable__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_readable_impl(PyObject *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_readable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
_io__IOBase_readable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -98,6 +113,9 @@ PyDoc_STRVAR(_io__IOBase_writable__doc__,
|
||||||
#define _IO__IOBASE_WRITABLE_METHODDEF \
|
#define _IO__IOBASE_WRITABLE_METHODDEF \
|
||||||
{"writable", (PyCFunction)_io__IOBase_writable, METH_NOARGS, _io__IOBase_writable__doc__},
|
{"writable", (PyCFunction)_io__IOBase_writable, METH_NOARGS, _io__IOBase_writable__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_writable_impl(PyObject *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_writable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
_io__IOBase_writable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -115,6 +133,9 @@ PyDoc_STRVAR(_io__IOBase_fileno__doc__,
|
||||||
#define _IO__IOBASE_FILENO_METHODDEF \
|
#define _IO__IOBASE_FILENO_METHODDEF \
|
||||||
{"fileno", (PyCFunction)_io__IOBase_fileno, METH_NOARGS, _io__IOBase_fileno__doc__},
|
{"fileno", (PyCFunction)_io__IOBase_fileno, METH_NOARGS, _io__IOBase_fileno__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_fileno_impl(PyObject *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_fileno(PyObject *self, PyObject *Py_UNUSED(ignored))
|
_io__IOBase_fileno(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -132,6 +153,9 @@ PyDoc_STRVAR(_io__IOBase_isatty__doc__,
|
||||||
#define _IO__IOBASE_ISATTY_METHODDEF \
|
#define _IO__IOBASE_ISATTY_METHODDEF \
|
||||||
{"isatty", (PyCFunction)_io__IOBase_isatty, METH_NOARGS, _io__IOBase_isatty__doc__},
|
{"isatty", (PyCFunction)_io__IOBase_isatty, METH_NOARGS, _io__IOBase_isatty__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_isatty_impl(PyObject *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_isatty(PyObject *self, PyObject *Py_UNUSED(ignored))
|
_io__IOBase_isatty(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -151,18 +175,25 @@ PyDoc_STRVAR(_io__IOBase_readline__doc__,
|
||||||
"terminator(s) recognized.");
|
"terminator(s) recognized.");
|
||||||
|
|
||||||
#define _IO__IOBASE_READLINE_METHODDEF \
|
#define _IO__IOBASE_READLINE_METHODDEF \
|
||||||
{"readline", (PyCFunction)_io__IOBase_readline, METH_VARARGS, _io__IOBase_readline__doc__},
|
{"readline", (PyCFunction)_io__IOBase_readline, METH_FASTCALL, _io__IOBase_readline__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_readline(PyObject *self, PyObject *args)
|
_io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_readline(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t limit = -1;
|
Py_ssize_t limit = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O&:readline",
|
if (!_PyArg_ParseStack(args, nargs, "|O&:readline",
|
||||||
_PyIO_ConvertSsize_t, &limit)) {
|
_PyIO_ConvertSsize_t, &limit)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__IOBase_readline_impl(self, limit);
|
return_value = _io__IOBase_readline_impl(self, limit);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -180,18 +211,25 @@ PyDoc_STRVAR(_io__IOBase_readlines__doc__,
|
||||||
"lines so far exceeds hint.");
|
"lines so far exceeds hint.");
|
||||||
|
|
||||||
#define _IO__IOBASE_READLINES_METHODDEF \
|
#define _IO__IOBASE_READLINES_METHODDEF \
|
||||||
{"readlines", (PyCFunction)_io__IOBase_readlines, METH_VARARGS, _io__IOBase_readlines__doc__},
|
{"readlines", (PyCFunction)_io__IOBase_readlines, METH_FASTCALL, _io__IOBase_readlines__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__IOBase_readlines(PyObject *self, PyObject *args)
|
_io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io__IOBase_readlines(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t hint = -1;
|
Py_ssize_t hint = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O&:readlines",
|
if (!_PyArg_ParseStack(args, nargs, "|O&:readlines",
|
||||||
_PyIO_ConvertSsize_t, &hint)) {
|
_PyIO_ConvertSsize_t, &hint)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__IOBase_readlines_impl(self, hint);
|
return_value = _io__IOBase_readlines_impl(self, hint);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -212,21 +250,25 @@ PyDoc_STRVAR(_io__RawIOBase_read__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO__RAWIOBASE_READ_METHODDEF \
|
#define _IO__RAWIOBASE_READ_METHODDEF \
|
||||||
{"read", (PyCFunction)_io__RawIOBase_read, METH_VARARGS, _io__RawIOBase_read__doc__},
|
{"read", (PyCFunction)_io__RawIOBase_read, METH_FASTCALL, _io__RawIOBase_read__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n);
|
_io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__RawIOBase_read(PyObject *self, PyObject *args)
|
_io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t n = -1;
|
Py_ssize_t n = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|n:read",
|
if (!_PyArg_ParseStack(args, nargs, "|n:read",
|
||||||
&n)) {
|
&n)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__RawIOBase_read_impl(self, n);
|
return_value = _io__RawIOBase_read_impl(self, n);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -250,4 +292,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
return _io__RawIOBase_readall_impl(self);
|
return _io__RawIOBase_readall_impl(self);
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=0f53fed928d8e02f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=1bcece367fc7b0cd input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -12,6 +12,9 @@ PyDoc_STRVAR(_io_StringIO_getvalue__doc__,
|
||||||
#define _IO_STRINGIO_GETVALUE_METHODDEF \
|
#define _IO_STRINGIO_GETVALUE_METHODDEF \
|
||||||
{"getvalue", (PyCFunction)_io_StringIO_getvalue, METH_NOARGS, _io_StringIO_getvalue__doc__},
|
{"getvalue", (PyCFunction)_io_StringIO_getvalue, METH_NOARGS, _io_StringIO_getvalue__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_io_StringIO_getvalue_impl(stringio *self);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_getvalue(stringio *self, PyObject *Py_UNUSED(ignored))
|
_io_StringIO_getvalue(stringio *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
|
@ -46,22 +49,26 @@ PyDoc_STRVAR(_io_StringIO_read__doc__,
|
||||||
"is reached. Return an empty string at EOF.");
|
"is reached. Return an empty string at EOF.");
|
||||||
|
|
||||||
#define _IO_STRINGIO_READ_METHODDEF \
|
#define _IO_STRINGIO_READ_METHODDEF \
|
||||||
{"read", (PyCFunction)_io_StringIO_read, METH_VARARGS, _io_StringIO_read__doc__},
|
{"read", (PyCFunction)_io_StringIO_read, METH_FASTCALL, _io_StringIO_read__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_read_impl(stringio *self, PyObject *arg);
|
_io_StringIO_read_impl(stringio *self, PyObject *arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_read(stringio *self, PyObject *args)
|
_io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *arg = Py_None;
|
PyObject *arg = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "read",
|
if (!_PyArg_UnpackStack(args, nargs, "read",
|
||||||
0, 1,
|
0, 1,
|
||||||
&arg)) {
|
&arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_StringIO_read_impl(self, arg);
|
return_value = _io_StringIO_read_impl(self, arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -77,22 +84,26 @@ PyDoc_STRVAR(_io_StringIO_readline__doc__,
|
||||||
"Returns an empty string if EOF is hit immediately.");
|
"Returns an empty string if EOF is hit immediately.");
|
||||||
|
|
||||||
#define _IO_STRINGIO_READLINE_METHODDEF \
|
#define _IO_STRINGIO_READLINE_METHODDEF \
|
||||||
{"readline", (PyCFunction)_io_StringIO_readline, METH_VARARGS, _io_StringIO_readline__doc__},
|
{"readline", (PyCFunction)_io_StringIO_readline, METH_FASTCALL, _io_StringIO_readline__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_readline_impl(stringio *self, PyObject *arg);
|
_io_StringIO_readline_impl(stringio *self, PyObject *arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_readline(stringio *self, PyObject *args)
|
_io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *arg = Py_None;
|
PyObject *arg = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "readline",
|
if (!_PyArg_UnpackStack(args, nargs, "readline",
|
||||||
0, 1,
|
0, 1,
|
||||||
&arg)) {
|
&arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_StringIO_readline_impl(self, arg);
|
return_value = _io_StringIO_readline_impl(self, arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -110,22 +121,26 @@ PyDoc_STRVAR(_io_StringIO_truncate__doc__,
|
||||||
"Returns the new absolute position.");
|
"Returns the new absolute position.");
|
||||||
|
|
||||||
#define _IO_STRINGIO_TRUNCATE_METHODDEF \
|
#define _IO_STRINGIO_TRUNCATE_METHODDEF \
|
||||||
{"truncate", (PyCFunction)_io_StringIO_truncate, METH_VARARGS, _io_StringIO_truncate__doc__},
|
{"truncate", (PyCFunction)_io_StringIO_truncate, METH_FASTCALL, _io_StringIO_truncate__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_truncate_impl(stringio *self, PyObject *arg);
|
_io_StringIO_truncate_impl(stringio *self, PyObject *arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_truncate(stringio *self, PyObject *args)
|
_io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *arg = Py_None;
|
PyObject *arg = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "truncate",
|
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||||
0, 1,
|
0, 1,
|
||||||
&arg)) {
|
&arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_StringIO_truncate_impl(self, arg);
|
return_value = _io_StringIO_truncate_impl(self, arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -145,22 +160,26 @@ PyDoc_STRVAR(_io_StringIO_seek__doc__,
|
||||||
"Returns the new absolute position.");
|
"Returns the new absolute position.");
|
||||||
|
|
||||||
#define _IO_STRINGIO_SEEK_METHODDEF \
|
#define _IO_STRINGIO_SEEK_METHODDEF \
|
||||||
{"seek", (PyCFunction)_io_StringIO_seek, METH_VARARGS, _io_StringIO_seek__doc__},
|
{"seek", (PyCFunction)_io_StringIO_seek, METH_FASTCALL, _io_StringIO_seek__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence);
|
_io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_StringIO_seek(stringio *self, PyObject *args)
|
_io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t pos;
|
Py_ssize_t pos;
|
||||||
int whence = 0;
|
int whence = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "n|i:seek",
|
if (!_PyArg_ParseStack(args, nargs, "n|i:seek",
|
||||||
&pos, &whence)) {
|
&pos, &whence)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_StringIO_seek_impl(self, pos, whence);
|
return_value = _io_StringIO_seek_impl(self, pos, whence);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -287,4 +306,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
return _io_StringIO_seekable_impl(self);
|
return _io_StringIO_seekable_impl(self);
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=5dd5c2a213e75405 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=ce8018ec29def422 input=a9049054013a1b77]*/
|
||||||
|
|
50
third_party/python/Modules/_io/clinic/textio.inc
vendored
50
third_party/python/Modules/_io/clinic/textio.inc
vendored
|
@ -1,9 +1,3 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Python 3 │
|
|
||||||
│ https://docs.python.org/3/license.html │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
preserve
|
preserve
|
||||||
|
@ -68,7 +62,7 @@ _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject **args, Py
|
||||||
PyObject *input;
|
PyObject *input;
|
||||||
int final = 0;
|
int final = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&input, &final)) {
|
&input, &final)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -232,21 +226,25 @@ PyDoc_STRVAR(_io_TextIOWrapper_read__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO_TEXTIOWRAPPER_READ_METHODDEF \
|
#define _IO_TEXTIOWRAPPER_READ_METHODDEF \
|
||||||
{"read", (PyCFunction)_io_TextIOWrapper_read, METH_VARARGS, _io_TextIOWrapper_read__doc__},
|
{"read", (PyCFunction)_io_TextIOWrapper_read, METH_FASTCALL, _io_TextIOWrapper_read__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n);
|
_io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_TextIOWrapper_read(textio *self, PyObject *args)
|
_io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t n = -1;
|
Py_ssize_t n = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O&:read",
|
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
|
||||||
_PyIO_ConvertSsize_t, &n)) {
|
_PyIO_ConvertSsize_t, &n)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_TextIOWrapper_read_impl(self, n);
|
return_value = _io_TextIOWrapper_read_impl(self, n);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -259,21 +257,25 @@ PyDoc_STRVAR(_io_TextIOWrapper_readline__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO_TEXTIOWRAPPER_READLINE_METHODDEF \
|
#define _IO_TEXTIOWRAPPER_READLINE_METHODDEF \
|
||||||
{"readline", (PyCFunction)_io_TextIOWrapper_readline, METH_VARARGS, _io_TextIOWrapper_readline__doc__},
|
{"readline", (PyCFunction)_io_TextIOWrapper_readline, METH_FASTCALL, _io_TextIOWrapper_readline__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size);
|
_io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_TextIOWrapper_readline(textio *self, PyObject *args)
|
_io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t size = -1;
|
Py_ssize_t size = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|n:readline",
|
if (!_PyArg_ParseStack(args, nargs, "|n:readline",
|
||||||
&size)) {
|
&size)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_TextIOWrapper_readline_impl(self, size);
|
return_value = _io_TextIOWrapper_readline_impl(self, size);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -286,22 +288,26 @@ PyDoc_STRVAR(_io_TextIOWrapper_seek__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO_TEXTIOWRAPPER_SEEK_METHODDEF \
|
#define _IO_TEXTIOWRAPPER_SEEK_METHODDEF \
|
||||||
{"seek", (PyCFunction)_io_TextIOWrapper_seek, METH_VARARGS, _io_TextIOWrapper_seek__doc__},
|
{"seek", (PyCFunction)_io_TextIOWrapper_seek, METH_FASTCALL, _io_TextIOWrapper_seek__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence);
|
_io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_TextIOWrapper_seek(textio *self, PyObject *args)
|
_io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *cookieObj;
|
PyObject *cookieObj;
|
||||||
int whence = 0;
|
int whence = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|i:seek",
|
if (!_PyArg_ParseStack(args, nargs, "O|i:seek",
|
||||||
&cookieObj, &whence)) {
|
&cookieObj, &whence)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence);
|
return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -331,22 +337,26 @@ PyDoc_STRVAR(_io_TextIOWrapper_truncate__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _IO_TEXTIOWRAPPER_TRUNCATE_METHODDEF \
|
#define _IO_TEXTIOWRAPPER_TRUNCATE_METHODDEF \
|
||||||
{"truncate", (PyCFunction)_io_TextIOWrapper_truncate, METH_VARARGS, _io_TextIOWrapper_truncate__doc__},
|
{"truncate", (PyCFunction)_io_TextIOWrapper_truncate, METH_FASTCALL, _io_TextIOWrapper_truncate__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos);
|
_io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io_TextIOWrapper_truncate(textio *self, PyObject *args)
|
_io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *pos = Py_None;
|
PyObject *pos = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "truncate",
|
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||||
0, 1,
|
0, 1,
|
||||||
&pos)) {
|
&pos)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io_TextIOWrapper_truncate_impl(self, pos);
|
return_value = _io_TextIOWrapper_truncate_impl(self, pos);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -471,4 +481,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
return _io_TextIOWrapper_close_impl(self);
|
return _io_TextIOWrapper_close_impl(self);
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=78ad14eba1667254 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=67eba50449900a96 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_close__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_close__doc__,
|
||||||
"close($self, /)\n"
|
"close($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -26,10 +24,6 @@ _io__WindowsConsoleIO_close(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
||||||
return _io__WindowsConsoleIO_close_impl(self);
|
return _io__WindowsConsoleIO_close_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO___init____doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO___init____doc__,
|
||||||
"_WindowsConsoleIO(file, mode=\'r\', closefd=True, opener=None)\n"
|
"_WindowsConsoleIO(file, mode=\'r\', closefd=True, opener=None)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -66,10 +60,6 @@ exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_fileno__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_fileno__doc__,
|
||||||
"fileno($self, /)\n"
|
"fileno($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -91,10 +81,6 @@ _io__WindowsConsoleIO_fileno(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
||||||
return _io__WindowsConsoleIO_fileno_impl(self);
|
return _io__WindowsConsoleIO_fileno_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readable__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_readable__doc__,
|
||||||
"readable($self, /)\n"
|
"readable($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -113,10 +99,6 @@ _io__WindowsConsoleIO_readable(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
||||||
return _io__WindowsConsoleIO_readable_impl(self);
|
return _io__WindowsConsoleIO_readable_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_writable__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_writable__doc__,
|
||||||
"writable($self, /)\n"
|
"writable($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -135,10 +117,6 @@ _io__WindowsConsoleIO_writable(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
||||||
return _io__WindowsConsoleIO_writable_impl(self);
|
return _io__WindowsConsoleIO_writable_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readinto__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_readinto__doc__,
|
||||||
"readinto($self, buffer, /)\n"
|
"readinto($self, buffer, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -171,10 +149,6 @@ exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readall__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_readall__doc__,
|
||||||
"readall($self, /)\n"
|
"readall($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -195,10 +169,6 @@ _io__WindowsConsoleIO_readall(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
||||||
return _io__WindowsConsoleIO_readall_impl(self);
|
return _io__WindowsConsoleIO_readall_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
|
||||||
"read($self, size=-1, /)\n"
|
"read($self, size=-1, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -210,31 +180,31 @@ PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
|
||||||
"Return an empty bytes object at EOF.");
|
"Return an empty bytes object at EOF.");
|
||||||
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_READ_METHODDEF \
|
#define _IO__WINDOWSCONSOLEIO_READ_METHODDEF \
|
||||||
{"read", (PyCFunction)_io__WindowsConsoleIO_read, METH_VARARGS, _io__WindowsConsoleIO_read__doc__},
|
{"read", (PyCFunction)_io__WindowsConsoleIO_read, METH_FASTCALL, _io__WindowsConsoleIO_read__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size);
|
_io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_io__WindowsConsoleIO_read(winconsoleio *self, PyObject *args)
|
_io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t size = -1;
|
Py_ssize_t size = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O&:read",
|
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
|
||||||
_PyIO_ConvertSsize_t, &size)) {
|
_PyIO_ConvertSsize_t, &size)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _io__WindowsConsoleIO_read_impl(self, size);
|
return_value = _io__WindowsConsoleIO_read_impl(self, size);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_write__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_write__doc__,
|
||||||
"write($self, b, /)\n"
|
"write($self, b, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -270,10 +240,6 @@ exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_isatty__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_isatty__doc__,
|
||||||
"isatty($self, /)\n"
|
"isatty($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -291,42 +257,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
return _io__WindowsConsoleIO_isatty_impl(self);
|
return _io__WindowsConsoleIO_isatty_impl(self);
|
||||||
}
|
}
|
||||||
|
/*[clinic end generated code: output=b097ceeb54d6e15e input=a9049054013a1b77]*/
|
||||||
#endif /* defined(MS_WINDOWS) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_FILENO_METHODDEF) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_READABLE_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_READABLE_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_READABLE_METHODDEF) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_READINTO_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_READINTO_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_READINTO_METHODDEF) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_READALL_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_READALL_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_READALL_METHODDEF) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_READ_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_READ_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_READ_METHODDEF) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_WRITE_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_WRITE_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_WRITE_METHODDEF) */
|
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
|
|
||||||
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
|
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
|
|
||||||
/*[clinic end generated code: output=9eba916f8537fff7 input=a9049054013a1b77]*/
|
|
||||||
|
|
|
@ -1179,5 +1179,3 @@ PyTypeObject PyWindowsConsoleIO_Type = {
|
||||||
};
|
};
|
||||||
|
|
||||||
PyAPI_DATA(PyObject *) _PyWindowsConsoleIO_Type = (PyObject*)&PyWindowsConsoleIO_Type;
|
PyAPI_DATA(PyObject *) _PyWindowsConsoleIO_Type = (PyObject*)&PyWindowsConsoleIO_Type;
|
||||||
|
|
||||||
#endif /* MS_WINDOWS */
|
|
||||||
|
|
57
third_party/python/Modules/_pickle.c
vendored
57
third_party/python/Modules/_pickle.c
vendored
|
@ -5946,6 +5946,8 @@ static int
|
||||||
do_append(UnpicklerObject *self, Py_ssize_t x)
|
do_append(UnpicklerObject *self, Py_ssize_t x)
|
||||||
{
|
{
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
|
PyObject *slice;
|
||||||
|
PyObject *result;
|
||||||
PyObject *list;
|
PyObject *list;
|
||||||
Py_ssize_t len, i;
|
Py_ssize_t len, i;
|
||||||
|
|
||||||
|
@ -5957,8 +5959,7 @@ do_append(UnpicklerObject *self, Py_ssize_t x)
|
||||||
|
|
||||||
list = self->stack->data[x - 1];
|
list = self->stack->data[x - 1];
|
||||||
|
|
||||||
if (PyList_Check(list)) {
|
if (PyList_CheckExact(list)) {
|
||||||
PyObject *slice;
|
|
||||||
Py_ssize_t list_len;
|
Py_ssize_t list_len;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -5971,27 +5972,47 @@ do_append(UnpicklerObject *self, Py_ssize_t x)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyObject *append_func;
|
PyObject *extend_func;
|
||||||
_Py_IDENTIFIER(append);
|
_Py_IDENTIFIER(extend);
|
||||||
|
|
||||||
append_func = _PyObject_GetAttrId(list, &PyId_append);
|
extend_func = _PyObject_GetAttrId(list, &PyId_extend);
|
||||||
if (append_func == NULL)
|
if (extend_func != NULL) {
|
||||||
return -1;
|
slice = Pdata_poplist(self->stack, x);
|
||||||
for (i = x; i < len; i++) {
|
if (!slice) {
|
||||||
PyObject *result;
|
Py_DECREF(extend_func);
|
||||||
|
|
||||||
value = self->stack->data[i];
|
|
||||||
result = _Pickle_FastCall(append_func, value);
|
|
||||||
if (result == NULL) {
|
|
||||||
Pdata_clear(self->stack, i + 1);
|
|
||||||
Py_SIZE(self->stack) = x;
|
|
||||||
Py_DECREF(append_func);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
result = _Pickle_FastCall(extend_func, slice);
|
||||||
|
Py_DECREF(extend_func);
|
||||||
|
if (result == NULL)
|
||||||
|
return -1;
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
}
|
}
|
||||||
Py_SIZE(self->stack) = x;
|
else {
|
||||||
Py_DECREF(append_func);
|
PyObject *append_func;
|
||||||
|
_Py_IDENTIFIER(append);
|
||||||
|
|
||||||
|
/* Even if the PEP 307 requires extend() and append() methods,
|
||||||
|
fall back on append() if the object has no extend() method
|
||||||
|
for backward compatibility. */
|
||||||
|
PyErr_Clear();
|
||||||
|
append_func = _PyObject_GetAttrId(list, &PyId_append);
|
||||||
|
if (append_func == NULL)
|
||||||
|
return -1;
|
||||||
|
for (i = x; i < len; i++) {
|
||||||
|
value = self->stack->data[i];
|
||||||
|
result = _Pickle_FastCall(append_func, value);
|
||||||
|
if (result == NULL) {
|
||||||
|
Pdata_clear(self->stack, i + 1);
|
||||||
|
Py_SIZE(self->stack) = x;
|
||||||
|
Py_DECREF(append_func);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Py_DECREF(result);
|
||||||
|
}
|
||||||
|
Py_SIZE(self->stack) = x;
|
||||||
|
Py_DECREF(append_func);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
512
third_party/python/Modules/_struct.c
vendored
512
third_party/python/Modules/_struct.c
vendored
|
@ -46,6 +46,12 @@ PYTHON_PROVIDE("_struct.unpack_from");
|
||||||
/* New version supporting byte order, alignment and size options,
|
/* New version supporting byte order, alignment and size options,
|
||||||
character strings, and unsigned numbers */
|
character strings, and unsigned numbers */
|
||||||
|
|
||||||
|
|
||||||
|
/*[clinic input]
|
||||||
|
class Struct "PyStructObject *" "&PyStructType"
|
||||||
|
[clinic start generated code]*/
|
||||||
|
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=9b032058a83ed7c3]*/
|
||||||
|
|
||||||
static PyTypeObject PyStructType;
|
static PyTypeObject PyStructType;
|
||||||
|
|
||||||
/* The translation function for each format character is table driven */
|
/* The translation function for each format character is table driven */
|
||||||
|
@ -117,6 +123,8 @@ typedef struct { char c; long long x; } s_long_long;
|
||||||
#pragma options align=reset
|
#pragma options align=reset
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "third_party/python/Modules/clinic/_struct.inc"
|
||||||
|
|
||||||
/* Helper for integer format codes: converts an arbitrary Python object to a
|
/* Helper for integer format codes: converts an arbitrary Python object to a
|
||||||
PyLongObject if possible, otherwise fails. Caller should decref. */
|
PyLongObject if possible, otherwise fails. Caller should decref. */
|
||||||
|
|
||||||
|
@ -576,7 +584,7 @@ np_ubyte(char *p, PyObject *v, const formatdef *f)
|
||||||
"ubyte format requires 0 <= number <= 255");
|
"ubyte format requires 0 <= number <= 255");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*(unsigned char *)p = (unsigned char)x;
|
*p = (char)x;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,7 +913,6 @@ bp_int(char *p, PyObject *v, const formatdef *f)
|
||||||
{
|
{
|
||||||
long x;
|
long x;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
unsigned char *q = (unsigned char *)p;
|
|
||||||
if (get_long(v, &x) < 0)
|
if (get_long(v, &x) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
i = f->size;
|
i = f->size;
|
||||||
|
@ -918,7 +925,7 @@ bp_int(char *p, PyObject *v, const formatdef *f)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
q[--i] = (unsigned char)(x & 0xffL);
|
p[--i] = (char)x;
|
||||||
x >>= 8;
|
x >>= 8;
|
||||||
} while (i > 0);
|
} while (i > 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -929,7 +936,6 @@ bp_uint(char *p, PyObject *v, const formatdef *f)
|
||||||
{
|
{
|
||||||
unsigned long x;
|
unsigned long x;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
unsigned char *q = (unsigned char *)p;
|
|
||||||
if (get_ulong(v, &x) < 0)
|
if (get_ulong(v, &x) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
i = f->size;
|
i = f->size;
|
||||||
|
@ -940,7 +946,7 @@ bp_uint(char *p, PyObject *v, const formatdef *f)
|
||||||
RANGE_ERROR(x, f, 1, maxint - 1);
|
RANGE_ERROR(x, f, 1, maxint - 1);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
q[--i] = (unsigned char)(x & 0xffUL);
|
p[--i] = (char)x;
|
||||||
x >>= 8;
|
x >>= 8;
|
||||||
} while (i > 0);
|
} while (i > 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1126,7 +1132,6 @@ lp_int(char *p, PyObject *v, const formatdef *f)
|
||||||
{
|
{
|
||||||
long x;
|
long x;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
unsigned char *q = (unsigned char *)p;
|
|
||||||
if (get_long(v, &x) < 0)
|
if (get_long(v, &x) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
i = f->size;
|
i = f->size;
|
||||||
|
@ -1139,7 +1144,7 @@ lp_int(char *p, PyObject *v, const formatdef *f)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
*q++ = (unsigned char)(x & 0xffL);
|
*p++ = (char)x;
|
||||||
x >>= 8;
|
x >>= 8;
|
||||||
} while (--i > 0);
|
} while (--i > 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1150,7 +1155,6 @@ lp_uint(char *p, PyObject *v, const formatdef *f)
|
||||||
{
|
{
|
||||||
unsigned long x;
|
unsigned long x;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
unsigned char *q = (unsigned char *)p;
|
|
||||||
if (get_ulong(v, &x) < 0)
|
if (get_ulong(v, &x) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
i = f->size;
|
i = f->size;
|
||||||
|
@ -1161,7 +1165,7 @@ lp_uint(char *p, PyObject *v, const formatdef *f)
|
||||||
RANGE_ERROR(x, f, 1, maxint - 1);
|
RANGE_ERROR(x, f, 1, maxint - 1);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
*q++ = (unsigned char)(x & 0xffUL);
|
*p++ = (char)x;
|
||||||
x >>= 8;
|
x >>= 8;
|
||||||
} while (--i > 0);
|
} while (--i > 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1340,7 +1344,7 @@ prepare_s(PyStructObject *self)
|
||||||
len = 0;
|
len = 0;
|
||||||
ncodes = 0;
|
ncodes = 0;
|
||||||
while ((c = *s++) != '\0') {
|
while ((c = *s++) != '\0') {
|
||||||
if (Py_ISSPACE(c))
|
if (Py_ISSPACE(Py_CHARMASK(c)))
|
||||||
continue;
|
continue;
|
||||||
if ('0' <= c && c <= '9') {
|
if ('0' <= c && c <= '9') {
|
||||||
num = c - '0';
|
num = c - '0';
|
||||||
|
@ -1405,7 +1409,7 @@ prepare_s(PyStructObject *self)
|
||||||
s = fmt;
|
s = fmt;
|
||||||
size = 0;
|
size = 0;
|
||||||
while ((c = *s++) != '\0') {
|
while ((c = *s++) != '\0') {
|
||||||
if (Py_ISSPACE(c))
|
if (Py_ISSPACE(Py_CHARMASK(c)))
|
||||||
continue;
|
continue;
|
||||||
if ('0' <= c && c <= '9') {
|
if ('0' <= c && c <= '9') {
|
||||||
num = c - '0';
|
num = c - '0';
|
||||||
|
@ -1470,42 +1474,46 @@ s_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*[clinic input]
|
||||||
|
Struct.__init__
|
||||||
|
|
||||||
|
format: object
|
||||||
|
|
||||||
|
Create a compiled struct object.
|
||||||
|
|
||||||
|
Return a new Struct object which writes and reads binary data according to
|
||||||
|
the format string.
|
||||||
|
|
||||||
|
See help(struct) for more on format strings.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
s_init(PyObject *self, PyObject *args, PyObject *kwds)
|
Struct___init___impl(PyStructObject *self, PyObject *format)
|
||||||
|
/*[clinic end generated code: output=b8e80862444e92d0 input=192a4575a3dde802]*/
|
||||||
{
|
{
|
||||||
PyStructObject *soself = (PyStructObject *)self;
|
|
||||||
PyObject *o_format = NULL;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
static char *kwlist[] = {"format", 0};
|
|
||||||
|
|
||||||
assert(PyStruct_Check(self));
|
if (PyUnicode_Check(format)) {
|
||||||
|
format = PyUnicode_AsASCIIString(format);
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:Struct", kwlist,
|
if (format == NULL)
|
||||||
&o_format))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (PyUnicode_Check(o_format)) {
|
|
||||||
o_format = PyUnicode_AsASCIIString(o_format);
|
|
||||||
if (o_format == NULL)
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* XXX support buffer interface, too */
|
/* XXX support buffer interface, too */
|
||||||
else {
|
else {
|
||||||
Py_INCREF(o_format);
|
Py_INCREF(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PyBytes_Check(o_format)) {
|
if (!PyBytes_Check(format)) {
|
||||||
Py_DECREF(o_format);
|
Py_DECREF(format);
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"Struct() argument 1 must be a str or bytes object, "
|
"Struct() argument 1 must be a bytes object, not %.200s",
|
||||||
"not %.200s",
|
Py_TYPE(format)->tp_name);
|
||||||
Py_TYPE(o_format)->tp_name);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_XSETREF(soself->s_format, o_format);
|
Py_XSETREF(self->s_format, format);
|
||||||
|
|
||||||
ret = prepare_s(soself);
|
ret = prepare_s(self);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1559,78 +1567,69 @@ fail:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(s_unpack__doc__,
|
/*[clinic input]
|
||||||
"S.unpack(buffer) -> (v1, v2, ...)\n\
|
Struct.unpack
|
||||||
\n\
|
|
||||||
Return a tuple containing values unpacked according to the format\n\
|
buffer: Py_buffer
|
||||||
string S.format. The buffer's size in bytes must be S.size. See\n\
|
/
|
||||||
help(struct) for more on format strings.");
|
|
||||||
|
Return a tuple containing unpacked values.
|
||||||
|
|
||||||
|
Unpack according to the format string Struct.format. The buffer's size
|
||||||
|
in bytes must be Struct.size.
|
||||||
|
|
||||||
|
See help(struct) for more on format strings.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
s_unpack(PyObject *self, PyObject *input)
|
Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer)
|
||||||
|
/*[clinic end generated code: output=873a24faf02e848a input=3113f8e7038b2f6c]*/
|
||||||
{
|
{
|
||||||
Py_buffer vbuf;
|
assert(self->s_codes != NULL);
|
||||||
PyObject *result;
|
if (buffer->len != self->s_size) {
|
||||||
PyStructObject *soself = (PyStructObject *)self;
|
|
||||||
|
|
||||||
assert(PyStruct_Check(self));
|
|
||||||
assert(soself->s_codes != NULL);
|
|
||||||
if (PyObject_GetBuffer(input, &vbuf, PyBUF_SIMPLE) < 0)
|
|
||||||
return NULL;
|
|
||||||
if (vbuf.len != soself->s_size) {
|
|
||||||
PyErr_Format(StructError,
|
PyErr_Format(StructError,
|
||||||
"unpack requires a buffer of %zd bytes",
|
"unpack requires a bytes object of length %zd",
|
||||||
soself->s_size);
|
self->s_size);
|
||||||
PyBuffer_Release(&vbuf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
result = s_unpack_internal(soself, vbuf.buf);
|
return s_unpack_internal(self, buffer->buf);
|
||||||
PyBuffer_Release(&vbuf);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(s_unpack_from__doc__,
|
/*[clinic input]
|
||||||
"S.unpack_from(buffer, offset=0) -> (v1, v2, ...)\n\
|
Struct.unpack_from
|
||||||
\n\
|
|
||||||
Return a tuple containing values unpacked according to the format\n\
|
buffer: Py_buffer
|
||||||
string S.format. The buffer's size in bytes, minus offset, must be at\n\
|
offset: Py_ssize_t = 0
|
||||||
least S.size. See help(struct) for more on format strings.");
|
|
||||||
|
Return a tuple containing unpacked values.
|
||||||
|
|
||||||
|
Values are unpacked according to the format string Struct.format.
|
||||||
|
|
||||||
|
The buffer's size in bytes, minus offset, must be at least Struct.size.
|
||||||
|
|
||||||
|
See help(struct) for more on format strings.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
s_unpack_from(PyObject *self, PyObject *args, PyObject *kwds)
|
Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer,
|
||||||
|
Py_ssize_t offset)
|
||||||
|
/*[clinic end generated code: output=57fac875e0977316 input=97ade52422f8962f]*/
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"buffer", "offset", 0};
|
assert(self->s_codes != NULL);
|
||||||
|
|
||||||
PyObject *input;
|
|
||||||
Py_ssize_t offset = 0;
|
|
||||||
Py_buffer vbuf;
|
|
||||||
PyObject *result;
|
|
||||||
PyStructObject *soself = (PyStructObject *)self;
|
|
||||||
|
|
||||||
assert(PyStruct_Check(self));
|
|
||||||
assert(soself->s_codes != NULL);
|
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds,
|
|
||||||
"O|n:unpack_from", kwlist,
|
|
||||||
&input, &offset))
|
|
||||||
return NULL;
|
|
||||||
if (PyObject_GetBuffer(input, &vbuf, PyBUF_SIMPLE) < 0)
|
|
||||||
return NULL;
|
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
offset += vbuf.len;
|
offset += buffer->len;
|
||||||
if (offset < 0 || vbuf.len - offset < soself->s_size) {
|
if (offset < 0 || buffer->len - offset < self->s_size) {
|
||||||
PyErr_Format(StructError,
|
PyErr_Format(StructError,
|
||||||
"unpack_from requires a buffer of at least %zd bytes",
|
"unpack_from requires a buffer of at least %zd bytes",
|
||||||
soself->s_size);
|
self->s_size);
|
||||||
PyBuffer_Release(&vbuf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
result = s_unpack_internal(soself, (char*)vbuf.buf + offset);
|
return s_unpack_internal(self, (char*)buffer->buf + offset);
|
||||||
PyBuffer_Release(&vbuf);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Unpack iterator type */
|
/* Unpack iterator type */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1643,8 +1642,6 @@ typedef struct {
|
||||||
static void
|
static void
|
||||||
unpackiter_dealloc(unpackiterobject *self)
|
unpackiter_dealloc(unpackiterobject *self)
|
||||||
{
|
{
|
||||||
/* bpo-31095: UnTrack is needed before calling any callbacks */
|
|
||||||
PyObject_GC_UnTrack(self);
|
|
||||||
Py_XDECREF(self->so);
|
Py_XDECREF(self->so);
|
||||||
PyBuffer_Release(&self->buf);
|
PyBuffer_Release(&self->buf);
|
||||||
PyObject_GC_Del(self);
|
PyObject_GC_Del(self);
|
||||||
|
@ -1694,7 +1691,7 @@ unpackiter_iternext(unpackiterobject *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyTypeObject unpackiter_type = {
|
static PyTypeObject unpackiter_type = {
|
||||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
"unpack_iterator", /* tp_name */
|
"unpack_iterator", /* tp_name */
|
||||||
sizeof(unpackiterobject), /* tp_basicsize */
|
sizeof(unpackiterobject), /* tp_basicsize */
|
||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
|
@ -1724,48 +1721,54 @@ static PyTypeObject unpackiter_type = {
|
||||||
unpackiter_methods /* tp_methods */
|
unpackiter_methods /* tp_methods */
|
||||||
};
|
};
|
||||||
|
|
||||||
PyDoc_STRVAR(s_iter_unpack__doc__,
|
/*[clinic input]
|
||||||
"S.iter_unpack(buffer) -> iterator(v1, v2, ...)\n\
|
Struct.iter_unpack
|
||||||
\n\
|
|
||||||
Return an iterator yielding tuples unpacked from the given bytes\n\
|
buffer: object
|
||||||
source, like a repeated invocation of unpack_from(). Requires\n\
|
/
|
||||||
that the bytes length be a multiple of the struct size.");
|
|
||||||
|
Return an iterator yielding tuples.
|
||||||
|
|
||||||
|
Tuples are unpacked from the given bytes source, like a repeated
|
||||||
|
invocation of unpack_from().
|
||||||
|
|
||||||
|
Requires that the bytes length be a multiple of the struct size.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
s_iter_unpack(PyObject *_so, PyObject *input)
|
Struct_iter_unpack(PyStructObject *self, PyObject *buffer)
|
||||||
|
/*[clinic end generated code: output=172d83d0cd15dbab input=6d65b3f3107dbc99]*/
|
||||||
{
|
{
|
||||||
PyStructObject *so = (PyStructObject *) _so;
|
unpackiterobject *iter;
|
||||||
unpackiterobject *self;
|
|
||||||
|
|
||||||
assert(PyStruct_Check(_so));
|
assert(self->s_codes != NULL);
|
||||||
assert(so->s_codes != NULL);
|
|
||||||
|
|
||||||
if (so->s_size == 0) {
|
if (self->s_size == 0) {
|
||||||
PyErr_Format(StructError,
|
PyErr_Format(StructError,
|
||||||
"cannot iteratively unpack with a struct of length 0");
|
"cannot iteratively unpack with a struct of length 0");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = (unpackiterobject *) PyType_GenericAlloc(&unpackiter_type, 0);
|
iter = (unpackiterobject *) PyType_GenericAlloc(&unpackiter_type, 0);
|
||||||
if (self == NULL)
|
if (iter == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (PyObject_GetBuffer(input, &self->buf, PyBUF_SIMPLE) < 0) {
|
if (PyObject_GetBuffer(buffer, &iter->buf, PyBUF_SIMPLE) < 0) {
|
||||||
Py_DECREF(self);
|
Py_DECREF(iter);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (self->buf.len % so->s_size != 0) {
|
if (iter->buf.len % self->s_size != 0) {
|
||||||
PyErr_Format(StructError,
|
PyErr_Format(StructError,
|
||||||
"iterative unpacking requires a buffer of "
|
"iterative unpacking requires a bytes length "
|
||||||
"a multiple of %zd bytes",
|
"multiple of %zd",
|
||||||
so->s_size);
|
self->s_size);
|
||||||
Py_DECREF(self);
|
Py_DECREF(iter);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Py_INCREF(so);
|
Py_INCREF(self);
|
||||||
self->so = so;
|
iter->so = self;
|
||||||
self->index = 0;
|
iter->index = 0;
|
||||||
return (PyObject *) self;
|
return (PyObject *)iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1780,20 +1783,21 @@ s_iter_unpack(PyObject *_so, PyObject *input)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
s_pack_internal(PyStructObject *soself, PyObject *args, int offset, char* buf)
|
s_pack_internal(PyStructObject *soself, PyObject **args, int offset, char* buf)
|
||||||
{
|
{
|
||||||
formatcode *code;
|
formatcode *code;
|
||||||
/* XXX(nnorwitz): why does i need to be a local? can we use
|
/* XXX(nnorwitz): why does i need to be a local? can we use
|
||||||
the offset parameter or do we need the wider width? */
|
the offset parameter or do we need the wider width? */
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
bzero(buf, soself->s_size);
|
|
||||||
|
memset(buf, '\0', soself->s_size);
|
||||||
i = offset;
|
i = offset;
|
||||||
for (code = soself->s_codes; code->fmtdef != NULL; code++) {
|
for (code = soself->s_codes; code->fmtdef != NULL; code++) {
|
||||||
const formatdef *e = code->fmtdef;
|
const formatdef *e = code->fmtdef;
|
||||||
char *res = buf + code->offset;
|
char *res = buf + code->offset;
|
||||||
Py_ssize_t j = code->repeat;
|
Py_ssize_t j = code->repeat;
|
||||||
while (j--) {
|
while (j--) {
|
||||||
PyObject *v = PyTuple_GET_ITEM(args, i++);
|
PyObject *v = args[i++];
|
||||||
if (e->format == 's') {
|
if (e->format == 's') {
|
||||||
Py_ssize_t n;
|
Py_ssize_t n;
|
||||||
int isstring;
|
int isstring;
|
||||||
|
@ -1866,7 +1870,7 @@ to the format string S.format. See help(struct) for more on format\n\
|
||||||
strings.");
|
strings.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
s_pack(PyObject *self, PyObject *args)
|
s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyStructObject *soself;
|
PyStructObject *soself;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
@ -1875,10 +1879,13 @@ s_pack(PyObject *self, PyObject *args)
|
||||||
soself = (PyStructObject *)self;
|
soself = (PyStructObject *)self;
|
||||||
assert(PyStruct_Check(self));
|
assert(PyStruct_Check(self));
|
||||||
assert(soself->s_codes != NULL);
|
assert(soself->s_codes != NULL);
|
||||||
if (PyTuple_GET_SIZE(args) != soself->s_len)
|
if (nargs != soself->s_len)
|
||||||
{
|
{
|
||||||
PyErr_Format(StructError,
|
PyErr_Format(StructError,
|
||||||
"pack expected %zd items for packing (got %zd)", soself->s_len, PyTuple_GET_SIZE(args));
|
"pack expected %zd items for packing (got %zd)", soself->s_len, nargs);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!_PyArg_NoStackKeywords("pack", kwnames)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1905,7 +1912,7 @@ offset. Note that the offset is a required argument. See\n\
|
||||||
help(struct) for more on format strings.");
|
help(struct) for more on format strings.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
s_pack_into(PyObject *self, PyObject *args)
|
s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyStructObject *soself;
|
PyStructObject *soself;
|
||||||
Py_buffer buffer;
|
Py_buffer buffer;
|
||||||
|
@ -1915,31 +1922,34 @@ s_pack_into(PyObject *self, PyObject *args)
|
||||||
soself = (PyStructObject *)self;
|
soself = (PyStructObject *)self;
|
||||||
assert(PyStruct_Check(self));
|
assert(PyStruct_Check(self));
|
||||||
assert(soself->s_codes != NULL);
|
assert(soself->s_codes != NULL);
|
||||||
if (PyTuple_GET_SIZE(args) != (soself->s_len + 2))
|
if (nargs != (soself->s_len + 2))
|
||||||
{
|
{
|
||||||
if (PyTuple_GET_SIZE(args) == 0) {
|
if (nargs == 0) {
|
||||||
PyErr_Format(StructError,
|
PyErr_Format(StructError,
|
||||||
"pack_into expected buffer argument");
|
"pack_into expected buffer argument");
|
||||||
}
|
}
|
||||||
else if (PyTuple_GET_SIZE(args) == 1) {
|
else if (nargs == 1) {
|
||||||
PyErr_Format(StructError,
|
PyErr_Format(StructError,
|
||||||
"pack_into expected offset argument");
|
"pack_into expected offset argument");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyErr_Format(StructError,
|
PyErr_Format(StructError,
|
||||||
"pack_into expected %zd items for packing (got %zd)",
|
"pack_into expected %zd items for packing (got %zd)",
|
||||||
soself->s_len, (PyTuple_GET_SIZE(args) - 2));
|
soself->s_len, (nargs - 2));
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!_PyArg_NoStackKeywords("pack_into", kwnames)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Extract a writable memory buffer from the first argument */
|
/* Extract a writable memory buffer from the first argument */
|
||||||
if (!PyArg_Parse(PyTuple_GET_ITEM(args, 0), "w*", &buffer))
|
if (!PyArg_Parse(args[0], "w*", &buffer))
|
||||||
return NULL;
|
return NULL;
|
||||||
assert(buffer.len >= 0);
|
assert(buffer.len >= 0);
|
||||||
|
|
||||||
/* Extract the offset from the first argument */
|
/* Extract the offset from the first argument */
|
||||||
offset = PyNumber_AsSsize_t(PyTuple_GET_ITEM(args, 1), PyExc_IndexError);
|
offset = PyNumber_AsSsize_t(args[1], PyExc_IndexError);
|
||||||
if (offset == -1 && PyErr_Occurred()) {
|
if (offset == -1 && PyErr_Occurred()) {
|
||||||
PyBuffer_Release(&buffer);
|
PyBuffer_Release(&buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1999,22 +2009,15 @@ s_sizeof(PyStructObject *self, void *unused)
|
||||||
/* List of functions */
|
/* List of functions */
|
||||||
|
|
||||||
static struct PyMethodDef s_methods[] = {
|
static struct PyMethodDef s_methods[] = {
|
||||||
{"iter_unpack", s_iter_unpack, METH_O, s_iter_unpack__doc__},
|
STRUCT_ITER_UNPACK_METHODDEF
|
||||||
{"pack", s_pack, METH_VARARGS, s_pack__doc__},
|
{"pack", (PyCFunction)s_pack, METH_FASTCALL, s_pack__doc__},
|
||||||
{"pack_into", s_pack_into, METH_VARARGS, s_pack_into__doc__},
|
{"pack_into", (PyCFunction)s_pack_into, METH_FASTCALL, s_pack_into__doc__},
|
||||||
{"unpack", s_unpack, METH_O, s_unpack__doc__},
|
STRUCT_UNPACK_METHODDEF
|
||||||
{"unpack_from", (PyCFunction)s_unpack_from, METH_VARARGS|METH_KEYWORDS,
|
STRUCT_UNPACK_FROM_METHODDEF
|
||||||
s_unpack_from__doc__},
|
|
||||||
{"__sizeof__", (PyCFunction)s_sizeof, METH_NOARGS, s_sizeof__doc__},
|
{"__sizeof__", (PyCFunction)s_sizeof, METH_NOARGS, s_sizeof__doc__},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
PyDoc_STRVAR(s__doc__,
|
|
||||||
"Struct(fmt) --> compiled struct object\n"
|
|
||||||
"\n"
|
|
||||||
"Return a new Struct object which writes and reads binary data according to\n"
|
|
||||||
"the format string fmt. See help(struct) for more on format strings.");
|
|
||||||
|
|
||||||
#define OFF(x) offsetof(PyStructObject, x)
|
#define OFF(x) offsetof(PyStructObject, x)
|
||||||
|
|
||||||
static PyGetSetDef s_getsetlist[] = {
|
static PyGetSetDef s_getsetlist[] = {
|
||||||
|
@ -2041,29 +2044,29 @@ PyTypeObject PyStructType = {
|
||||||
0, /* tp_hash */
|
0, /* tp_hash */
|
||||||
0, /* tp_call */
|
0, /* tp_call */
|
||||||
0, /* tp_str */
|
0, /* tp_str */
|
||||||
PyObject_GenericGetAttr, /* tp_getattro */
|
PyObject_GenericGetAttr, /* tp_getattro */
|
||||||
PyObject_GenericSetAttr, /* tp_setattro */
|
PyObject_GenericSetAttr, /* tp_setattro */
|
||||||
0, /* tp_as_buffer */
|
0, /* tp_as_buffer */
|
||||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||||
s__doc__, /* tp_doc */
|
Struct___init____doc__, /* tp_doc */
|
||||||
0, /* tp_traverse */
|
0, /* tp_traverse */
|
||||||
0, /* tp_clear */
|
0, /* tp_clear */
|
||||||
0, /* tp_richcompare */
|
0, /* tp_richcompare */
|
||||||
offsetof(PyStructObject, weakreflist), /* tp_weaklistoffset */
|
offsetof(PyStructObject, weakreflist), /* tp_weaklistoffset */
|
||||||
0, /* tp_iter */
|
0, /* tp_iter */
|
||||||
0, /* tp_iternext */
|
0, /* tp_iternext */
|
||||||
s_methods, /* tp_methods */
|
s_methods, /* tp_methods */
|
||||||
NULL, /* tp_members */
|
NULL, /* tp_members */
|
||||||
s_getsetlist, /* tp_getset */
|
s_getsetlist, /* tp_getset */
|
||||||
0, /* tp_base */
|
0, /* tp_base */
|
||||||
0, /* tp_dict */
|
0, /* tp_dict */
|
||||||
0, /* tp_descr_get */
|
0, /* tp_descr_get */
|
||||||
0, /* tp_descr_set */
|
0, /* tp_descr_set */
|
||||||
0, /* tp_dictoffset */
|
0, /* tp_dictoffset */
|
||||||
s_init, /* tp_init */
|
Struct___init__, /* tp_init */
|
||||||
PyType_GenericAlloc,/* tp_alloc */
|
PyType_GenericAlloc, /* tp_alloc */
|
||||||
s_new, /* tp_new */
|
s_new, /* tp_new */
|
||||||
PyObject_Del, /* tp_free */
|
PyObject_Del, /* tp_free */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2072,7 +2075,7 @@ PyTypeObject PyStructType = {
|
||||||
#define MAXCACHE 100
|
#define MAXCACHE 100
|
||||||
static PyObject *cache = NULL;
|
static PyObject *cache = NULL;
|
||||||
|
|
||||||
static PyObject *
|
static PyStructObject *
|
||||||
cache_struct(PyObject *fmt)
|
cache_struct(PyObject *fmt)
|
||||||
{
|
{
|
||||||
PyObject * s_object;
|
PyObject * s_object;
|
||||||
|
@ -2086,202 +2089,214 @@ cache_struct(PyObject *fmt)
|
||||||
s_object = PyDict_GetItem(cache, fmt);
|
s_object = PyDict_GetItem(cache, fmt);
|
||||||
if (s_object != NULL) {
|
if (s_object != NULL) {
|
||||||
Py_INCREF(s_object);
|
Py_INCREF(s_object);
|
||||||
return s_object;
|
return (PyStructObject *)s_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL);
|
s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL);
|
||||||
if (s_object != NULL) {
|
if (s_object != NULL) {
|
||||||
if (PyDict_Size(cache) >= MAXCACHE)
|
if (PyDict_GET_SIZE(cache) >= MAXCACHE)
|
||||||
PyDict_Clear(cache);
|
PyDict_Clear(cache);
|
||||||
/* Attempt to cache the result */
|
/* Attempt to cache the result */
|
||||||
if (PyDict_SetItem(cache, fmt, s_object) == -1)
|
if (PyDict_SetItem(cache, fmt, s_object) == -1)
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
}
|
}
|
||||||
return s_object;
|
return (PyStructObject *)s_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(clearcache_doc,
|
/*[clinic input]
|
||||||
"Clear the internal cache.");
|
_clearcache
|
||||||
|
|
||||||
|
Clear the internal cache.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
clearcache(PyObject *self)
|
_clearcache_impl(PyObject *module)
|
||||||
|
/*[clinic end generated code: output=ce4fb8a7bf7cb523 input=463eaae04bab3211]*/
|
||||||
{
|
{
|
||||||
Py_CLEAR(cache);
|
Py_CLEAR(cache);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(calcsize_doc,
|
|
||||||
"calcsize(fmt) -> integer\n\
|
/*[clinic input]
|
||||||
\n\
|
calcsize
|
||||||
Return size in bytes of the struct described by the format string fmt.");
|
|
||||||
|
format: object
|
||||||
|
/
|
||||||
|
|
||||||
|
Return size in bytes of the struct described by the format string.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
calcsize(PyObject *self, PyObject *fmt)
|
calcsize(PyObject *module, PyObject *format)
|
||||||
|
/*[clinic end generated code: output=90fbcf191fe9470a input=55488303a06777fa]*/
|
||||||
{
|
{
|
||||||
Py_ssize_t n;
|
Py_ssize_t n;
|
||||||
PyObject *s_object = cache_struct(fmt);
|
PyStructObject *s_object = cache_struct(format);
|
||||||
if (s_object == NULL)
|
if (s_object == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
n = ((PyStructObject *)s_object)->s_size;
|
n = s_object->s_size;
|
||||||
Py_DECREF(s_object);
|
Py_DECREF(s_object);
|
||||||
return PyLong_FromSsize_t(n);
|
return PyLong_FromSsize_t(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(pack_doc,
|
PyDoc_STRVAR(pack_doc,
|
||||||
"pack(fmt, v1, v2, ...) -> bytes\n\
|
"pack(format, v1, v2, ...) -> bytes\n\
|
||||||
\n\
|
\n\
|
||||||
Return a bytes object containing the values v1, v2, ... packed according\n\
|
Return a bytes object containing the values v1, v2, ... packed according\n\
|
||||||
to the format string fmt. See help(struct) for more on format strings.");
|
to the format string. See help(struct) for more on format strings.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pack(PyObject *self, PyObject *args)
|
pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *s_object, *fmt, *newargs, *result;
|
PyStructObject *s_object;
|
||||||
Py_ssize_t n = PyTuple_GET_SIZE(args);
|
PyObject *format, *result;
|
||||||
|
|
||||||
if (n == 0) {
|
if (nargs == 0) {
|
||||||
PyErr_SetString(PyExc_TypeError, "missing format argument");
|
PyErr_SetString(PyExc_TypeError, "missing format argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fmt = PyTuple_GET_ITEM(args, 0);
|
format = args[0];
|
||||||
newargs = PyTuple_GetSlice(args, 1, n);
|
|
||||||
if (newargs == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
s_object = cache_struct(fmt);
|
s_object = cache_struct(format);
|
||||||
if (s_object == NULL) {
|
if (s_object == NULL) {
|
||||||
Py_DECREF(newargs);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
result = s_pack(s_object, newargs);
|
result = s_pack((PyObject *)s_object, args + 1, nargs - 1, kwnames);
|
||||||
Py_DECREF(newargs);
|
|
||||||
Py_DECREF(s_object);
|
Py_DECREF(s_object);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(pack_into_doc,
|
PyDoc_STRVAR(pack_into_doc,
|
||||||
"pack_into(fmt, buffer, offset, v1, v2, ...)\n\
|
"pack_into(format, buffer, offset, v1, v2, ...)\n\
|
||||||
\n\
|
\n\
|
||||||
Pack the values v1, v2, ... according to the format string fmt and write\n\
|
Pack the values v1, v2, ... according to the format string and write\n\
|
||||||
the packed bytes into the writable buffer buf starting at offset. Note\n\
|
the packed bytes into the writable buffer buf starting at offset. Note\n\
|
||||||
that the offset is a required argument. See help(struct) for more\n\
|
that the offset is a required argument. See help(struct) for more\n\
|
||||||
on format strings.");
|
on format strings.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pack_into(PyObject *self, PyObject *args)
|
pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *s_object, *fmt, *newargs, *result;
|
PyStructObject *s_object;
|
||||||
Py_ssize_t n = PyTuple_GET_SIZE(args);
|
PyObject *format, *result;
|
||||||
|
|
||||||
if (n == 0) {
|
if (nargs == 0) {
|
||||||
PyErr_SetString(PyExc_TypeError, "missing format argument");
|
PyErr_SetString(PyExc_TypeError, "missing format argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fmt = PyTuple_GET_ITEM(args, 0);
|
format = args[0];
|
||||||
newargs = PyTuple_GetSlice(args, 1, n);
|
|
||||||
if (newargs == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
s_object = cache_struct(fmt);
|
s_object = cache_struct(format);
|
||||||
if (s_object == NULL) {
|
if (s_object == NULL) {
|
||||||
Py_DECREF(newargs);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
result = s_pack_into(s_object, newargs);
|
result = s_pack_into((PyObject *)s_object, args + 1, nargs - 1, kwnames);
|
||||||
Py_DECREF(newargs);
|
|
||||||
Py_DECREF(s_object);
|
Py_DECREF(s_object);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(unpack_doc,
|
/*[clinic input]
|
||||||
"unpack(fmt, buffer) -> (v1, v2, ...)\n\
|
unpack
|
||||||
\n\
|
|
||||||
Return a tuple containing values unpacked according to the format string\n\
|
format: object
|
||||||
fmt. The buffer's size in bytes must be calcsize(fmt). See help(struct)\n\
|
inputstr: object
|
||||||
for more on format strings.");
|
/
|
||||||
|
|
||||||
|
Return a tuple containing values unpacked according to the format string.
|
||||||
|
|
||||||
|
The buffer's size in bytes must be calcsize(format).
|
||||||
|
|
||||||
|
See help(struct) for more on format strings.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unpack(PyObject *self, PyObject *args)
|
unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr)
|
||||||
|
/*[clinic end generated code: output=06951d66eae6d63b input=4b81d54988890f5e]*/
|
||||||
{
|
{
|
||||||
PyObject *s_object, *fmt, *inputstr, *result;
|
PyStructObject *s_object;
|
||||||
|
PyObject *result;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "unpack", 2, 2, &fmt, &inputstr))
|
s_object = cache_struct(format);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
s_object = cache_struct(fmt);
|
|
||||||
if (s_object == NULL)
|
if (s_object == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
result = s_unpack(s_object, inputstr);
|
result = Struct_unpack(s_object, inputstr);
|
||||||
Py_DECREF(s_object);
|
Py_DECREF(s_object);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(unpack_from_doc,
|
/*[clinic input]
|
||||||
"unpack_from(fmt, buffer, offset=0) -> (v1, v2, ...)\n\
|
unpack_from
|
||||||
\n\
|
|
||||||
Return a tuple containing values unpacked according to the format string\n\
|
format: object
|
||||||
fmt. The buffer's size, minus offset, must be at least calcsize(fmt).\n\
|
/
|
||||||
See help(struct) for more on format strings.");
|
buffer: Py_buffer
|
||||||
|
offset: Py_ssize_t = 0
|
||||||
|
|
||||||
|
Return a tuple containing values unpacked according to the format string.
|
||||||
|
|
||||||
|
The buffer's size, minus offset, must be at least calcsize(format).
|
||||||
|
|
||||||
|
See help(struct) for more on format strings.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unpack_from(PyObject *self, PyObject *args, PyObject *kwds)
|
unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer,
|
||||||
|
Py_ssize_t offset)
|
||||||
|
/*[clinic end generated code: output=2492f0c3a0b82577 input=9ead76c6ac7164f7]*/
|
||||||
{
|
{
|
||||||
PyObject *s_object, *fmt, *newargs, *result;
|
PyStructObject *s_object;
|
||||||
Py_ssize_t n = PyTuple_GET_SIZE(args);
|
PyObject *result;
|
||||||
|
|
||||||
if (n == 0) {
|
s_object = cache_struct(format);
|
||||||
PyErr_SetString(PyExc_TypeError, "missing format argument");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
fmt = PyTuple_GET_ITEM(args, 0);
|
|
||||||
newargs = PyTuple_GetSlice(args, 1, n);
|
|
||||||
if (newargs == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
s_object = cache_struct(fmt);
|
|
||||||
if (s_object == NULL) {
|
if (s_object == NULL) {
|
||||||
Py_DECREF(newargs);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
result = s_unpack_from(s_object, newargs, kwds);
|
result = Struct_unpack_from_impl(s_object, buffer, offset);
|
||||||
Py_DECREF(newargs);
|
|
||||||
Py_DECREF(s_object);
|
Py_DECREF(s_object);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(iter_unpack_doc,
|
/*[clinic input]
|
||||||
"iter_unpack(fmt, buffer) -> iterator(v1, v2, ...)\n\
|
iter_unpack
|
||||||
\n\
|
|
||||||
Return an iterator yielding tuples unpacked from the given bytes\n\
|
format: object
|
||||||
source according to the format string, like a repeated invocation of\n\
|
buffer: object
|
||||||
unpack_from(). Requires that the bytes length be a multiple of the\n\
|
/
|
||||||
format struct size.");
|
|
||||||
|
Return an iterator yielding tuples unpacked from the given bytes.
|
||||||
|
|
||||||
|
The bytes are unpacked according to the format string, like
|
||||||
|
a repeated invocation of unpack_from().
|
||||||
|
|
||||||
|
Requires that the bytes length be a multiple of the format struct size.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
iter_unpack(PyObject *self, PyObject *args)
|
iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer)
|
||||||
|
/*[clinic end generated code: output=b1291e97a6d4cf3c input=8674dfd2f0dae416]*/
|
||||||
{
|
{
|
||||||
PyObject *s_object, *fmt, *input, *result;
|
PyStructObject *s_object;
|
||||||
|
PyObject *result;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "OO:iter_unpack", &fmt, &input))
|
s_object = cache_struct(format);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
s_object = cache_struct(fmt);
|
|
||||||
if (s_object == NULL)
|
if (s_object == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
result = s_iter_unpack(s_object, input);
|
|
||||||
|
result = Struct_iter_unpack(s_object, buffer);
|
||||||
Py_DECREF(s_object);
|
Py_DECREF(s_object);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct PyMethodDef module_functions[] = {
|
static struct PyMethodDef module_functions[] = {
|
||||||
{"_clearcache", (PyCFunction)clearcache, METH_NOARGS, clearcache_doc},
|
_CLEARCACHE_METHODDEF
|
||||||
{"calcsize", calcsize, METH_O, calcsize_doc},
|
CALCSIZE_METHODDEF
|
||||||
{"iter_unpack", iter_unpack, METH_VARARGS, iter_unpack_doc},
|
ITER_UNPACK_METHODDEF
|
||||||
{"pack", pack, METH_VARARGS, pack_doc},
|
{"pack", (PyCFunction)pack, METH_FASTCALL, pack_doc},
|
||||||
{"pack_into", pack_into, METH_VARARGS, pack_into_doc},
|
{"pack_into", (PyCFunction)pack_into, METH_FASTCALL, pack_into_doc},
|
||||||
{"unpack", unpack, METH_VARARGS, unpack_doc},
|
UNPACK_METHODDEF
|
||||||
{"unpack_from", (PyCFunction)unpack_from,
|
UNPACK_FROM_METHODDEF
|
||||||
METH_VARARGS|METH_KEYWORDS, unpack_from_doc},
|
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2344,6 +2359,9 @@ PyInit__struct(void)
|
||||||
if (PyType_Ready(&PyStructType) < 0)
|
if (PyType_Ready(&PyStructType) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (PyType_Ready(&unpackiter_type) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Check endian and swap in faster functions */
|
/* Check endian and swap in faster functions */
|
||||||
{
|
{
|
||||||
const formatdef *native = native_table;
|
const formatdef *native = native_table;
|
||||||
|
|
1
third_party/python/Modules/audioop.c
vendored
1
third_party/python/Modules/audioop.c
vendored
|
@ -7,6 +7,7 @@
|
||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
#include "dsp/core/core.h"
|
#include "dsp/core/core.h"
|
||||||
#include "libc/math.h"
|
#include "libc/math.h"
|
||||||
|
#include "third_party/python/Include/abstract.h"
|
||||||
#include "third_party/python/Include/dictobject.h"
|
#include "third_party/python/Include/dictobject.h"
|
||||||
#include "third_party/python/Include/floatobject.h"
|
#include "third_party/python/Include/floatobject.h"
|
||||||
#include "third_party/python/Include/import.h"
|
#include "third_party/python/Include/import.h"
|
||||||
|
|
|
@ -31,7 +31,7 @@ _multibytecodec_MultibyteCodec_encode(MultibyteCodecObject *self, PyObject **arg
|
||||||
PyObject *input;
|
PyObject *input;
|
||||||
const char *errors = NULL;
|
const char *errors = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&input, &errors)) {
|
&input, &errors)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ _multibytecodec_MultibyteCodec_decode(MultibyteCodecObject *self, PyObject **arg
|
||||||
Py_buffer input = {NULL, NULL};
|
Py_buffer input = {NULL, NULL};
|
||||||
const char *errors = NULL;
|
const char *errors = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&input, &errors)) {
|
&input, &errors)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ _multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderOb
|
||||||
PyObject *input;
|
PyObject *input;
|
||||||
int final = 0;
|
int final = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&input, &final)) {
|
&input, &final)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ _multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderOb
|
||||||
Py_buffer input = {NULL, NULL};
|
Py_buffer input = {NULL, NULL};
|
||||||
int final = 0;
|
int final = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&input, &final)) {
|
&input, &final)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,7 @@ _asyncio_Task_current_task(PyTypeObject *type, PyObject **args, Py_ssize_t nargs
|
||||||
static _PyArg_Parser _parser = {"|O:current_task", _keywords, 0};
|
static _PyArg_Parser _parser = {"|O:current_task", _keywords, 0};
|
||||||
PyObject *loop = Py_None;
|
PyObject *loop = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&loop)) {
|
&loop)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ _asyncio_Task_all_tasks(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, P
|
||||||
static _PyArg_Parser _parser = {"|O:all_tasks", _keywords, 0};
|
static _PyArg_Parser _parser = {"|O:all_tasks", _keywords, 0};
|
||||||
PyObject *loop = Py_None;
|
PyObject *loop = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&loop)) {
|
&loop)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ _asyncio_Task_get_stack(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObje
|
||||||
static _PyArg_Parser _parser = {"|$O:get_stack", _keywords, 0};
|
static _PyArg_Parser _parser = {"|$O:get_stack", _keywords, 0};
|
||||||
PyObject *limit = Py_None;
|
PyObject *limit = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&limit)) {
|
&limit)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ _asyncio_Task_print_stack(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyOb
|
||||||
PyObject *limit = Py_None;
|
PyObject *limit = Py_None;
|
||||||
PyObject *file = Py_None;
|
PyObject *file = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&limit, &file)) {
|
&limit, &file)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ _asyncio_Task__step(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject *
|
||||||
static _PyArg_Parser _parser = {"|O:_step", _keywords, 0};
|
static _PyArg_Parser _parser = {"|O:_step", _keywords, 0};
|
||||||
PyObject *exc = Py_None;
|
PyObject *exc = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&exc)) {
|
&exc)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,7 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject
|
||||||
static _PyArg_Parser _parser = {"O:_wakeup", _keywords, 0};
|
static _PyArg_Parser _parser = {"O:_wakeup", _keywords, 0};
|
||||||
PyObject *fut;
|
PyObject *fut;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&fut)) {
|
&fut)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -518,4 +518,4 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=7441872b13652085 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=1f2f5bbc35bc3c4e input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -131,7 +131,7 @@ _bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject **args, Py_ssize
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
Py_ssize_t max_length = -1;
|
Py_ssize_t max_length = -1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&data, &max_length)) {
|
&data, &max_length)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -175,4 +175,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=7e57af0b368d3e55 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=0e97a1d716b35a14 input=a9049054013a1b77]*/
|
||||||
|
|
406
third_party/python/Modules/clinic/_codecsmodule.inc
vendored
406
third_party/python/Modules/clinic/_codecsmodule.inc
vendored
File diff suppressed because it is too large
Load diff
|
@ -15,25 +15,29 @@ PyDoc_STRVAR(crypt_crypt__doc__,
|
||||||
"results for a given *word*.");
|
"results for a given *word*.");
|
||||||
|
|
||||||
#define CRYPT_CRYPT_METHODDEF \
|
#define CRYPT_CRYPT_METHODDEF \
|
||||||
{"crypt", (PyCFunction)crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
|
{"crypt", (PyCFunction)crypt_crypt, METH_FASTCALL, crypt_crypt__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
crypt_crypt_impl(PyObject *module, const char *word, const char *salt);
|
crypt_crypt_impl(PyObject *module, const char *word, const char *salt);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
crypt_crypt(PyObject *module, PyObject *args)
|
crypt_crypt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
const char *word;
|
const char *word;
|
||||||
const char *salt;
|
const char *salt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "ss:crypt",
|
if (!_PyArg_ParseStack(args, nargs, "ss:crypt",
|
||||||
&word, &salt)) {
|
&word, &salt)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("crypt", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = crypt_crypt_impl(module, word, salt);
|
return_value = crypt_crypt_impl(module, word, salt);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=8dfc88264e662df4 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=3fd5d3625a6f32fe input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -28,7 +28,7 @@ datetime_datetime_now(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyO
|
||||||
static _PyArg_Parser _parser = {"|O:now", _keywords, 0};
|
static _PyArg_Parser _parser = {"|O:now", _keywords, 0};
|
||||||
PyObject *tz = Py_None;
|
PyObject *tz = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&tz)) {
|
&tz)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,4 @@ datetime_datetime_now(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyO
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=8aaac0705add61ca input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=ff78f2f51687e9a9 input=a9049054013a1b77]*/
|
||||||
|
|
32
third_party/python/Modules/clinic/_dbmmodule.inc
vendored
32
third_party/python/Modules/clinic/_dbmmodule.inc
vendored
|
@ -46,24 +46,28 @@ PyDoc_STRVAR(_dbm_dbm_get__doc__,
|
||||||
"Return the value for key if present, otherwise default.");
|
"Return the value for key if present, otherwise default.");
|
||||||
|
|
||||||
#define _DBM_DBM_GET_METHODDEF \
|
#define _DBM_DBM_GET_METHODDEF \
|
||||||
{"get", (PyCFunction)_dbm_dbm_get, METH_VARARGS, _dbm_dbm_get__doc__},
|
{"get", (PyCFunction)_dbm_dbm_get, METH_FASTCALL, _dbm_dbm_get__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_dbm_dbm_get_impl(dbmobject *self, const char *key,
|
_dbm_dbm_get_impl(dbmobject *self, const char *key,
|
||||||
Py_ssize_clean_t key_length, PyObject *default_value);
|
Py_ssize_clean_t key_length, PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_dbm_dbm_get(dbmobject *self, PyObject *args)
|
_dbm_dbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
const char *key;
|
const char *key;
|
||||||
Py_ssize_clean_t key_length;
|
Py_ssize_clean_t key_length;
|
||||||
PyObject *default_value = Py_None;
|
PyObject *default_value = Py_None;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s#|O:get",
|
if (!_PyArg_ParseStack(args, nargs, "s#|O:get",
|
||||||
&key, &key_length, &default_value)) {
|
&key, &key_length, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("get", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _dbm_dbm_get_impl(self, key, key_length, default_value);
|
return_value = _dbm_dbm_get_impl(self, key, key_length, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -79,7 +83,7 @@ PyDoc_STRVAR(_dbm_dbm_setdefault__doc__,
|
||||||
"If key is not in the database, it is inserted with default as the value.");
|
"If key is not in the database, it is inserted with default as the value.");
|
||||||
|
|
||||||
#define _DBM_DBM_SETDEFAULT_METHODDEF \
|
#define _DBM_DBM_SETDEFAULT_METHODDEF \
|
||||||
{"setdefault", (PyCFunction)_dbm_dbm_setdefault, METH_VARARGS, _dbm_dbm_setdefault__doc__},
|
{"setdefault", (PyCFunction)_dbm_dbm_setdefault, METH_FASTCALL, _dbm_dbm_setdefault__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_dbm_dbm_setdefault_impl(dbmobject *self, const char *key,
|
_dbm_dbm_setdefault_impl(dbmobject *self, const char *key,
|
||||||
|
@ -87,17 +91,21 @@ _dbm_dbm_setdefault_impl(dbmobject *self, const char *key,
|
||||||
PyObject *default_value);
|
PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_dbm_dbm_setdefault(dbmobject *self, PyObject *args)
|
_dbm_dbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
const char *key;
|
const char *key;
|
||||||
Py_ssize_clean_t key_length;
|
Py_ssize_clean_t key_length;
|
||||||
PyObject *default_value = NULL;
|
PyObject *default_value = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s#|O:setdefault",
|
if (!_PyArg_ParseStack(args, nargs, "s#|O:setdefault",
|
||||||
&key, &key_length, &default_value)) {
|
&key, &key_length, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("setdefault", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value);
|
return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -119,27 +127,31 @@ PyDoc_STRVAR(dbmopen__doc__,
|
||||||
" (e.g. os.O_RDWR).");
|
" (e.g. os.O_RDWR).");
|
||||||
|
|
||||||
#define DBMOPEN_METHODDEF \
|
#define DBMOPEN_METHODDEF \
|
||||||
{"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__},
|
{"open", (PyCFunction)dbmopen, METH_FASTCALL, dbmopen__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
|
dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
|
||||||
int mode);
|
int mode);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dbmopen(PyObject *module, PyObject *args)
|
dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *filename;
|
PyObject *filename;
|
||||||
const char *flags = "r";
|
const char *flags = "r";
|
||||||
int mode = 438;
|
int mode = 438;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "U|si:open",
|
if (!_PyArg_ParseStack(args, nargs, "U|si:open",
|
||||||
&filename, &flags, &mode)) {
|
&filename, &flags, &mode)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("open", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = dbmopen_impl(module, filename, flags, mode);
|
return_value = dbmopen_impl(module, filename, flags, mode);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=919cc4337be4a5d3 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=60482e924110a70a input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -152,7 +152,7 @@ _elementtree_Element_find(ElementObject *self, PyObject **args, Py_ssize_t nargs
|
||||||
PyObject *path;
|
PyObject *path;
|
||||||
PyObject *namespaces = Py_None;
|
PyObject *namespaces = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&path, &namespaces)) {
|
&path, &namespaces)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ _elementtree_Element_findtext(ElementObject *self, PyObject **args, Py_ssize_t n
|
||||||
PyObject *default_value = Py_None;
|
PyObject *default_value = Py_None;
|
||||||
PyObject *namespaces = Py_None;
|
PyObject *namespaces = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&path, &default_value, &namespaces)) {
|
&path, &default_value, &namespaces)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ _elementtree_Element_findall(ElementObject *self, PyObject **args, Py_ssize_t na
|
||||||
PyObject *path;
|
PyObject *path;
|
||||||
PyObject *namespaces = Py_None;
|
PyObject *namespaces = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&path, &namespaces)) {
|
&path, &namespaces)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ _elementtree_Element_iterfind(ElementObject *self, PyObject **args, Py_ssize_t n
|
||||||
PyObject *path;
|
PyObject *path;
|
||||||
PyObject *namespaces = Py_None;
|
PyObject *namespaces = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&path, &namespaces)) {
|
&path, &namespaces)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ _elementtree_Element_get(ElementObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
PyObject *key;
|
PyObject *key;
|
||||||
PyObject *default_value = Py_None;
|
PyObject *default_value = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&key, &default_value)) {
|
&key, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ _elementtree_Element_iter(ElementObject *self, PyObject **args, Py_ssize_t nargs
|
||||||
static _PyArg_Parser _parser = {"|O:iter", _keywords, 0};
|
static _PyArg_Parser _parser = {"|O:iter", _keywords, 0};
|
||||||
PyObject *tag = Py_None;
|
PyObject *tag = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&tag)) {
|
&tag)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -357,23 +357,27 @@ PyDoc_STRVAR(_elementtree_Element_insert__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _ELEMENTTREE_ELEMENT_INSERT_METHODDEF \
|
#define _ELEMENTTREE_ELEMENT_INSERT_METHODDEF \
|
||||||
{"insert", (PyCFunction)_elementtree_Element_insert, METH_VARARGS, _elementtree_Element_insert__doc__},
|
{"insert", (PyCFunction)_elementtree_Element_insert, METH_FASTCALL, _elementtree_Element_insert__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_Element_insert_impl(ElementObject *self, Py_ssize_t index,
|
_elementtree_Element_insert_impl(ElementObject *self, Py_ssize_t index,
|
||||||
PyObject *subelement);
|
PyObject *subelement);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_Element_insert(ElementObject *self, PyObject *args)
|
_elementtree_Element_insert(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t index;
|
Py_ssize_t index;
|
||||||
PyObject *subelement;
|
PyObject *subelement;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "nO!:insert",
|
if (!_PyArg_ParseStack(args, nargs, "nO!:insert",
|
||||||
&index, &Element_Type, &subelement)) {
|
&index, &Element_Type, &subelement)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _elementtree_Element_insert_impl(self, index, subelement);
|
return_value = _elementtree_Element_insert_impl(self, index, subelement);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -420,24 +424,28 @@ PyDoc_STRVAR(_elementtree_Element_makeelement__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _ELEMENTTREE_ELEMENT_MAKEELEMENT_METHODDEF \
|
#define _ELEMENTTREE_ELEMENT_MAKEELEMENT_METHODDEF \
|
||||||
{"makeelement", (PyCFunction)_elementtree_Element_makeelement, METH_VARARGS, _elementtree_Element_makeelement__doc__},
|
{"makeelement", (PyCFunction)_elementtree_Element_makeelement, METH_FASTCALL, _elementtree_Element_makeelement__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_Element_makeelement_impl(ElementObject *self, PyObject *tag,
|
_elementtree_Element_makeelement_impl(ElementObject *self, PyObject *tag,
|
||||||
PyObject *attrib);
|
PyObject *attrib);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_Element_makeelement(ElementObject *self, PyObject *args)
|
_elementtree_Element_makeelement(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *tag;
|
PyObject *tag;
|
||||||
PyObject *attrib;
|
PyObject *attrib;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "makeelement",
|
if (!_PyArg_UnpackStack(args, nargs, "makeelement",
|
||||||
2, 2,
|
2, 2,
|
||||||
&tag, &attrib)) {
|
&tag, &attrib)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("makeelement", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _elementtree_Element_makeelement_impl(self, tag, attrib);
|
return_value = _elementtree_Element_makeelement_impl(self, tag, attrib);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -476,24 +484,28 @@ PyDoc_STRVAR(_elementtree_Element_set__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _ELEMENTTREE_ELEMENT_SET_METHODDEF \
|
#define _ELEMENTTREE_ELEMENT_SET_METHODDEF \
|
||||||
{"set", (PyCFunction)_elementtree_Element_set, METH_VARARGS, _elementtree_Element_set__doc__},
|
{"set", (PyCFunction)_elementtree_Element_set, METH_FASTCALL, _elementtree_Element_set__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_Element_set_impl(ElementObject *self, PyObject *key,
|
_elementtree_Element_set_impl(ElementObject *self, PyObject *key,
|
||||||
PyObject *value);
|
PyObject *value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_Element_set(ElementObject *self, PyObject *args)
|
_elementtree_Element_set(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *key;
|
PyObject *key;
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "set",
|
if (!_PyArg_UnpackStack(args, nargs, "set",
|
||||||
2, 2,
|
2, 2,
|
||||||
&key, &value)) {
|
&key, &value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("set", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _elementtree_Element_set_impl(self, key, value);
|
return_value = _elementtree_Element_set_impl(self, key, value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -561,24 +573,28 @@ PyDoc_STRVAR(_elementtree_TreeBuilder_start__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _ELEMENTTREE_TREEBUILDER_START_METHODDEF \
|
#define _ELEMENTTREE_TREEBUILDER_START_METHODDEF \
|
||||||
{"start", (PyCFunction)_elementtree_TreeBuilder_start, METH_VARARGS, _elementtree_TreeBuilder_start__doc__},
|
{"start", (PyCFunction)_elementtree_TreeBuilder_start, METH_FASTCALL, _elementtree_TreeBuilder_start__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag,
|
_elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag,
|
||||||
PyObject *attrs);
|
PyObject *attrs);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject *args)
|
_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *tag;
|
PyObject *tag;
|
||||||
PyObject *attrs = Py_None;
|
PyObject *attrs = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "start",
|
if (!_PyArg_UnpackStack(args, nargs, "start",
|
||||||
1, 2,
|
1, 2,
|
||||||
&tag, &attrs)) {
|
&tag, &attrs)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("start", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs);
|
return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -648,25 +664,29 @@ PyDoc_STRVAR(_elementtree_XMLParser_doctype__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _ELEMENTTREE_XMLPARSER_DOCTYPE_METHODDEF \
|
#define _ELEMENTTREE_XMLPARSER_DOCTYPE_METHODDEF \
|
||||||
{"doctype", (PyCFunction)_elementtree_XMLParser_doctype, METH_VARARGS, _elementtree_XMLParser_doctype__doc__},
|
{"doctype", (PyCFunction)_elementtree_XMLParser_doctype, METH_FASTCALL, _elementtree_XMLParser_doctype__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
|
_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
|
||||||
PyObject *pubid, PyObject *system);
|
PyObject *pubid, PyObject *system);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject *args)
|
_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *name;
|
PyObject *name;
|
||||||
PyObject *pubid;
|
PyObject *pubid;
|
||||||
PyObject *system;
|
PyObject *system;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "doctype",
|
if (!_PyArg_UnpackStack(args, nargs, "doctype",
|
||||||
3, 3,
|
3, 3,
|
||||||
&name, &pubid, &system)) {
|
&name, &pubid, &system)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("doctype", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system);
|
return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -679,7 +699,7 @@ PyDoc_STRVAR(_elementtree_XMLParser__setevents__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _ELEMENTTREE_XMLPARSER__SETEVENTS_METHODDEF \
|
#define _ELEMENTTREE_XMLPARSER__SETEVENTS_METHODDEF \
|
||||||
{"_setevents", (PyCFunction)_elementtree_XMLParser__setevents, METH_VARARGS, _elementtree_XMLParser__setevents__doc__},
|
{"_setevents", (PyCFunction)_elementtree_XMLParser__setevents, METH_FASTCALL, _elementtree_XMLParser__setevents__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_XMLParser__setevents_impl(XMLParserObject *self,
|
_elementtree_XMLParser__setevents_impl(XMLParserObject *self,
|
||||||
|
@ -687,20 +707,24 @@ _elementtree_XMLParser__setevents_impl(XMLParserObject *self,
|
||||||
PyObject *events_to_report);
|
PyObject *events_to_report);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *args)
|
_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *events_queue;
|
PyObject *events_queue;
|
||||||
PyObject *events_to_report = Py_None;
|
PyObject *events_to_report = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "_setevents",
|
if (!_PyArg_UnpackStack(args, nargs, "_setevents",
|
||||||
1, 2,
|
1, 2,
|
||||||
&events_queue, &events_to_report)) {
|
&events_queue, &events_to_report)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("_setevents", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report);
|
return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=b4a571a98ced3163 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=b69fa98c40917f58 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -10,23 +10,27 @@ PyDoc_STRVAR(_gdbm_gdbm_get__doc__,
|
||||||
"Get the value for key, or default if not present.");
|
"Get the value for key, or default if not present.");
|
||||||
|
|
||||||
#define _GDBM_GDBM_GET_METHODDEF \
|
#define _GDBM_GDBM_GET_METHODDEF \
|
||||||
{"get", (PyCFunction)_gdbm_gdbm_get, METH_VARARGS, _gdbm_gdbm_get__doc__},
|
{"get", (PyCFunction)_gdbm_gdbm_get, METH_FASTCALL, _gdbm_gdbm_get__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value);
|
_gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_gdbm_gdbm_get(dbmobject *self, PyObject *args)
|
_gdbm_gdbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *key;
|
PyObject *key;
|
||||||
PyObject *default_value = Py_None;
|
PyObject *default_value = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "get",
|
if (!_PyArg_UnpackStack(args, nargs, "get",
|
||||||
1, 2,
|
1, 2,
|
||||||
&key, &default_value)) {
|
&key, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("get", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _gdbm_gdbm_get_impl(self, key, default_value);
|
return_value = _gdbm_gdbm_get_impl(self, key, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -40,24 +44,28 @@ PyDoc_STRVAR(_gdbm_gdbm_setdefault__doc__,
|
||||||
"Get value for key, or set it to default and return default if not present.");
|
"Get value for key, or set it to default and return default if not present.");
|
||||||
|
|
||||||
#define _GDBM_GDBM_SETDEFAULT_METHODDEF \
|
#define _GDBM_GDBM_SETDEFAULT_METHODDEF \
|
||||||
{"setdefault", (PyCFunction)_gdbm_gdbm_setdefault, METH_VARARGS, _gdbm_gdbm_setdefault__doc__},
|
{"setdefault", (PyCFunction)_gdbm_gdbm_setdefault, METH_FASTCALL, _gdbm_gdbm_setdefault__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key,
|
_gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key,
|
||||||
PyObject *default_value);
|
PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_gdbm_gdbm_setdefault(dbmobject *self, PyObject *args)
|
_gdbm_gdbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *key;
|
PyObject *key;
|
||||||
PyObject *default_value = Py_None;
|
PyObject *default_value = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "setdefault",
|
if (!_PyArg_UnpackStack(args, nargs, "setdefault",
|
||||||
1, 2,
|
1, 2,
|
||||||
&key, &default_value)) {
|
&key, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("setdefault", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value);
|
return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -232,27 +240,31 @@ PyDoc_STRVAR(dbmopen__doc__,
|
||||||
"when the database has to be created. It defaults to octal 0o666.");
|
"when the database has to be created. It defaults to octal 0o666.");
|
||||||
|
|
||||||
#define DBMOPEN_METHODDEF \
|
#define DBMOPEN_METHODDEF \
|
||||||
{"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__},
|
{"open", (PyCFunction)dbmopen, METH_FASTCALL, dbmopen__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
|
dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
|
||||||
int mode);
|
int mode);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dbmopen(PyObject *module, PyObject *args)
|
dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *filename;
|
PyObject *filename;
|
||||||
const char *flags = "r";
|
const char *flags = "r";
|
||||||
int mode = 438;
|
int mode = 438;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "U|si:open",
|
if (!_PyArg_ParseStack(args, nargs, "U|si:open",
|
||||||
&filename, &flags, &mode)) {
|
&filename, &flags, &mode)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("open", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = dbmopen_impl(module, filename, flags, mode);
|
return_value = dbmopen_impl(module, filename, flags, mode);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=afb99364ac420d10 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=d12de247acddccc3 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -97,7 +97,7 @@ _lzma_LZMADecompressor_decompress(Decompressor *self, PyObject **args, Py_ssize_
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
Py_ssize_t max_length = -1;
|
Py_ssize_t max_length = -1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&data, &max_length)) {
|
&data, &max_length)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -230,23 +230,27 @@ PyDoc_STRVAR(_lzma__decode_filter_properties__doc__,
|
||||||
"The result does not include the filter ID itself, only the options.");
|
"The result does not include the filter ID itself, only the options.");
|
||||||
|
|
||||||
#define _LZMA__DECODE_FILTER_PROPERTIES_METHODDEF \
|
#define _LZMA__DECODE_FILTER_PROPERTIES_METHODDEF \
|
||||||
{"_decode_filter_properties", (PyCFunction)_lzma__decode_filter_properties, METH_VARARGS, _lzma__decode_filter_properties__doc__},
|
{"_decode_filter_properties", (PyCFunction)_lzma__decode_filter_properties, METH_FASTCALL, _lzma__decode_filter_properties__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_lzma__decode_filter_properties_impl(PyObject *module, lzma_vli filter_id,
|
_lzma__decode_filter_properties_impl(PyObject *module, lzma_vli filter_id,
|
||||||
Py_buffer *encoded_props);
|
Py_buffer *encoded_props);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_lzma__decode_filter_properties(PyObject *module, PyObject *args)
|
_lzma__decode_filter_properties(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
lzma_vli filter_id;
|
lzma_vli filter_id;
|
||||||
Py_buffer encoded_props = {NULL, NULL};
|
Py_buffer encoded_props = {NULL, NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O&y*:_decode_filter_properties",
|
if (!_PyArg_ParseStack(args, nargs, "O&y*:_decode_filter_properties",
|
||||||
lzma_vli_converter, &filter_id, &encoded_props)) {
|
lzma_vli_converter, &filter_id, &encoded_props)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("_decode_filter_properties", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props);
|
return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -257,4 +261,4 @@ exit:
|
||||||
|
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=f27abae460122706 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=5f7a915fb7e41453 input=a9049054013a1b77]*/
|
||||||
|
|
12
third_party/python/Modules/clinic/_opcode.inc
vendored
12
third_party/python/Modules/clinic/_opcode.inc
vendored
|
@ -10,23 +10,27 @@ PyDoc_STRVAR(_opcode_stack_effect__doc__,
|
||||||
"Compute the stack effect of the opcode.");
|
"Compute the stack effect of the opcode.");
|
||||||
|
|
||||||
#define _OPCODE_STACK_EFFECT_METHODDEF \
|
#define _OPCODE_STACK_EFFECT_METHODDEF \
|
||||||
{"stack_effect", (PyCFunction)_opcode_stack_effect, METH_VARARGS, _opcode_stack_effect__doc__},
|
{"stack_effect", (PyCFunction)_opcode_stack_effect, METH_FASTCALL, _opcode_stack_effect__doc__},
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg);
|
_opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_opcode_stack_effect(PyObject *module, PyObject *args)
|
_opcode_stack_effect(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int opcode;
|
int opcode;
|
||||||
PyObject *oparg = Py_None;
|
PyObject *oparg = Py_None;
|
||||||
int _return_value;
|
int _return_value;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "i|O:stack_effect",
|
if (!_PyArg_ParseStack(args, nargs, "i|O:stack_effect",
|
||||||
&opcode, &oparg)) {
|
&opcode, &oparg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("stack_effect", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
_return_value = _opcode_stack_effect_impl(module, opcode, oparg);
|
_return_value = _opcode_stack_effect_impl(module, opcode, oparg);
|
||||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -36,4 +40,4 @@ _opcode_stack_effect(PyObject *module, PyObject *args)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=4d91c6a765097853 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=62858005ac85baa9 input=a9049054013a1b77]*/
|
||||||
|
|
20
third_party/python/Modules/clinic/_pickle.inc
vendored
20
third_party/python/Modules/clinic/_pickle.inc
vendored
|
@ -200,7 +200,7 @@ PyDoc_STRVAR(_pickle_Unpickler_find_class__doc__,
|
||||||
"needed. Both arguments passed are str objects.");
|
"needed. Both arguments passed are str objects.");
|
||||||
|
|
||||||
#define _PICKLE_UNPICKLER_FIND_CLASS_METHODDEF \
|
#define _PICKLE_UNPICKLER_FIND_CLASS_METHODDEF \
|
||||||
{"find_class", (PyCFunction)_pickle_Unpickler_find_class, METH_VARARGS, _pickle_Unpickler_find_class__doc__},
|
{"find_class", (PyCFunction)_pickle_Unpickler_find_class, METH_FASTCALL, _pickle_Unpickler_find_class__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_pickle_Unpickler_find_class_impl(UnpicklerObject *self,
|
_pickle_Unpickler_find_class_impl(UnpicklerObject *self,
|
||||||
|
@ -208,17 +208,21 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self,
|
||||||
PyObject *global_name);
|
PyObject *global_name);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject *args)
|
_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *module_name;
|
PyObject *module_name;
|
||||||
PyObject *global_name;
|
PyObject *global_name;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "find_class",
|
if (!_PyArg_UnpackStack(args, nargs, "find_class",
|
||||||
2, 2,
|
2, 2,
|
||||||
&module_name, &global_name)) {
|
&module_name, &global_name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("find_class", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name);
|
return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -402,7 +406,7 @@ _pickle_dump(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna
|
||||||
PyObject *protocol = NULL;
|
PyObject *protocol = NULL;
|
||||||
int fix_imports = 1;
|
int fix_imports = 1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&obj, &file, &protocol, &fix_imports)) {
|
&obj, &file, &protocol, &fix_imports)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -447,7 +451,7 @@ _pickle_dumps(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
|
||||||
PyObject *protocol = NULL;
|
PyObject *protocol = NULL;
|
||||||
int fix_imports = 1;
|
int fix_imports = 1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&obj, &protocol, &fix_imports)) {
|
&obj, &protocol, &fix_imports)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -504,7 +508,7 @@ _pickle_load(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna
|
||||||
const char *encoding = "ASCII";
|
const char *encoding = "ASCII";
|
||||||
const char *errors = "strict";
|
const char *errors = "strict";
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&file, &fix_imports, &encoding, &errors)) {
|
&file, &fix_imports, &encoding, &errors)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +556,7 @@ _pickle_loads(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
|
||||||
const char *encoding = "ASCII";
|
const char *encoding = "ASCII";
|
||||||
const char *errors = "strict";
|
const char *errors = "strict";
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&data, &fix_imports, &encoding, &errors)) {
|
&data, &fix_imports, &encoding, &errors)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -561,4 +565,4 @@ _pickle_loads(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=82be137b3c09cb9f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=b921d325b2f7a096 input=a9049054013a1b77]*/
|
||||||
|
|
72
third_party/python/Modules/clinic/_sre.inc
vendored
72
third_party/python/Modules/clinic/_sre.inc
vendored
|
@ -36,23 +36,27 @@ PyDoc_STRVAR(_sre_getlower__doc__,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
#define _SRE_GETLOWER_METHODDEF \
|
#define _SRE_GETLOWER_METHODDEF \
|
||||||
{"getlower", (PyCFunction)_sre_getlower, METH_VARARGS, _sre_getlower__doc__},
|
{"getlower", (PyCFunction)_sre_getlower, METH_FASTCALL, _sre_getlower__doc__},
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_sre_getlower_impl(PyObject *module, int character, int flags);
|
_sre_getlower_impl(PyObject *module, int character, int flags);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_sre_getlower(PyObject *module, PyObject *args)
|
_sre_getlower(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int character;
|
int character;
|
||||||
int flags;
|
int flags;
|
||||||
int _return_value;
|
int _return_value;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "ii:getlower",
|
if (!_PyArg_ParseStack(args, nargs, "ii:getlower",
|
||||||
&character, &flags)) {
|
&character, &flags)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("getlower", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
_return_value = _sre_getlower_impl(module, character, flags);
|
_return_value = _sre_getlower_impl(module, character, flags);
|
||||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -88,7 +92,7 @@ _sre_SRE_Pattern_match(PatternObject *self, PyObject **args, Py_ssize_t nargs, P
|
||||||
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
||||||
PyObject *pattern = NULL;
|
PyObject *pattern = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&string, &pos, &endpos, &pattern)) {
|
&string, &pos, &endpos, &pattern)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +128,7 @@ _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject **args, Py_ssize_t narg
|
||||||
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
||||||
PyObject *pattern = NULL;
|
PyObject *pattern = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&string, &pos, &endpos, &pattern)) {
|
&string, &pos, &endpos, &pattern)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +166,7 @@ _sre_SRE_Pattern_search(PatternObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
||||||
PyObject *pattern = NULL;
|
PyObject *pattern = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&string, &pos, &endpos, &pattern)) {
|
&string, &pos, &endpos, &pattern)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +202,7 @@ _sre_SRE_Pattern_findall(PatternObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
||||||
PyObject *source = NULL;
|
PyObject *source = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&string, &pos, &endpos, &source)) {
|
&string, &pos, &endpos, &source)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +237,7 @@ _sre_SRE_Pattern_finditer(PatternObject *self, PyObject **args, Py_ssize_t nargs
|
||||||
Py_ssize_t pos = 0;
|
Py_ssize_t pos = 0;
|
||||||
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&string, &pos, &endpos)) {
|
&string, &pos, &endpos)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +269,7 @@ _sre_SRE_Pattern_scanner(PatternObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
Py_ssize_t pos = 0;
|
Py_ssize_t pos = 0;
|
||||||
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
Py_ssize_t endpos = PY_SSIZE_T_MAX;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&string, &pos, &endpos)) {
|
&string, &pos, &endpos)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -298,7 +302,7 @@ _sre_SRE_Pattern_split(PatternObject *self, PyObject **args, Py_ssize_t nargs, P
|
||||||
Py_ssize_t maxsplit = 0;
|
Py_ssize_t maxsplit = 0;
|
||||||
PyObject *source = NULL;
|
PyObject *source = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&string, &maxsplit, &source)) {
|
&string, &maxsplit, &source)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +335,7 @@ _sre_SRE_Pattern_sub(PatternObject *self, PyObject **args, Py_ssize_t nargs, PyO
|
||||||
PyObject *string;
|
PyObject *string;
|
||||||
Py_ssize_t count = 0;
|
Py_ssize_t count = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&repl, &string, &count)) {
|
&repl, &string, &count)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -364,7 +368,7 @@ _sre_SRE_Pattern_subn(PatternObject *self, PyObject **args, Py_ssize_t nargs, Py
|
||||||
PyObject *string;
|
PyObject *string;
|
||||||
Py_ssize_t count = 0;
|
Py_ssize_t count = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&repl, &string, &count)) {
|
&repl, &string, &count)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -410,7 +414,7 @@ _sre_SRE_Pattern___deepcopy__(PatternObject *self, PyObject **args, Py_ssize_t n
|
||||||
static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0};
|
static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0};
|
||||||
PyObject *memo;
|
PyObject *memo;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&memo)) {
|
&memo)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -447,7 +451,7 @@ _sre_compile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna
|
||||||
PyObject *groupindex;
|
PyObject *groupindex;
|
||||||
PyObject *indexgroup;
|
PyObject *indexgroup;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) {
|
&pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -477,7 +481,7 @@ _sre_SRE_Match_expand(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyOb
|
||||||
static _PyArg_Parser _parser = {"O:expand", _keywords, 0};
|
static _PyArg_Parser _parser = {"O:expand", _keywords, 0};
|
||||||
PyObject *template;
|
PyObject *template;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&template)) {
|
&template)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -510,7 +514,7 @@ _sre_SRE_Match_groups(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyOb
|
||||||
static _PyArg_Parser _parser = {"|O:groups", _keywords, 0};
|
static _PyArg_Parser _parser = {"|O:groups", _keywords, 0};
|
||||||
PyObject *default_value = Py_None;
|
PyObject *default_value = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&default_value)) {
|
&default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -543,7 +547,7 @@ _sre_SRE_Match_groupdict(MatchObject *self, PyObject **args, Py_ssize_t nargs, P
|
||||||
static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0};
|
static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0};
|
||||||
PyObject *default_value = Py_None;
|
PyObject *default_value = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&default_value)) {
|
&default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -560,23 +564,27 @@ PyDoc_STRVAR(_sre_SRE_Match_start__doc__,
|
||||||
"Return index of the start of the substring matched by group.");
|
"Return index of the start of the substring matched by group.");
|
||||||
|
|
||||||
#define _SRE_SRE_MATCH_START_METHODDEF \
|
#define _SRE_SRE_MATCH_START_METHODDEF \
|
||||||
{"start", (PyCFunction)_sre_SRE_Match_start, METH_VARARGS, _sre_SRE_Match_start__doc__},
|
{"start", (PyCFunction)_sre_SRE_Match_start, METH_FASTCALL, _sre_SRE_Match_start__doc__},
|
||||||
|
|
||||||
static Py_ssize_t
|
static Py_ssize_t
|
||||||
_sre_SRE_Match_start_impl(MatchObject *self, PyObject *group);
|
_sre_SRE_Match_start_impl(MatchObject *self, PyObject *group);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_sre_SRE_Match_start(MatchObject *self, PyObject *args)
|
_sre_SRE_Match_start(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *group = NULL;
|
PyObject *group = NULL;
|
||||||
Py_ssize_t _return_value;
|
Py_ssize_t _return_value;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "start",
|
if (!_PyArg_UnpackStack(args, nargs, "start",
|
||||||
0, 1,
|
0, 1,
|
||||||
&group)) {
|
&group)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("start", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
_return_value = _sre_SRE_Match_start_impl(self, group);
|
_return_value = _sre_SRE_Match_start_impl(self, group);
|
||||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -594,23 +602,27 @@ PyDoc_STRVAR(_sre_SRE_Match_end__doc__,
|
||||||
"Return index of the end of the substring matched by group.");
|
"Return index of the end of the substring matched by group.");
|
||||||
|
|
||||||
#define _SRE_SRE_MATCH_END_METHODDEF \
|
#define _SRE_SRE_MATCH_END_METHODDEF \
|
||||||
{"end", (PyCFunction)_sre_SRE_Match_end, METH_VARARGS, _sre_SRE_Match_end__doc__},
|
{"end", (PyCFunction)_sre_SRE_Match_end, METH_FASTCALL, _sre_SRE_Match_end__doc__},
|
||||||
|
|
||||||
static Py_ssize_t
|
static Py_ssize_t
|
||||||
_sre_SRE_Match_end_impl(MatchObject *self, PyObject *group);
|
_sre_SRE_Match_end_impl(MatchObject *self, PyObject *group);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_sre_SRE_Match_end(MatchObject *self, PyObject *args)
|
_sre_SRE_Match_end(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *group = NULL;
|
PyObject *group = NULL;
|
||||||
Py_ssize_t _return_value;
|
Py_ssize_t _return_value;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "end",
|
if (!_PyArg_UnpackStack(args, nargs, "end",
|
||||||
0, 1,
|
0, 1,
|
||||||
&group)) {
|
&group)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("end", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
_return_value = _sre_SRE_Match_end_impl(self, group);
|
_return_value = _sre_SRE_Match_end_impl(self, group);
|
||||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -628,22 +640,26 @@ PyDoc_STRVAR(_sre_SRE_Match_span__doc__,
|
||||||
"For MatchObject m, return the 2-tuple (m.start(group), m.end(group)).");
|
"For MatchObject m, return the 2-tuple (m.start(group), m.end(group)).");
|
||||||
|
|
||||||
#define _SRE_SRE_MATCH_SPAN_METHODDEF \
|
#define _SRE_SRE_MATCH_SPAN_METHODDEF \
|
||||||
{"span", (PyCFunction)_sre_SRE_Match_span, METH_VARARGS, _sre_SRE_Match_span__doc__},
|
{"span", (PyCFunction)_sre_SRE_Match_span, METH_FASTCALL, _sre_SRE_Match_span__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_sre_SRE_Match_span_impl(MatchObject *self, PyObject *group);
|
_sre_SRE_Match_span_impl(MatchObject *self, PyObject *group);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_sre_SRE_Match_span(MatchObject *self, PyObject *args)
|
_sre_SRE_Match_span(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *group = NULL;
|
PyObject *group = NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "span",
|
if (!_PyArg_UnpackStack(args, nargs, "span",
|
||||||
0, 1,
|
0, 1,
|
||||||
&group)) {
|
&group)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("span", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _sre_SRE_Match_span_impl(self, group);
|
return_value = _sre_SRE_Match_span_impl(self, group);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -686,7 +702,7 @@ _sre_SRE_Match___deepcopy__(MatchObject *self, PyObject **args, Py_ssize_t nargs
|
||||||
static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0};
|
static _PyArg_Parser _parser = {"O:__deepcopy__", _keywords, 0};
|
||||||
PyObject *memo;
|
PyObject *memo;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&memo)) {
|
&memo)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -729,4 +745,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
return _sre_SRE_Scanner_search_impl(self);
|
return _sre_SRE_Scanner_search_impl(self);
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=a4a246bca1963bc9 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=ddfd6158e7ca39a3 input=a9049054013a1b77]*/
|
||||||
|
|
16
third_party/python/Modules/clinic/_ssl.inc
vendored
16
third_party/python/Modules/clinic/_ssl.inc
vendored
|
@ -504,7 +504,7 @@ _ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject **args, Py_ssize_t
|
||||||
PyObject *keyfile = NULL;
|
PyObject *keyfile = NULL;
|
||||||
PyObject *password = NULL;
|
PyObject *password = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&certfile, &keyfile, &password)) {
|
&certfile, &keyfile, &password)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ _ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject **args, Py_s
|
||||||
PyObject *capath = NULL;
|
PyObject *capath = NULL;
|
||||||
PyObject *cadata = NULL;
|
PyObject *cadata = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&cafile, &capath, &cadata)) {
|
&cafile, &capath, &cadata)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject **args, Py_ssize_t na
|
||||||
int server_side;
|
int server_side;
|
||||||
PyObject *hostname_obj = Py_None;
|
PyObject *hostname_obj = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj)) {
|
PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -613,7 +613,7 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject **args, Py_ssize_t nargs
|
||||||
int server_side;
|
int server_side;
|
||||||
PyObject *hostname_obj = Py_None;
|
PyObject *hostname_obj = Py_None;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj)) {
|
&PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -732,7 +732,7 @@ _ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject **args, Py_ssize_t na
|
||||||
static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0};
|
static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0};
|
||||||
int binary_form = 0;
|
int binary_form = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&binary_form)) {
|
&binary_form)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -1044,7 +1044,7 @@ _ssl_txt2obj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna
|
||||||
const char *txt;
|
const char *txt;
|
||||||
int name = 0;
|
int name = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&txt, &name)) {
|
&txt, &name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -1109,7 +1109,7 @@ _ssl_enum_certificates(PyObject *module, PyObject **args, Py_ssize_t nargs, PyOb
|
||||||
static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0};
|
static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0};
|
||||||
const char *store_name;
|
const char *store_name;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&store_name)) {
|
&store_name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1148,7 @@ _ssl_enum_crls(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw
|
||||||
static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0};
|
static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0};
|
||||||
const char *store_name;
|
const char *store_name;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&store_name)) {
|
&store_name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
277
third_party/python/Modules/clinic/_struct.inc
vendored
Normal file
277
third_party/python/Modules/clinic/_struct.inc
vendored
Normal file
|
@ -0,0 +1,277 @@
|
||||||
|
/* clang-format off */
|
||||||
|
/*[clinic input]
|
||||||
|
preserve
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Struct___init____doc__,
|
||||||
|
"Struct(format)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Create a compiled struct object.\n"
|
||||||
|
"\n"
|
||||||
|
"Return a new Struct object which writes and reads binary data according to\n"
|
||||||
|
"the format string.\n"
|
||||||
|
"\n"
|
||||||
|
"See help(struct) for more on format strings.");
|
||||||
|
|
||||||
|
static int
|
||||||
|
Struct___init___impl(PyStructObject *self, PyObject *format);
|
||||||
|
|
||||||
|
static int
|
||||||
|
Struct___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
|
{
|
||||||
|
int return_value = -1;
|
||||||
|
static const char * const _keywords[] = {"format", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"O:Struct", _keywords, 0};
|
||||||
|
PyObject *format;
|
||||||
|
|
||||||
|
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||||
|
&format)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = Struct___init___impl((PyStructObject *)self, format);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Struct_unpack__doc__,
|
||||||
|
"unpack($self, buffer, /)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Return a tuple containing unpacked values.\n"
|
||||||
|
"\n"
|
||||||
|
"Unpack according to the format string Struct.format. The buffer\'s size\n"
|
||||||
|
"in bytes must be Struct.size.\n"
|
||||||
|
"\n"
|
||||||
|
"See help(struct) for more on format strings.");
|
||||||
|
|
||||||
|
#define STRUCT_UNPACK_METHODDEF \
|
||||||
|
{"unpack", (PyCFunction)Struct_unpack, METH_O, Struct_unpack__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
Struct_unpack(PyStructObject *self, PyObject *arg)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
Py_buffer buffer = {NULL, NULL};
|
||||||
|
|
||||||
|
if (!PyArg_Parse(arg, "y*:unpack", &buffer)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = Struct_unpack_impl(self, &buffer);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
/* Cleanup for buffer */
|
||||||
|
if (buffer.obj) {
|
||||||
|
PyBuffer_Release(&buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Struct_unpack_from__doc__,
|
||||||
|
"unpack_from($self, /, buffer, offset=0)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Return a tuple containing unpacked values.\n"
|
||||||
|
"\n"
|
||||||
|
"Values are unpacked according to the format string Struct.format.\n"
|
||||||
|
"\n"
|
||||||
|
"The buffer\'s size in bytes, minus offset, must be at least Struct.size.\n"
|
||||||
|
"\n"
|
||||||
|
"See help(struct) for more on format strings.");
|
||||||
|
|
||||||
|
#define STRUCT_UNPACK_FROM_METHODDEF \
|
||||||
|
{"unpack_from", (PyCFunction)Struct_unpack_from, METH_FASTCALL, Struct_unpack_from__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer,
|
||||||
|
Py_ssize_t offset);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
Struct_unpack_from(PyStructObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
static const char * const _keywords[] = {"buffer", "offset", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"y*|n:unpack_from", _keywords, 0};
|
||||||
|
Py_buffer buffer = {NULL, NULL};
|
||||||
|
Py_ssize_t offset = 0;
|
||||||
|
|
||||||
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
|
&buffer, &offset)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = Struct_unpack_from_impl(self, &buffer, offset);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
/* Cleanup for buffer */
|
||||||
|
if (buffer.obj) {
|
||||||
|
PyBuffer_Release(&buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(Struct_iter_unpack__doc__,
|
||||||
|
"iter_unpack($self, buffer, /)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Return an iterator yielding tuples.\n"
|
||||||
|
"\n"
|
||||||
|
"Tuples are unpacked from the given bytes source, like a repeated\n"
|
||||||
|
"invocation of unpack_from().\n"
|
||||||
|
"\n"
|
||||||
|
"Requires that the bytes length be a multiple of the struct size.");
|
||||||
|
|
||||||
|
#define STRUCT_ITER_UNPACK_METHODDEF \
|
||||||
|
{"iter_unpack", (PyCFunction)Struct_iter_unpack, METH_O, Struct_iter_unpack__doc__},
|
||||||
|
|
||||||
|
PyDoc_STRVAR(_clearcache__doc__,
|
||||||
|
"_clearcache($module, /)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Clear the internal cache.");
|
||||||
|
|
||||||
|
#define _CLEARCACHE_METHODDEF \
|
||||||
|
{"_clearcache", (PyCFunction)_clearcache, METH_NOARGS, _clearcache__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_clearcache_impl(PyObject *module);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
_clearcache(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
|
{
|
||||||
|
return _clearcache_impl(module);
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(calcsize__doc__,
|
||||||
|
"calcsize($module, format, /)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Return size in bytes of the struct described by the format string.");
|
||||||
|
|
||||||
|
#define CALCSIZE_METHODDEF \
|
||||||
|
{"calcsize", (PyCFunction)calcsize, METH_O, calcsize__doc__},
|
||||||
|
|
||||||
|
PyDoc_STRVAR(unpack__doc__,
|
||||||
|
"unpack($module, format, inputstr, /)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Return a tuple containing values unpacked according to the format string.\n"
|
||||||
|
"\n"
|
||||||
|
"The buffer\'s size in bytes must be calcsize(format).\n"
|
||||||
|
"\n"
|
||||||
|
"See help(struct) for more on format strings.");
|
||||||
|
|
||||||
|
#define UNPACK_METHODDEF \
|
||||||
|
{"unpack", (PyCFunction)unpack, METH_FASTCALL, unpack__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *format;
|
||||||
|
PyObject *inputstr;
|
||||||
|
|
||||||
|
if (!_PyArg_UnpackStack(args, nargs, "unpack",
|
||||||
|
2, 2,
|
||||||
|
&format, &inputstr)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("unpack", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = unpack_impl(module, format, inputstr);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(unpack_from__doc__,
|
||||||
|
"unpack_from($module, format, /, buffer, offset=0)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Return a tuple containing values unpacked according to the format string.\n"
|
||||||
|
"\n"
|
||||||
|
"The buffer\'s size, minus offset, must be at least calcsize(format).\n"
|
||||||
|
"\n"
|
||||||
|
"See help(struct) for more on format strings.");
|
||||||
|
|
||||||
|
#define UNPACK_FROM_METHODDEF \
|
||||||
|
{"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL, unpack_from__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer,
|
||||||
|
Py_ssize_t offset);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
unpack_from(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
static const char * const _keywords[] = {"", "buffer", "offset", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"Oy*|n:unpack_from", _keywords, 0};
|
||||||
|
PyObject *format;
|
||||||
|
Py_buffer buffer = {NULL, NULL};
|
||||||
|
Py_ssize_t offset = 0;
|
||||||
|
|
||||||
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
|
&format, &buffer, &offset)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = unpack_from_impl(module, format, &buffer, offset);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
/* Cleanup for buffer */
|
||||||
|
if (buffer.obj) {
|
||||||
|
PyBuffer_Release(&buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(iter_unpack__doc__,
|
||||||
|
"iter_unpack($module, format, buffer, /)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Return an iterator yielding tuples unpacked from the given bytes.\n"
|
||||||
|
"\n"
|
||||||
|
"The bytes are unpacked according to the format string, like\n"
|
||||||
|
"a repeated invocation of unpack_from().\n"
|
||||||
|
"\n"
|
||||||
|
"Requires that the bytes length be a multiple of the format struct size.");
|
||||||
|
|
||||||
|
#define ITER_UNPACK_METHODDEF \
|
||||||
|
{"iter_unpack", (PyCFunction)iter_unpack, METH_FASTCALL, iter_unpack__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *format;
|
||||||
|
PyObject *buffer;
|
||||||
|
|
||||||
|
if (!_PyArg_UnpackStack(args, nargs, "iter_unpack",
|
||||||
|
2, 2,
|
||||||
|
&format, &buffer)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("iter_unpack", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = iter_unpack_impl(module, format, buffer);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
/*[clinic end generated code: output=db8152ad222fa3d0 input=a9049054013a1b77]*/
|
12
third_party/python/Modules/clinic/_weakref.inc
vendored
12
third_party/python/Modules/clinic/_weakref.inc
vendored
|
@ -38,26 +38,30 @@ PyDoc_STRVAR(_weakref__remove_dead_weakref__doc__,
|
||||||
"Atomically remove key from dict if it points to a dead weakref.");
|
"Atomically remove key from dict if it points to a dead weakref.");
|
||||||
|
|
||||||
#define _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF \
|
#define _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF \
|
||||||
{"_remove_dead_weakref", (PyCFunction)_weakref__remove_dead_weakref, METH_VARARGS, _weakref__remove_dead_weakref__doc__},
|
{"_remove_dead_weakref", (PyCFunction)_weakref__remove_dead_weakref, METH_FASTCALL, _weakref__remove_dead_weakref__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct,
|
_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct,
|
||||||
PyObject *key);
|
PyObject *key);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_weakref__remove_dead_weakref(PyObject *module, PyObject *args)
|
_weakref__remove_dead_weakref(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *dct;
|
PyObject *dct;
|
||||||
PyObject *key;
|
PyObject *key;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O!O:_remove_dead_weakref",
|
if (!_PyArg_ParseStack(args, nargs, "O!O:_remove_dead_weakref",
|
||||||
&PyDict_Type, &dct, &key)) {
|
&PyDict_Type, &dct, &key)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("_remove_dead_weakref", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = _weakref__remove_dead_weakref_impl(module, dct, key);
|
return_value = _weakref__remove_dead_weakref_impl(module, dct, key);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=e860dd818a44bc9b input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=b686303486bdfefd input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -111,7 +111,7 @@ _winapi_ConnectNamedPipe(PyObject *module, PyObject **args, Py_ssize_t nargs, Py
|
||||||
int64_t handle;
|
int64_t handle;
|
||||||
int use_overlapped = 0;
|
int use_overlapped = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&handle, &use_overlapped)) {
|
&handle, &use_overlapped)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ _winapi_ReadFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
int use_overlapped = 0;
|
int use_overlapped = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&handle, &size, &use_overlapped)) {
|
&handle, &size, &use_overlapped)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -879,7 +879,7 @@ _winapi_WriteFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject
|
||||||
PyObject *buffer;
|
PyObject *buffer;
|
||||||
int use_overlapped = 0;
|
int use_overlapped = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&handle, &buffer, &use_overlapped)) {
|
&handle, &buffer, &use_overlapped)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,21 +66,25 @@ PyDoc_STRVAR(array_array_pop__doc__,
|
||||||
"i defaults to -1.");
|
"i defaults to -1.");
|
||||||
|
|
||||||
#define ARRAY_ARRAY_POP_METHODDEF \
|
#define ARRAY_ARRAY_POP_METHODDEF \
|
||||||
{"pop", (PyCFunction)array_array_pop, METH_VARARGS, array_array_pop__doc__},
|
{"pop", (PyCFunction)array_array_pop, METH_FASTCALL, array_array_pop__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array_array_pop_impl(arrayobject *self, Py_ssize_t i);
|
array_array_pop_impl(arrayobject *self, Py_ssize_t i);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array_array_pop(arrayobject *self, PyObject *args)
|
array_array_pop(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t i = -1;
|
Py_ssize_t i = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|n:pop",
|
if (!_PyArg_ParseStack(args, nargs, "|n:pop",
|
||||||
&i)) {
|
&i)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("pop", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = array_array_pop_impl(self, i);
|
return_value = array_array_pop_impl(self, i);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -103,22 +107,26 @@ PyDoc_STRVAR(array_array_insert__doc__,
|
||||||
"Insert a new item v into the array before position i.");
|
"Insert a new item v into the array before position i.");
|
||||||
|
|
||||||
#define ARRAY_ARRAY_INSERT_METHODDEF \
|
#define ARRAY_ARRAY_INSERT_METHODDEF \
|
||||||
{"insert", (PyCFunction)array_array_insert, METH_VARARGS, array_array_insert__doc__},
|
{"insert", (PyCFunction)array_array_insert, METH_FASTCALL, array_array_insert__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array_array_insert_impl(arrayobject *self, Py_ssize_t i, PyObject *v);
|
array_array_insert_impl(arrayobject *self, Py_ssize_t i, PyObject *v);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array_array_insert(arrayobject *self, PyObject *args)
|
array_array_insert(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "nO:insert",
|
if (!_PyArg_ParseStack(args, nargs, "nO:insert",
|
||||||
&i, &v)) {
|
&i, &v)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = array_array_insert_impl(self, i, v);
|
return_value = array_array_insert_impl(self, i, v);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -201,22 +209,26 @@ PyDoc_STRVAR(array_array_fromfile__doc__,
|
||||||
"Read n objects from the file object f and append them to the end of the array.");
|
"Read n objects from the file object f and append them to the end of the array.");
|
||||||
|
|
||||||
#define ARRAY_ARRAY_FROMFILE_METHODDEF \
|
#define ARRAY_ARRAY_FROMFILE_METHODDEF \
|
||||||
{"fromfile", (PyCFunction)array_array_fromfile, METH_VARARGS, array_array_fromfile__doc__},
|
{"fromfile", (PyCFunction)array_array_fromfile, METH_FASTCALL, array_array_fromfile__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array_array_fromfile_impl(arrayobject *self, PyObject *f, Py_ssize_t n);
|
array_array_fromfile_impl(arrayobject *self, PyObject *f, Py_ssize_t n);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array_array_fromfile(arrayobject *self, PyObject *args)
|
array_array_fromfile(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *f;
|
PyObject *f;
|
||||||
Py_ssize_t n;
|
Py_ssize_t n;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "On:fromfile",
|
if (!_PyArg_ParseStack(args, nargs, "On:fromfile",
|
||||||
&f, &n)) {
|
&f, &n)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("fromfile", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = array_array_fromfile_impl(self, f, n);
|
return_value = array_array_fromfile_impl(self, f, n);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -444,7 +456,7 @@ PyDoc_STRVAR(array__array_reconstructor__doc__,
|
||||||
"Internal. Used for pickling support.");
|
"Internal. Used for pickling support.");
|
||||||
|
|
||||||
#define ARRAY__ARRAY_RECONSTRUCTOR_METHODDEF \
|
#define ARRAY__ARRAY_RECONSTRUCTOR_METHODDEF \
|
||||||
{"_array_reconstructor", (PyCFunction)array__array_reconstructor, METH_VARARGS, array__array_reconstructor__doc__},
|
{"_array_reconstructor", (PyCFunction)array__array_reconstructor, METH_FASTCALL, array__array_reconstructor__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
|
array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
|
||||||
|
@ -453,7 +465,7 @@ array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
|
||||||
PyObject *items);
|
PyObject *items);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array__array_reconstructor(PyObject *module, PyObject *args)
|
array__array_reconstructor(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyTypeObject *arraytype;
|
PyTypeObject *arraytype;
|
||||||
|
@ -461,10 +473,14 @@ array__array_reconstructor(PyObject *module, PyObject *args)
|
||||||
enum machine_format_code mformat_code;
|
enum machine_format_code mformat_code;
|
||||||
PyObject *items;
|
PyObject *items;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "OCiO:_array_reconstructor",
|
if (!_PyArg_ParseStack(args, nargs, "OCiO:_array_reconstructor",
|
||||||
&arraytype, &typecode, &mformat_code, &items)) {
|
&arraytype, &typecode, &mformat_code, &items)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("_array_reconstructor", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items);
|
return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -506,4 +522,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
|
||||||
|
|
||||||
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
|
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
|
||||||
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
|
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
|
||||||
/*[clinic end generated code: output=b2054fb764c8cc64 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=d186a7553c1f1a41 input=a9049054013a1b77]*/
|
||||||
|
|
267
third_party/python/Modules/clinic/audioop.inc
vendored
267
third_party/python/Modules/clinic/audioop.inc
vendored
|
@ -2,7 +2,6 @@
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
#include "third_party/python/Include/abstract.h"
|
|
||||||
|
|
||||||
PyDoc_STRVAR(audioop_getsample__doc__,
|
PyDoc_STRVAR(audioop_getsample__doc__,
|
||||||
"getsample($module, fragment, width, index, /)\n"
|
"getsample($module, fragment, width, index, /)\n"
|
||||||
|
@ -11,24 +10,28 @@ PyDoc_STRVAR(audioop_getsample__doc__,
|
||||||
"Return the value of sample index from the fragment.");
|
"Return the value of sample index from the fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_GETSAMPLE_METHODDEF \
|
#define AUDIOOP_GETSAMPLE_METHODDEF \
|
||||||
{"getsample", (PyCFunction)audioop_getsample, METH_VARARGS, audioop_getsample__doc__},
|
{"getsample", (PyCFunction)audioop_getsample, METH_FASTCALL, audioop_getsample__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_getsample_impl(PyObject *module, Py_buffer *fragment, int width,
|
audioop_getsample_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
Py_ssize_t index);
|
Py_ssize_t index);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_getsample(PyObject *module, PyObject *args)
|
audioop_getsample(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
Py_ssize_t index;
|
Py_ssize_t index;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*in:getsample",
|
if (!_PyArg_ParseStack(args, nargs, "y*in:getsample",
|
||||||
&fragment, &width, &index)) {
|
&fragment, &width, &index)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("getsample", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_getsample_impl(module, &fragment, width, index);
|
return_value = audioop_getsample_impl(module, &fragment, width, index);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -47,22 +50,26 @@ PyDoc_STRVAR(audioop_max__doc__,
|
||||||
"Return the maximum of the absolute value of all samples in a fragment.");
|
"Return the maximum of the absolute value of all samples in a fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_MAX_METHODDEF \
|
#define AUDIOOP_MAX_METHODDEF \
|
||||||
{"max", (PyCFunction)audioop_max, METH_VARARGS, audioop_max__doc__},
|
{"max", (PyCFunction)audioop_max, METH_FASTCALL, audioop_max__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_max_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_max_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_max(PyObject *module, PyObject *args)
|
audioop_max(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:max",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:max",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("max", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_max_impl(module, &fragment, width);
|
return_value = audioop_max_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -81,22 +88,26 @@ PyDoc_STRVAR(audioop_minmax__doc__,
|
||||||
"Return the minimum and maximum values of all samples in the sound fragment.");
|
"Return the minimum and maximum values of all samples in the sound fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_MINMAX_METHODDEF \
|
#define AUDIOOP_MINMAX_METHODDEF \
|
||||||
{"minmax", (PyCFunction)audioop_minmax, METH_VARARGS, audioop_minmax__doc__},
|
{"minmax", (PyCFunction)audioop_minmax, METH_FASTCALL, audioop_minmax__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_minmax_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_minmax_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_minmax(PyObject *module, PyObject *args)
|
audioop_minmax(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:minmax",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:minmax",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("minmax", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_minmax_impl(module, &fragment, width);
|
return_value = audioop_minmax_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -115,22 +126,26 @@ PyDoc_STRVAR(audioop_avg__doc__,
|
||||||
"Return the average over all samples in the fragment.");
|
"Return the average over all samples in the fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_AVG_METHODDEF \
|
#define AUDIOOP_AVG_METHODDEF \
|
||||||
{"avg", (PyCFunction)audioop_avg, METH_VARARGS, audioop_avg__doc__},
|
{"avg", (PyCFunction)audioop_avg, METH_FASTCALL, audioop_avg__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_avg_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_avg_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_avg(PyObject *module, PyObject *args)
|
audioop_avg(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:avg",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:avg",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("avg", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_avg_impl(module, &fragment, width);
|
return_value = audioop_avg_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -149,22 +164,26 @@ PyDoc_STRVAR(audioop_rms__doc__,
|
||||||
"Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n).");
|
"Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n).");
|
||||||
|
|
||||||
#define AUDIOOP_RMS_METHODDEF \
|
#define AUDIOOP_RMS_METHODDEF \
|
||||||
{"rms", (PyCFunction)audioop_rms, METH_VARARGS, audioop_rms__doc__},
|
{"rms", (PyCFunction)audioop_rms, METH_FASTCALL, audioop_rms__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_rms_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_rms_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_rms(PyObject *module, PyObject *args)
|
audioop_rms(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:rms",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:rms",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("rms", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_rms_impl(module, &fragment, width);
|
return_value = audioop_rms_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -183,23 +202,27 @@ PyDoc_STRVAR(audioop_findfit__doc__,
|
||||||
"Try to match reference as well as possible to a portion of fragment.");
|
"Try to match reference as well as possible to a portion of fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_FINDFIT_METHODDEF \
|
#define AUDIOOP_FINDFIT_METHODDEF \
|
||||||
{"findfit", (PyCFunction)audioop_findfit, METH_VARARGS, audioop_findfit__doc__},
|
{"findfit", (PyCFunction)audioop_findfit, METH_FASTCALL, audioop_findfit__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_findfit_impl(PyObject *module, Py_buffer *fragment,
|
audioop_findfit_impl(PyObject *module, Py_buffer *fragment,
|
||||||
Py_buffer *reference);
|
Py_buffer *reference);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_findfit(PyObject *module, PyObject *args)
|
audioop_findfit(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
Py_buffer reference = {NULL, NULL};
|
Py_buffer reference = {NULL, NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*y*:findfit",
|
if (!_PyArg_ParseStack(args, nargs, "y*y*:findfit",
|
||||||
&fragment, &reference)) {
|
&fragment, &reference)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("findfit", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_findfit_impl(module, &fragment, &reference);
|
return_value = audioop_findfit_impl(module, &fragment, &reference);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -222,23 +245,27 @@ PyDoc_STRVAR(audioop_findfactor__doc__,
|
||||||
"Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal.");
|
"Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal.");
|
||||||
|
|
||||||
#define AUDIOOP_FINDFACTOR_METHODDEF \
|
#define AUDIOOP_FINDFACTOR_METHODDEF \
|
||||||
{"findfactor", (PyCFunction)audioop_findfactor, METH_VARARGS, audioop_findfactor__doc__},
|
{"findfactor", (PyCFunction)audioop_findfactor, METH_FASTCALL, audioop_findfactor__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_findfactor_impl(PyObject *module, Py_buffer *fragment,
|
audioop_findfactor_impl(PyObject *module, Py_buffer *fragment,
|
||||||
Py_buffer *reference);
|
Py_buffer *reference);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_findfactor(PyObject *module, PyObject *args)
|
audioop_findfactor(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
Py_buffer reference = {NULL, NULL};
|
Py_buffer reference = {NULL, NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*y*:findfactor",
|
if (!_PyArg_ParseStack(args, nargs, "y*y*:findfactor",
|
||||||
&fragment, &reference)) {
|
&fragment, &reference)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("findfactor", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_findfactor_impl(module, &fragment, &reference);
|
return_value = audioop_findfactor_impl(module, &fragment, &reference);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -261,23 +288,27 @@ PyDoc_STRVAR(audioop_findmax__doc__,
|
||||||
"Search fragment for a slice of specified number of samples with maximum energy.");
|
"Search fragment for a slice of specified number of samples with maximum energy.");
|
||||||
|
|
||||||
#define AUDIOOP_FINDMAX_METHODDEF \
|
#define AUDIOOP_FINDMAX_METHODDEF \
|
||||||
{"findmax", (PyCFunction)audioop_findmax, METH_VARARGS, audioop_findmax__doc__},
|
{"findmax", (PyCFunction)audioop_findmax, METH_FASTCALL, audioop_findmax__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_findmax_impl(PyObject *module, Py_buffer *fragment,
|
audioop_findmax_impl(PyObject *module, Py_buffer *fragment,
|
||||||
Py_ssize_t length);
|
Py_ssize_t length);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_findmax(PyObject *module, PyObject *args)
|
audioop_findmax(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
Py_ssize_t length;
|
Py_ssize_t length;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*n:findmax",
|
if (!_PyArg_ParseStack(args, nargs, "y*n:findmax",
|
||||||
&fragment, &length)) {
|
&fragment, &length)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("findmax", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_findmax_impl(module, &fragment, length);
|
return_value = audioop_findmax_impl(module, &fragment, length);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -296,22 +327,26 @@ PyDoc_STRVAR(audioop_avgpp__doc__,
|
||||||
"Return the average peak-peak value over all samples in the fragment.");
|
"Return the average peak-peak value over all samples in the fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_AVGPP_METHODDEF \
|
#define AUDIOOP_AVGPP_METHODDEF \
|
||||||
{"avgpp", (PyCFunction)audioop_avgpp, METH_VARARGS, audioop_avgpp__doc__},
|
{"avgpp", (PyCFunction)audioop_avgpp, METH_FASTCALL, audioop_avgpp__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_avgpp_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_avgpp_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_avgpp(PyObject *module, PyObject *args)
|
audioop_avgpp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:avgpp",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:avgpp",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("avgpp", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_avgpp_impl(module, &fragment, width);
|
return_value = audioop_avgpp_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -330,22 +365,26 @@ PyDoc_STRVAR(audioop_maxpp__doc__,
|
||||||
"Return the maximum peak-peak value in the sound fragment.");
|
"Return the maximum peak-peak value in the sound fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_MAXPP_METHODDEF \
|
#define AUDIOOP_MAXPP_METHODDEF \
|
||||||
{"maxpp", (PyCFunction)audioop_maxpp, METH_VARARGS, audioop_maxpp__doc__},
|
{"maxpp", (PyCFunction)audioop_maxpp, METH_FASTCALL, audioop_maxpp__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_maxpp_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_maxpp_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_maxpp(PyObject *module, PyObject *args)
|
audioop_maxpp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:maxpp",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:maxpp",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("maxpp", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_maxpp_impl(module, &fragment, width);
|
return_value = audioop_maxpp_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -364,22 +403,26 @@ PyDoc_STRVAR(audioop_cross__doc__,
|
||||||
"Return the number of zero crossings in the fragment passed as an argument.");
|
"Return the number of zero crossings in the fragment passed as an argument.");
|
||||||
|
|
||||||
#define AUDIOOP_CROSS_METHODDEF \
|
#define AUDIOOP_CROSS_METHODDEF \
|
||||||
{"cross", (PyCFunction)audioop_cross, METH_VARARGS, audioop_cross__doc__},
|
{"cross", (PyCFunction)audioop_cross, METH_FASTCALL, audioop_cross__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_cross_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_cross_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_cross(PyObject *module, PyObject *args)
|
audioop_cross(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:cross",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:cross",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("cross", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_cross_impl(module, &fragment, width);
|
return_value = audioop_cross_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -398,24 +441,28 @@ PyDoc_STRVAR(audioop_mul__doc__,
|
||||||
"Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor.");
|
"Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor.");
|
||||||
|
|
||||||
#define AUDIOOP_MUL_METHODDEF \
|
#define AUDIOOP_MUL_METHODDEF \
|
||||||
{"mul", (PyCFunction)audioop_mul, METH_VARARGS, audioop_mul__doc__},
|
{"mul", (PyCFunction)audioop_mul, METH_FASTCALL, audioop_mul__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_mul_impl(PyObject *module, Py_buffer *fragment, int width,
|
audioop_mul_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
double factor);
|
double factor);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_mul(PyObject *module, PyObject *args)
|
audioop_mul(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
double factor;
|
double factor;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*id:mul",
|
if (!_PyArg_ParseStack(args, nargs, "y*id:mul",
|
||||||
&fragment, &width, &factor)) {
|
&fragment, &width, &factor)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("mul", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_mul_impl(module, &fragment, width, factor);
|
return_value = audioop_mul_impl(module, &fragment, width, factor);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -434,14 +481,14 @@ PyDoc_STRVAR(audioop_tomono__doc__,
|
||||||
"Convert a stereo fragment to a mono fragment.");
|
"Convert a stereo fragment to a mono fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_TOMONO_METHODDEF \
|
#define AUDIOOP_TOMONO_METHODDEF \
|
||||||
{"tomono", (PyCFunction)audioop_tomono, METH_VARARGS, audioop_tomono__doc__},
|
{"tomono", (PyCFunction)audioop_tomono, METH_FASTCALL, audioop_tomono__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_tomono_impl(PyObject *module, Py_buffer *fragment, int width,
|
audioop_tomono_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
double lfactor, double rfactor);
|
double lfactor, double rfactor);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_tomono(PyObject *module, PyObject *args)
|
audioop_tomono(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
|
@ -449,10 +496,14 @@ audioop_tomono(PyObject *module, PyObject *args)
|
||||||
double lfactor;
|
double lfactor;
|
||||||
double rfactor;
|
double rfactor;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*idd:tomono",
|
if (!_PyArg_ParseStack(args, nargs, "y*idd:tomono",
|
||||||
&fragment, &width, &lfactor, &rfactor)) {
|
&fragment, &width, &lfactor, &rfactor)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("tomono", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor);
|
return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -471,14 +522,14 @@ PyDoc_STRVAR(audioop_tostereo__doc__,
|
||||||
"Generate a stereo fragment from a mono fragment.");
|
"Generate a stereo fragment from a mono fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_TOSTEREO_METHODDEF \
|
#define AUDIOOP_TOSTEREO_METHODDEF \
|
||||||
{"tostereo", (PyCFunction)audioop_tostereo, METH_VARARGS, audioop_tostereo__doc__},
|
{"tostereo", (PyCFunction)audioop_tostereo, METH_FASTCALL, audioop_tostereo__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_tostereo_impl(PyObject *module, Py_buffer *fragment, int width,
|
audioop_tostereo_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
double lfactor, double rfactor);
|
double lfactor, double rfactor);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_tostereo(PyObject *module, PyObject *args)
|
audioop_tostereo(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
|
@ -486,10 +537,14 @@ audioop_tostereo(PyObject *module, PyObject *args)
|
||||||
double lfactor;
|
double lfactor;
|
||||||
double rfactor;
|
double rfactor;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*idd:tostereo",
|
if (!_PyArg_ParseStack(args, nargs, "y*idd:tostereo",
|
||||||
&fragment, &width, &lfactor, &rfactor)) {
|
&fragment, &width, &lfactor, &rfactor)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("tostereo", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor);
|
return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -508,24 +563,28 @@ PyDoc_STRVAR(audioop_add__doc__,
|
||||||
"Return a fragment which is the addition of the two samples passed as parameters.");
|
"Return a fragment which is the addition of the two samples passed as parameters.");
|
||||||
|
|
||||||
#define AUDIOOP_ADD_METHODDEF \
|
#define AUDIOOP_ADD_METHODDEF \
|
||||||
{"add", (PyCFunction)audioop_add, METH_VARARGS, audioop_add__doc__},
|
{"add", (PyCFunction)audioop_add, METH_FASTCALL, audioop_add__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_add_impl(PyObject *module, Py_buffer *fragment1,
|
audioop_add_impl(PyObject *module, Py_buffer *fragment1,
|
||||||
Py_buffer *fragment2, int width);
|
Py_buffer *fragment2, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_add(PyObject *module, PyObject *args)
|
audioop_add(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment1 = {NULL, NULL};
|
Py_buffer fragment1 = {NULL, NULL};
|
||||||
Py_buffer fragment2 = {NULL, NULL};
|
Py_buffer fragment2 = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*y*i:add",
|
if (!_PyArg_ParseStack(args, nargs, "y*y*i:add",
|
||||||
&fragment1, &fragment2, &width)) {
|
&fragment1, &fragment2, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("add", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_add_impl(module, &fragment1, &fragment2, width);
|
return_value = audioop_add_impl(module, &fragment1, &fragment2, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -548,23 +607,27 @@ PyDoc_STRVAR(audioop_bias__doc__,
|
||||||
"Return a fragment that is the original fragment with a bias added to each sample.");
|
"Return a fragment that is the original fragment with a bias added to each sample.");
|
||||||
|
|
||||||
#define AUDIOOP_BIAS_METHODDEF \
|
#define AUDIOOP_BIAS_METHODDEF \
|
||||||
{"bias", (PyCFunction)audioop_bias, METH_VARARGS, audioop_bias__doc__},
|
{"bias", (PyCFunction)audioop_bias, METH_FASTCALL, audioop_bias__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_bias_impl(PyObject *module, Py_buffer *fragment, int width, int bias);
|
audioop_bias_impl(PyObject *module, Py_buffer *fragment, int width, int bias);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_bias(PyObject *module, PyObject *args)
|
audioop_bias(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
int bias;
|
int bias;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*ii:bias",
|
if (!_PyArg_ParseStack(args, nargs, "y*ii:bias",
|
||||||
&fragment, &width, &bias)) {
|
&fragment, &width, &bias)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("bias", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_bias_impl(module, &fragment, width, bias);
|
return_value = audioop_bias_impl(module, &fragment, width, bias);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -583,22 +646,26 @@ PyDoc_STRVAR(audioop_reverse__doc__,
|
||||||
"Reverse the samples in a fragment and returns the modified fragment.");
|
"Reverse the samples in a fragment and returns the modified fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_REVERSE_METHODDEF \
|
#define AUDIOOP_REVERSE_METHODDEF \
|
||||||
{"reverse", (PyCFunction)audioop_reverse, METH_VARARGS, audioop_reverse__doc__},
|
{"reverse", (PyCFunction)audioop_reverse, METH_FASTCALL, audioop_reverse__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_reverse_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_reverse_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_reverse(PyObject *module, PyObject *args)
|
audioop_reverse(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:reverse",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:reverse",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("reverse", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_reverse_impl(module, &fragment, width);
|
return_value = audioop_reverse_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -617,22 +684,26 @@ PyDoc_STRVAR(audioop_byteswap__doc__,
|
||||||
"Convert big-endian samples to little-endian and vice versa.");
|
"Convert big-endian samples to little-endian and vice versa.");
|
||||||
|
|
||||||
#define AUDIOOP_BYTESWAP_METHODDEF \
|
#define AUDIOOP_BYTESWAP_METHODDEF \
|
||||||
{"byteswap", (PyCFunction)audioop_byteswap, METH_VARARGS, audioop_byteswap__doc__},
|
{"byteswap", (PyCFunction)audioop_byteswap, METH_FASTCALL, audioop_byteswap__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_byteswap_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_byteswap_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_byteswap(PyObject *module, PyObject *args)
|
audioop_byteswap(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:byteswap",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:byteswap",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("byteswap", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_byteswap_impl(module, &fragment, width);
|
return_value = audioop_byteswap_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -651,24 +722,28 @@ PyDoc_STRVAR(audioop_lin2lin__doc__,
|
||||||
"Convert samples between 1-, 2-, 3- and 4-byte formats.");
|
"Convert samples between 1-, 2-, 3- and 4-byte formats.");
|
||||||
|
|
||||||
#define AUDIOOP_LIN2LIN_METHODDEF \
|
#define AUDIOOP_LIN2LIN_METHODDEF \
|
||||||
{"lin2lin", (PyCFunction)audioop_lin2lin, METH_VARARGS, audioop_lin2lin__doc__},
|
{"lin2lin", (PyCFunction)audioop_lin2lin, METH_FASTCALL, audioop_lin2lin__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_lin2lin_impl(PyObject *module, Py_buffer *fragment, int width,
|
audioop_lin2lin_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
int newwidth);
|
int newwidth);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_lin2lin(PyObject *module, PyObject *args)
|
audioop_lin2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
int newwidth;
|
int newwidth;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*ii:lin2lin",
|
if (!_PyArg_ParseStack(args, nargs, "y*ii:lin2lin",
|
||||||
&fragment, &width, &newwidth)) {
|
&fragment, &width, &newwidth)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("lin2lin", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth);
|
return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -688,7 +763,7 @@ PyDoc_STRVAR(audioop_ratecv__doc__,
|
||||||
"Convert the frame rate of the input fragment.");
|
"Convert the frame rate of the input fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_RATECV_METHODDEF \
|
#define AUDIOOP_RATECV_METHODDEF \
|
||||||
{"ratecv", (PyCFunction)audioop_ratecv, METH_VARARGS, audioop_ratecv__doc__},
|
{"ratecv", (PyCFunction)audioop_ratecv, METH_FASTCALL, audioop_ratecv__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width,
|
audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
|
@ -696,7 +771,7 @@ audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
int weightA, int weightB);
|
int weightA, int weightB);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_ratecv(PyObject *module, PyObject *args)
|
audioop_ratecv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
|
@ -708,10 +783,14 @@ audioop_ratecv(PyObject *module, PyObject *args)
|
||||||
int weightA = 1;
|
int weightA = 1;
|
||||||
int weightB = 0;
|
int weightB = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*iiiiO|ii:ratecv",
|
if (!_PyArg_ParseStack(args, nargs, "y*iiiiO|ii:ratecv",
|
||||||
&fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) {
|
&fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("ratecv", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB);
|
return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -730,22 +809,26 @@ PyDoc_STRVAR(audioop_lin2ulaw__doc__,
|
||||||
"Convert samples in the audio fragment to u-LAW encoding.");
|
"Convert samples in the audio fragment to u-LAW encoding.");
|
||||||
|
|
||||||
#define AUDIOOP_LIN2ULAW_METHODDEF \
|
#define AUDIOOP_LIN2ULAW_METHODDEF \
|
||||||
{"lin2ulaw", (PyCFunction)audioop_lin2ulaw, METH_VARARGS, audioop_lin2ulaw__doc__},
|
{"lin2ulaw", (PyCFunction)audioop_lin2ulaw, METH_FASTCALL, audioop_lin2ulaw__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_lin2ulaw_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_lin2ulaw_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_lin2ulaw(PyObject *module, PyObject *args)
|
audioop_lin2ulaw(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:lin2ulaw",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:lin2ulaw",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("lin2ulaw", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_lin2ulaw_impl(module, &fragment, width);
|
return_value = audioop_lin2ulaw_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -764,22 +847,26 @@ PyDoc_STRVAR(audioop_ulaw2lin__doc__,
|
||||||
"Convert sound fragments in u-LAW encoding to linearly encoded sound fragments.");
|
"Convert sound fragments in u-LAW encoding to linearly encoded sound fragments.");
|
||||||
|
|
||||||
#define AUDIOOP_ULAW2LIN_METHODDEF \
|
#define AUDIOOP_ULAW2LIN_METHODDEF \
|
||||||
{"ulaw2lin", (PyCFunction)audioop_ulaw2lin, METH_VARARGS, audioop_ulaw2lin__doc__},
|
{"ulaw2lin", (PyCFunction)audioop_ulaw2lin, METH_FASTCALL, audioop_ulaw2lin__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_ulaw2lin_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_ulaw2lin_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_ulaw2lin(PyObject *module, PyObject *args)
|
audioop_ulaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:ulaw2lin",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:ulaw2lin",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("ulaw2lin", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_ulaw2lin_impl(module, &fragment, width);
|
return_value = audioop_ulaw2lin_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -798,22 +885,26 @@ PyDoc_STRVAR(audioop_lin2alaw__doc__,
|
||||||
"Convert samples in the audio fragment to a-LAW encoding.");
|
"Convert samples in the audio fragment to a-LAW encoding.");
|
||||||
|
|
||||||
#define AUDIOOP_LIN2ALAW_METHODDEF \
|
#define AUDIOOP_LIN2ALAW_METHODDEF \
|
||||||
{"lin2alaw", (PyCFunction)audioop_lin2alaw, METH_VARARGS, audioop_lin2alaw__doc__},
|
{"lin2alaw", (PyCFunction)audioop_lin2alaw, METH_FASTCALL, audioop_lin2alaw__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_lin2alaw_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_lin2alaw_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_lin2alaw(PyObject *module, PyObject *args)
|
audioop_lin2alaw(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*i:lin2alaw",
|
if (!_PyArg_ParseStack(args, nargs, "y*i:lin2alaw",
|
||||||
&fragment, &width)) {
|
&fragment, &width)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("lin2alaw", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_lin2alaw_impl(module, &fragment, width);
|
return_value = audioop_lin2alaw_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -832,26 +923,34 @@ PyDoc_STRVAR(audioop_alaw2lin__doc__,
|
||||||
"Convert sound fragments in a-LAW encoding to linearly encoded sound fragments.");
|
"Convert sound fragments in a-LAW encoding to linearly encoded sound fragments.");
|
||||||
|
|
||||||
#define AUDIOOP_ALAW2LIN_METHODDEF \
|
#define AUDIOOP_ALAW2LIN_METHODDEF \
|
||||||
{"alaw2lin", (PyCFunction)audioop_alaw2lin, METH_VARARGS, audioop_alaw2lin__doc__},
|
{"alaw2lin", (PyCFunction)audioop_alaw2lin, METH_FASTCALL, audioop_alaw2lin__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_alaw2lin_impl(PyObject *module, Py_buffer *fragment, int width);
|
audioop_alaw2lin_impl(PyObject *module, Py_buffer *fragment, int width);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_alaw2lin(PyObject *module, PyObject *args)
|
audioop_alaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
if (!PyArg_ParseTuple(args, "y*i:alaw2lin", &fragment, &width)) {
|
|
||||||
|
if (!_PyArg_ParseStack(args, nargs, "y*i:alaw2lin",
|
||||||
|
&fragment, &width)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("alaw2lin", kwnames)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = audioop_alaw2lin_impl(module, &fragment, width);
|
return_value = audioop_alaw2lin_impl(module, &fragment, width);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Cleanup for fragment */
|
/* Cleanup for fragment */
|
||||||
if (fragment.obj) {
|
if (fragment.obj) {
|
||||||
PyBuffer_Release(&fragment);
|
PyBuffer_Release(&fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,24 +961,28 @@ PyDoc_STRVAR(audioop_lin2adpcm__doc__,
|
||||||
"Convert samples to 4 bit Intel/DVI ADPCM encoding.");
|
"Convert samples to 4 bit Intel/DVI ADPCM encoding.");
|
||||||
|
|
||||||
#define AUDIOOP_LIN2ADPCM_METHODDEF \
|
#define AUDIOOP_LIN2ADPCM_METHODDEF \
|
||||||
{"lin2adpcm", (PyCFunction)audioop_lin2adpcm, METH_VARARGS, audioop_lin2adpcm__doc__},
|
{"lin2adpcm", (PyCFunction)audioop_lin2adpcm, METH_FASTCALL, audioop_lin2adpcm__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_lin2adpcm_impl(PyObject *module, Py_buffer *fragment, int width,
|
audioop_lin2adpcm_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
PyObject *state);
|
PyObject *state);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_lin2adpcm(PyObject *module, PyObject *args)
|
audioop_lin2adpcm(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
PyObject *state;
|
PyObject *state;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*iO:lin2adpcm",
|
if (!_PyArg_ParseStack(args, nargs, "y*iO:lin2adpcm",
|
||||||
&fragment, &width, &state)) {
|
&fragment, &width, &state)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("lin2adpcm", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_lin2adpcm_impl(module, &fragment, width, state);
|
return_value = audioop_lin2adpcm_impl(module, &fragment, width, state);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -898,24 +1001,28 @@ PyDoc_STRVAR(audioop_adpcm2lin__doc__,
|
||||||
"Decode an Intel/DVI ADPCM coded fragment to a linear fragment.");
|
"Decode an Intel/DVI ADPCM coded fragment to a linear fragment.");
|
||||||
|
|
||||||
#define AUDIOOP_ADPCM2LIN_METHODDEF \
|
#define AUDIOOP_ADPCM2LIN_METHODDEF \
|
||||||
{"adpcm2lin", (PyCFunction)audioop_adpcm2lin, METH_VARARGS, audioop_adpcm2lin__doc__},
|
{"adpcm2lin", (PyCFunction)audioop_adpcm2lin, METH_FASTCALL, audioop_adpcm2lin__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_adpcm2lin_impl(PyObject *module, Py_buffer *fragment, int width,
|
audioop_adpcm2lin_impl(PyObject *module, Py_buffer *fragment, int width,
|
||||||
PyObject *state);
|
PyObject *state);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
audioop_adpcm2lin(PyObject *module, PyObject *args)
|
audioop_adpcm2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer fragment = {NULL, NULL};
|
Py_buffer fragment = {NULL, NULL};
|
||||||
int width;
|
int width;
|
||||||
PyObject *state;
|
PyObject *state;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*iO:adpcm2lin",
|
if (!_PyArg_ParseStack(args, nargs, "y*iO:adpcm2lin",
|
||||||
&fragment, &width, &state)) {
|
&fragment, &width, &state)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("adpcm2lin", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = audioop_adpcm2lin_impl(module, &fragment, width, state);
|
return_value = audioop_adpcm2lin_impl(module, &fragment, width, state);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -926,4 +1033,4 @@ exit:
|
||||||
|
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=e0ab74c3fa57c39c input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=ee7c63ec28a11b78 input=a9049054013a1b77]*/
|
||||||
|
|
28
third_party/python/Modules/clinic/binascii.inc
vendored
28
third_party/python/Modules/clinic/binascii.inc
vendored
|
@ -118,7 +118,7 @@ binascii_b2a_base64(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObjec
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
int newline = 1;
|
int newline = 1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&data, &newline)) {
|
&data, &newline)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -267,23 +267,27 @@ PyDoc_STRVAR(binascii_crc_hqx__doc__,
|
||||||
"Compute CRC-CCITT incrementally.");
|
"Compute CRC-CCITT incrementally.");
|
||||||
|
|
||||||
#define BINASCII_CRC_HQX_METHODDEF \
|
#define BINASCII_CRC_HQX_METHODDEF \
|
||||||
{"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_VARARGS, binascii_crc_hqx__doc__},
|
{"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_FASTCALL, binascii_crc_hqx__doc__},
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc);
|
binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
binascii_crc_hqx(PyObject *module, PyObject *args)
|
binascii_crc_hqx(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
unsigned int crc;
|
unsigned int crc;
|
||||||
unsigned int _return_value;
|
unsigned int _return_value;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*I:crc_hqx",
|
if (!_PyArg_ParseStack(args, nargs, "y*I:crc_hqx",
|
||||||
&data, &crc)) {
|
&data, &crc)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("crc_hqx", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
_return_value = binascii_crc_hqx_impl(module, &data, crc);
|
_return_value = binascii_crc_hqx_impl(module, &data, crc);
|
||||||
if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
|
if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -306,23 +310,27 @@ PyDoc_STRVAR(binascii_crc32__doc__,
|
||||||
"Compute CRC-32 incrementally.");
|
"Compute CRC-32 incrementally.");
|
||||||
|
|
||||||
#define BINASCII_CRC32_METHODDEF \
|
#define BINASCII_CRC32_METHODDEF \
|
||||||
{"crc32", (PyCFunction)binascii_crc32, METH_VARARGS, binascii_crc32__doc__},
|
{"crc32", (PyCFunction)binascii_crc32, METH_FASTCALL, binascii_crc32__doc__},
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
binascii_crc32_impl(PyObject *module, Py_buffer *data, unsigned int crc);
|
binascii_crc32_impl(PyObject *module, Py_buffer *data, unsigned int crc);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
binascii_crc32(PyObject *module, PyObject *args)
|
binascii_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
unsigned int crc = 0;
|
unsigned int crc = 0;
|
||||||
unsigned int _return_value;
|
unsigned int _return_value;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*|I:crc32",
|
if (!_PyArg_ParseStack(args, nargs, "y*|I:crc32",
|
||||||
&data, &crc)) {
|
&data, &crc)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("crc32", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
_return_value = binascii_crc32_impl(module, &data, crc);
|
_return_value = binascii_crc32_impl(module, &data, crc);
|
||||||
if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
|
if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -495,7 +503,7 @@ binascii_a2b_qp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
int header = 0;
|
int header = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
ascii_buffer_converter, &data, &header)) {
|
ascii_buffer_converter, &data, &header)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -537,7 +545,7 @@ binascii_b2a_qp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k
|
||||||
int istext = 1;
|
int istext = 1;
|
||||||
int header = 0;
|
int header = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&data, "etabs, &istext, &header)) {
|
&data, "etabs, &istext, &header)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -551,4 +559,4 @@ exit:
|
||||||
|
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=458eb09731cb7877 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=4a418f883ccc79fe input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -642,22 +642,26 @@ PyDoc_STRVAR(cmath_log__doc__,
|
||||||
"If the base not specified, returns the natural logarithm (base e) of z.");
|
"If the base not specified, returns the natural logarithm (base e) of z.");
|
||||||
|
|
||||||
#define CMATH_LOG_METHODDEF \
|
#define CMATH_LOG_METHODDEF \
|
||||||
{"log", (PyCFunction)cmath_log, METH_VARARGS, cmath_log__doc__},
|
{"log", (PyCFunction)cmath_log, METH_FASTCALL, cmath_log__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj);
|
cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cmath_log(PyObject *module, PyObject *args)
|
cmath_log(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_complex x;
|
Py_complex x;
|
||||||
PyObject *y_obj = NULL;
|
PyObject *y_obj = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "D|O:log",
|
if (!_PyArg_ParseStack(args, nargs, "D|O:log",
|
||||||
&x, &y_obj)) {
|
&x, &y_obj)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("log", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = cmath_log_impl(module, x, y_obj);
|
return_value = cmath_log_impl(module, x, y_obj);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -727,22 +731,26 @@ PyDoc_STRVAR(cmath_rect__doc__,
|
||||||
"Convert from polar coordinates to rectangular coordinates.");
|
"Convert from polar coordinates to rectangular coordinates.");
|
||||||
|
|
||||||
#define CMATH_RECT_METHODDEF \
|
#define CMATH_RECT_METHODDEF \
|
||||||
{"rect", (PyCFunction)cmath_rect, METH_VARARGS, cmath_rect__doc__},
|
{"rect", (PyCFunction)cmath_rect, METH_FASTCALL, cmath_rect__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cmath_rect_impl(PyObject *module, double r, double phi);
|
cmath_rect_impl(PyObject *module, double r, double phi);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cmath_rect(PyObject *module, PyObject *args)
|
cmath_rect(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
double r;
|
double r;
|
||||||
double phi;
|
double phi;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "dd:rect",
|
if (!_PyArg_ParseStack(args, nargs, "dd:rect",
|
||||||
&r, &phi)) {
|
&r, &phi)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("rect", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = cmath_rect_impl(module, r, phi);
|
return_value = cmath_rect_impl(module, r, phi);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -870,7 +878,7 @@ cmath_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
|
||||||
double abs_tol = 0.0;
|
double abs_tol = 0.0;
|
||||||
int _return_value;
|
int _return_value;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&a, &b, &rel_tol, &abs_tol)) {
|
&a, &b, &rel_tol, &abs_tol)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -883,4 +891,4 @@ cmath_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=978f59702b41655f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=93eff5d4c242ee57 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -20,23 +20,27 @@ PyDoc_STRVAR(fcntl_fcntl__doc__,
|
||||||
"corresponding to the return value of the fcntl call in the C code.");
|
"corresponding to the return value of the fcntl call in the C code.");
|
||||||
|
|
||||||
#define FCNTL_FCNTL_METHODDEF \
|
#define FCNTL_FCNTL_METHODDEF \
|
||||||
{"fcntl", (PyCFunction)fcntl_fcntl, METH_VARARGS, fcntl_fcntl__doc__},
|
{"fcntl", (PyCFunction)fcntl_fcntl, METH_FASTCALL, fcntl_fcntl__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg);
|
fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fcntl_fcntl(PyObject *module, PyObject *args)
|
fcntl_fcntl(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
int code;
|
int code;
|
||||||
PyObject *arg = NULL;
|
PyObject *arg = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O&i|O:fcntl",
|
if (!_PyArg_ParseStack(args, nargs, "O&i|O:fcntl",
|
||||||
conv_descriptor, &fd, &code, &arg)) {
|
conv_descriptor, &fd, &code, &arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("fcntl", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = fcntl_fcntl_impl(module, fd, code, arg);
|
return_value = fcntl_fcntl_impl(module, fd, code, arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -77,14 +81,14 @@ PyDoc_STRVAR(fcntl_ioctl__doc__,
|
||||||
"code.");
|
"code.");
|
||||||
|
|
||||||
#define FCNTL_IOCTL_METHODDEF \
|
#define FCNTL_IOCTL_METHODDEF \
|
||||||
{"ioctl", (PyCFunction)fcntl_ioctl, METH_VARARGS, fcntl_ioctl__doc__},
|
{"ioctl", (PyCFunction)fcntl_ioctl, METH_FASTCALL, fcntl_ioctl__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
|
fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
|
||||||
PyObject *ob_arg, int mutate_arg);
|
PyObject *ob_arg, int mutate_arg);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fcntl_ioctl(PyObject *module, PyObject *args)
|
fcntl_ioctl(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -92,10 +96,14 @@ fcntl_ioctl(PyObject *module, PyObject *args)
|
||||||
PyObject *ob_arg = NULL;
|
PyObject *ob_arg = NULL;
|
||||||
int mutate_arg = 1;
|
int mutate_arg = 1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O&I|Op:ioctl",
|
if (!_PyArg_ParseStack(args, nargs, "O&I|Op:ioctl",
|
||||||
conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) {
|
conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("ioctl", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg);
|
return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -112,22 +120,26 @@ PyDoc_STRVAR(fcntl_flock__doc__,
|
||||||
"function is emulated using fcntl()).");
|
"function is emulated using fcntl()).");
|
||||||
|
|
||||||
#define FCNTL_FLOCK_METHODDEF \
|
#define FCNTL_FLOCK_METHODDEF \
|
||||||
{"flock", (PyCFunction)fcntl_flock, METH_VARARGS, fcntl_flock__doc__},
|
{"flock", (PyCFunction)fcntl_flock, METH_FASTCALL, fcntl_flock__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fcntl_flock_impl(PyObject *module, int fd, int code);
|
fcntl_flock_impl(PyObject *module, int fd, int code);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fcntl_flock(PyObject *module, PyObject *args)
|
fcntl_flock(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O&i:flock",
|
if (!_PyArg_ParseStack(args, nargs, "O&i:flock",
|
||||||
conv_descriptor, &fd, &code)) {
|
conv_descriptor, &fd, &code)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("flock", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = fcntl_flock_impl(module, fd, code);
|
return_value = fcntl_flock_impl(module, fd, code);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -162,14 +174,14 @@ PyDoc_STRVAR(fcntl_lockf__doc__,
|
||||||
" 2 - relative to the end of the file (SEEK_END)");
|
" 2 - relative to the end of the file (SEEK_END)");
|
||||||
|
|
||||||
#define FCNTL_LOCKF_METHODDEF \
|
#define FCNTL_LOCKF_METHODDEF \
|
||||||
{"lockf", (PyCFunction)fcntl_lockf, METH_VARARGS, fcntl_lockf__doc__},
|
{"lockf", (PyCFunction)fcntl_lockf, METH_FASTCALL, fcntl_lockf__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fcntl_lockf_impl(PyObject *module, int fd, int code, PyObject *lenobj,
|
fcntl_lockf_impl(PyObject *module, int fd, int code, PyObject *lenobj,
|
||||||
PyObject *startobj, int whence);
|
PyObject *startobj, int whence);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fcntl_lockf(PyObject *module, PyObject *args)
|
fcntl_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -178,13 +190,17 @@ fcntl_lockf(PyObject *module, PyObject *args)
|
||||||
PyObject *startobj = NULL;
|
PyObject *startobj = NULL;
|
||||||
int whence = 0;
|
int whence = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O&i|OOi:lockf",
|
if (!_PyArg_ParseStack(args, nargs, "O&i|OOi:lockf",
|
||||||
conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) {
|
conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("lockf", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence);
|
return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=36cff76a8fb2c9a6 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=b67e9579722e6d4f input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -25,7 +25,7 @@ grp_getgrgid(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna
|
||||||
static _PyArg_Parser _parser = {"O:getgrgid", _keywords, 0};
|
static _PyArg_Parser _parser = {"O:getgrgid", _keywords, 0};
|
||||||
PyObject *id;
|
PyObject *id;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&id)) {
|
&id)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ grp_getgrnam(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna
|
||||||
static _PyArg_Parser _parser = {"U:getgrnam", _keywords, 0};
|
static _PyArg_Parser _parser = {"U:getgrnam", _keywords, 0};
|
||||||
PyObject *name;
|
PyObject *name;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&name)) {
|
&name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -87,4 +87,4 @@ grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
return grp_getgrall_impl(module);
|
return grp_getgrall_impl(module);
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=d6417ae0a7298e0e input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=fb690db5e676d378 input=a9049054013a1b77]*/
|
||||||
|
|
575
third_party/python/Modules/clinic/posixmodule.inc
vendored
575
third_party/python/Modules/clinic/posixmodule.inc
vendored
File diff suppressed because it is too large
Load diff
34
third_party/python/Modules/clinic/pyexpat.inc
vendored
34
third_party/python/Modules/clinic/pyexpat.inc
vendored
|
@ -12,23 +12,27 @@ PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__,
|
||||||
"`isfinal\' should be true at end of input.");
|
"`isfinal\' should be true at end of input.");
|
||||||
|
|
||||||
#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
|
#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
|
||||||
{"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_VARARGS, pyexpat_xmlparser_Parse__doc__},
|
{"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_FASTCALL, pyexpat_xmlparser_Parse__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data,
|
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data,
|
||||||
int isfinal);
|
int isfinal);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args)
|
pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *data;
|
PyObject *data;
|
||||||
int isfinal = 0;
|
int isfinal = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|i:Parse",
|
if (!_PyArg_ParseStack(args, nargs, "O|i:Parse",
|
||||||
&data, &isfinal)) {
|
&data, &isfinal)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("Parse", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
|
return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -117,7 +121,7 @@ PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__,
|
||||||
"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
|
"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
|
||||||
|
|
||||||
#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
|
#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
|
||||||
{"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_VARARGS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
|
{"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_FASTCALL, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
|
pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
|
||||||
|
@ -125,16 +129,20 @@ pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
|
||||||
const char *encoding);
|
const char *encoding);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
|
pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
const char *context;
|
const char *context;
|
||||||
const char *encoding = NULL;
|
const char *encoding = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate",
|
if (!_PyArg_ParseStack(args, nargs, "z|s:ExternalEntityParserCreate",
|
||||||
&context, &encoding)) {
|
&context, &encoding)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("ExternalEntityParserCreate", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
|
return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -186,21 +194,25 @@ PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
|
||||||
"information to the parser. \'flag\' defaults to True if not provided.");
|
"information to the parser. \'flag\' defaults to True if not provided.");
|
||||||
|
|
||||||
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
|
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
|
||||||
{"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_VARARGS, pyexpat_xmlparser_UseForeignDTD__doc__},
|
{"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_FASTCALL, pyexpat_xmlparser_UseForeignDTD__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
|
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args)
|
pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int flag = 1;
|
int flag = 1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|p:UseForeignDTD",
|
if (!_PyArg_ParseStack(args, nargs, "|p:UseForeignDTD",
|
||||||
&flag)) {
|
&flag)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("UseForeignDTD", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
|
return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -250,7 +262,7 @@ pyexpat_ParserCreate(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObje
|
||||||
const char *namespace_separator = NULL;
|
const char *namespace_separator = NULL;
|
||||||
PyObject *intern = NULL;
|
PyObject *intern = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&encoding, &namespace_separator, &intern)) {
|
&encoding, &namespace_separator, &intern)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -290,4 +302,4 @@ exit:
|
||||||
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
||||||
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
||||||
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
|
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
|
||||||
/*[clinic end generated code: output=e889f7c6af6cc42f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=0548a6b12157e29b input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -75,22 +75,26 @@ PyDoc_STRVAR(signal_signal__doc__,
|
||||||
"the first is the signal number, the second is the interrupted stack frame.");
|
"the first is the signal number, the second is the interrupted stack frame.");
|
||||||
|
|
||||||
#define SIGNAL_SIGNAL_METHODDEF \
|
#define SIGNAL_SIGNAL_METHODDEF \
|
||||||
{"signal", (PyCFunction)signal_signal, METH_VARARGS, signal_signal__doc__},
|
{"signal", (PyCFunction)signal_signal, METH_FASTCALL, signal_signal__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_signal_impl(PyObject *module, int signalnum, PyObject *handler);
|
signal_signal_impl(PyObject *module, int signalnum, PyObject *handler);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_signal(PyObject *module, PyObject *args)
|
signal_signal(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int signalnum;
|
int signalnum;
|
||||||
PyObject *handler;
|
PyObject *handler;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "iO:signal",
|
if (!_PyArg_ParseStack(args, nargs, "iO:signal",
|
||||||
&signalnum, &handler)) {
|
&signalnum, &handler)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("signal", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = signal_signal_impl(module, signalnum, handler);
|
return_value = signal_signal_impl(module, signalnum, handler);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -142,22 +146,26 @@ PyDoc_STRVAR(signal_siginterrupt__doc__,
|
||||||
"signal sig, else system calls will be interrupted.");
|
"signal sig, else system calls will be interrupted.");
|
||||||
|
|
||||||
#define SIGNAL_SIGINTERRUPT_METHODDEF \
|
#define SIGNAL_SIGINTERRUPT_METHODDEF \
|
||||||
{"siginterrupt", (PyCFunction)signal_siginterrupt, METH_VARARGS, signal_siginterrupt__doc__},
|
{"siginterrupt", (PyCFunction)signal_siginterrupt, METH_FASTCALL, signal_siginterrupt__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_siginterrupt_impl(PyObject *module, int signalnum, int flag);
|
signal_siginterrupt_impl(PyObject *module, int signalnum, int flag);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_siginterrupt(PyObject *module, PyObject *args)
|
signal_siginterrupt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int signalnum;
|
int signalnum;
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "ii:siginterrupt",
|
if (!_PyArg_ParseStack(args, nargs, "ii:siginterrupt",
|
||||||
&signalnum, &flag)) {
|
&signalnum, &flag)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("siginterrupt", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = signal_siginterrupt_impl(module, signalnum, flag);
|
return_value = signal_siginterrupt_impl(module, signalnum, flag);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -180,24 +188,28 @@ PyDoc_STRVAR(signal_setitimer__doc__,
|
||||||
"Returns old values as a tuple: (delay, interval).");
|
"Returns old values as a tuple: (delay, interval).");
|
||||||
|
|
||||||
#define SIGNAL_SETITIMER_METHODDEF \
|
#define SIGNAL_SETITIMER_METHODDEF \
|
||||||
{"setitimer", (PyCFunction)signal_setitimer, METH_VARARGS, signal_setitimer__doc__},
|
{"setitimer", (PyCFunction)signal_setitimer, METH_FASTCALL, signal_setitimer__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_setitimer_impl(PyObject *module, int which, double seconds,
|
signal_setitimer_impl(PyObject *module, int which, double seconds,
|
||||||
double interval);
|
double interval);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_setitimer(PyObject *module, PyObject *args)
|
signal_setitimer(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int which;
|
int which;
|
||||||
double seconds;
|
double seconds;
|
||||||
double interval = 0.0;
|
double interval = 0.0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "id|d:setitimer",
|
if (!_PyArg_ParseStack(args, nargs, "id|d:setitimer",
|
||||||
&which, &seconds, &interval)) {
|
&which, &seconds, &interval)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("setitimer", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = signal_setitimer_impl(module, which, seconds, interval);
|
return_value = signal_setitimer_impl(module, which, seconds, interval);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -246,22 +258,26 @@ PyDoc_STRVAR(signal_pthread_sigmask__doc__,
|
||||||
"Fetch and/or change the signal mask of the calling thread.");
|
"Fetch and/or change the signal mask of the calling thread.");
|
||||||
|
|
||||||
#define SIGNAL_PTHREAD_SIGMASK_METHODDEF \
|
#define SIGNAL_PTHREAD_SIGMASK_METHODDEF \
|
||||||
{"pthread_sigmask", (PyCFunction)signal_pthread_sigmask, METH_VARARGS, signal_pthread_sigmask__doc__},
|
{"pthread_sigmask", (PyCFunction)signal_pthread_sigmask, METH_FASTCALL, signal_pthread_sigmask__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_pthread_sigmask_impl(PyObject *module, int how, PyObject *mask);
|
signal_pthread_sigmask_impl(PyObject *module, int how, PyObject *mask);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_pthread_sigmask(PyObject *module, PyObject *args)
|
signal_pthread_sigmask(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int how;
|
int how;
|
||||||
PyObject *mask;
|
PyObject *mask;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "iO:pthread_sigmask",
|
if (!_PyArg_ParseStack(args, nargs, "iO:pthread_sigmask",
|
||||||
&how, &mask)) {
|
&how, &mask)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("pthread_sigmask", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = signal_pthread_sigmask_impl(module, how, mask);
|
return_value = signal_pthread_sigmask_impl(module, how, mask);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -338,24 +354,28 @@ PyDoc_STRVAR(signal_sigtimedwait__doc__,
|
||||||
"The timeout is specified in seconds, with floating point numbers allowed.");
|
"The timeout is specified in seconds, with floating point numbers allowed.");
|
||||||
|
|
||||||
#define SIGNAL_SIGTIMEDWAIT_METHODDEF \
|
#define SIGNAL_SIGTIMEDWAIT_METHODDEF \
|
||||||
{"sigtimedwait", (PyCFunction)signal_sigtimedwait, METH_VARARGS, signal_sigtimedwait__doc__},
|
{"sigtimedwait", (PyCFunction)signal_sigtimedwait, METH_FASTCALL, signal_sigtimedwait__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_sigtimedwait_impl(PyObject *module, PyObject *sigset,
|
signal_sigtimedwait_impl(PyObject *module, PyObject *sigset,
|
||||||
PyObject *timeout_obj);
|
PyObject *timeout_obj);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_sigtimedwait(PyObject *module, PyObject *args)
|
signal_sigtimedwait(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *sigset;
|
PyObject *sigset;
|
||||||
PyObject *timeout_obj;
|
PyObject *timeout_obj;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "sigtimedwait",
|
if (!_PyArg_UnpackStack(args, nargs, "sigtimedwait",
|
||||||
2, 2,
|
2, 2,
|
||||||
&sigset, &timeout_obj)) {
|
&sigset, &timeout_obj)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("sigtimedwait", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj);
|
return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -373,22 +393,26 @@ PyDoc_STRVAR(signal_pthread_kill__doc__,
|
||||||
"Send a signal to a thread.");
|
"Send a signal to a thread.");
|
||||||
|
|
||||||
#define SIGNAL_PTHREAD_KILL_METHODDEF \
|
#define SIGNAL_PTHREAD_KILL_METHODDEF \
|
||||||
{"pthread_kill", (PyCFunction)signal_pthread_kill, METH_VARARGS, signal_pthread_kill__doc__},
|
{"pthread_kill", (PyCFunction)signal_pthread_kill, METH_FASTCALL, signal_pthread_kill__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_pthread_kill_impl(PyObject *module, long thread_id, int signalnum);
|
signal_pthread_kill_impl(PyObject *module, long thread_id, int signalnum);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
signal_pthread_kill(PyObject *module, PyObject *args)
|
signal_pthread_kill(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
long thread_id;
|
long thread_id;
|
||||||
int signalnum;
|
int signalnum;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "li:pthread_kill",
|
if (!_PyArg_ParseStack(args, nargs, "li:pthread_kill",
|
||||||
&thread_id, &signalnum)) {
|
&thread_id, &signalnum)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("pthread_kill", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = signal_pthread_kill_impl(module, thread_id, signalnum);
|
return_value = signal_pthread_kill_impl(module, thread_id, signalnum);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -440,4 +464,4 @@ exit:
|
||||||
#ifndef SIGNAL_PTHREAD_KILL_METHODDEF
|
#ifndef SIGNAL_PTHREAD_KILL_METHODDEF
|
||||||
#define SIGNAL_PTHREAD_KILL_METHODDEF
|
#define SIGNAL_PTHREAD_KILL_METHODDEF
|
||||||
#endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
|
#endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
|
||||||
/*[clinic end generated code: output=c6990ef0d0ba72b6 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=fab3dba32c058588 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -14,23 +14,27 @@ PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
|
||||||
"ValueError is raised.");
|
"ValueError is raised.");
|
||||||
|
|
||||||
#define UNICODEDATA_UCD_DECIMAL_METHODDEF \
|
#define UNICODEDATA_UCD_DECIMAL_METHODDEF \
|
||||||
{"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__},
|
{"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_FASTCALL, unicodedata_UCD_decimal__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_decimal_impl(PyObject *self, int chr,
|
unicodedata_UCD_decimal_impl(PyObject *self, int chr,
|
||||||
PyObject *default_value);
|
PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_decimal(PyObject *self, PyObject *args)
|
unicodedata_UCD_decimal(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int chr;
|
int chr;
|
||||||
PyObject *default_value = NULL;
|
PyObject *default_value = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "C|O:decimal",
|
if (!_PyArg_ParseStack(args, nargs, "C|O:decimal",
|
||||||
&chr, &default_value)) {
|
&chr, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("decimal", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = unicodedata_UCD_decimal_impl(self, chr, default_value);
|
return_value = unicodedata_UCD_decimal_impl(self, chr, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -48,22 +52,26 @@ PyDoc_STRVAR(unicodedata_UCD_digit__doc__,
|
||||||
"ValueError is raised.");
|
"ValueError is raised.");
|
||||||
|
|
||||||
#define UNICODEDATA_UCD_DIGIT_METHODDEF \
|
#define UNICODEDATA_UCD_DIGIT_METHODDEF \
|
||||||
{"digit", (PyCFunction)unicodedata_UCD_digit, METH_VARARGS, unicodedata_UCD_digit__doc__},
|
{"digit", (PyCFunction)unicodedata_UCD_digit, METH_FASTCALL, unicodedata_UCD_digit__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_digit_impl(PyObject *self, int chr, PyObject *default_value);
|
unicodedata_UCD_digit_impl(PyObject *self, int chr, PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_digit(PyObject *self, PyObject *args)
|
unicodedata_UCD_digit(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int chr;
|
int chr;
|
||||||
PyObject *default_value = NULL;
|
PyObject *default_value = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "C|O:digit",
|
if (!_PyArg_ParseStack(args, nargs, "C|O:digit",
|
||||||
&chr, &default_value)) {
|
&chr, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("digit", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = unicodedata_UCD_digit_impl(self, chr, default_value);
|
return_value = unicodedata_UCD_digit_impl(self, chr, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -81,23 +89,27 @@ PyDoc_STRVAR(unicodedata_UCD_numeric__doc__,
|
||||||
"ValueError is raised.");
|
"ValueError is raised.");
|
||||||
|
|
||||||
#define UNICODEDATA_UCD_NUMERIC_METHODDEF \
|
#define UNICODEDATA_UCD_NUMERIC_METHODDEF \
|
||||||
{"numeric", (PyCFunction)unicodedata_UCD_numeric, METH_VARARGS, unicodedata_UCD_numeric__doc__},
|
{"numeric", (PyCFunction)unicodedata_UCD_numeric, METH_FASTCALL, unicodedata_UCD_numeric__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_numeric_impl(PyObject *self, int chr,
|
unicodedata_UCD_numeric_impl(PyObject *self, int chr,
|
||||||
PyObject *default_value);
|
PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_numeric(PyObject *self, PyObject *args)
|
unicodedata_UCD_numeric(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int chr;
|
int chr;
|
||||||
PyObject *default_value = NULL;
|
PyObject *default_value = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "C|O:numeric",
|
if (!_PyArg_ParseStack(args, nargs, "C|O:numeric",
|
||||||
&chr, &default_value)) {
|
&chr, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("numeric", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = unicodedata_UCD_numeric_impl(self, chr, default_value);
|
return_value = unicodedata_UCD_numeric_impl(self, chr, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -294,23 +306,27 @@ PyDoc_STRVAR(unicodedata_UCD_normalize__doc__,
|
||||||
"Valid values for form are \'NFC\', \'NFKC\', \'NFD\', and \'NFKD\'.");
|
"Valid values for form are \'NFC\', \'NFKC\', \'NFD\', and \'NFKD\'.");
|
||||||
|
|
||||||
#define UNICODEDATA_UCD_NORMALIZE_METHODDEF \
|
#define UNICODEDATA_UCD_NORMALIZE_METHODDEF \
|
||||||
{"normalize", (PyCFunction)unicodedata_UCD_normalize, METH_VARARGS, unicodedata_UCD_normalize__doc__},
|
{"normalize", (PyCFunction)unicodedata_UCD_normalize, METH_FASTCALL, unicodedata_UCD_normalize__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_normalize_impl(PyObject *self, const char *form,
|
unicodedata_UCD_normalize_impl(PyObject *self, const char *form,
|
||||||
PyObject *input);
|
PyObject *input);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_normalize(PyObject *self, PyObject *args)
|
unicodedata_UCD_normalize(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
const char *form;
|
const char *form;
|
||||||
PyObject *input;
|
PyObject *input;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "sO!:normalize",
|
if (!_PyArg_ParseStack(args, nargs, "sO!:normalize",
|
||||||
&form, &PyUnicode_Type, &input)) {
|
&form, &PyUnicode_Type, &input)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("normalize", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = unicodedata_UCD_normalize_impl(self, form, input);
|
return_value = unicodedata_UCD_normalize_impl(self, form, input);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -327,22 +343,26 @@ PyDoc_STRVAR(unicodedata_UCD_name__doc__,
|
||||||
"ValueError is raised.");
|
"ValueError is raised.");
|
||||||
|
|
||||||
#define UNICODEDATA_UCD_NAME_METHODDEF \
|
#define UNICODEDATA_UCD_NAME_METHODDEF \
|
||||||
{"name", (PyCFunction)unicodedata_UCD_name, METH_VARARGS, unicodedata_UCD_name__doc__},
|
{"name", (PyCFunction)unicodedata_UCD_name, METH_FASTCALL, unicodedata_UCD_name__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_name_impl(PyObject *self, int chr, PyObject *default_value);
|
unicodedata_UCD_name_impl(PyObject *self, int chr, PyObject *default_value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicodedata_UCD_name(PyObject *self, PyObject *args)
|
unicodedata_UCD_name(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int chr;
|
int chr;
|
||||||
PyObject *default_value = NULL;
|
PyObject *default_value = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "C|O:name",
|
if (!_PyArg_ParseStack(args, nargs, "C|O:name",
|
||||||
&chr, &default_value)) {
|
&chr, &default_value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("name", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = unicodedata_UCD_name_impl(self, chr, default_value);
|
return_value = unicodedata_UCD_name_impl(self, chr, default_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -380,4 +400,4 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=5313ce129da87b2f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=badeb811d1caec40 input=a9049054013a1b77]*/
|
||||||
|
|
61
third_party/python/Modules/clinic/zlibmodule.inc
vendored
61
third_party/python/Modules/clinic/zlibmodule.inc
vendored
|
@ -17,6 +17,9 @@ PyDoc_STRVAR(zlib_compress__doc__,
|
||||||
#define ZLIB_COMPRESS_METHODDEF \
|
#define ZLIB_COMPRESS_METHODDEF \
|
||||||
{"compress", (PyCFunction)zlib_compress, METH_FASTCALL, zlib_compress__doc__},
|
{"compress", (PyCFunction)zlib_compress, METH_FASTCALL, zlib_compress__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
zlib_compress_impl(PyObject *module, Py_buffer *data, int level);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_compress(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
zlib_compress(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +29,7 @@ zlib_compress(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
int level = Z_DEFAULT_COMPRESSION;
|
int level = Z_DEFAULT_COMPRESSION;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&data, &level)) {
|
&data, &level)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +74,7 @@ zlib_decompress(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k
|
||||||
int wbits = MAX_WBITS;
|
int wbits = MAX_WBITS;
|
||||||
Py_ssize_t bufsize = DEF_BUF_SIZE;
|
Py_ssize_t bufsize = DEF_BUF_SIZE;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&data, &wbits, ssize_t_converter, &bufsize)) {
|
&data, &wbits, ssize_t_converter, &bufsize)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +113,7 @@ PyDoc_STRVAR(zlib_compressobj__doc__,
|
||||||
" Valid values range from 1 to 9. Higher values result in higher memory\n"
|
" Valid values range from 1 to 9. Higher values result in higher memory\n"
|
||||||
" usage, faster compression, and smaller output.\n"
|
" usage, faster compression, and smaller output.\n"
|
||||||
" strategy\n"
|
" strategy\n"
|
||||||
" Used to tune the compression algorithm. Possible values are\n"
|
" Used to tune the compression algorithm. Possible values are\n"
|
||||||
" Z_DEFAULT_STRATEGY, Z_RLE, Z_HUFFMAN_ONLY, Z_FILTERED, and\n"
|
" Z_DEFAULT_STRATEGY, Z_RLE, Z_HUFFMAN_ONLY, Z_FILTERED, and\n"
|
||||||
" Z_FIXED.\n"
|
" Z_FIXED.\n"
|
||||||
" zdict\n"
|
" zdict\n"
|
||||||
|
@ -137,7 +140,7 @@ zlib_compressobj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *
|
||||||
int strategy = Z_DEFAULT_STRATEGY;
|
int strategy = Z_DEFAULT_STRATEGY;
|
||||||
Py_buffer zdict = {NULL, NULL};
|
Py_buffer zdict = {NULL, NULL};
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&level, &method, &wbits, &memLevel, &strategy, &zdict)) {
|
&level, &method, &wbits, &memLevel, &strategy, &zdict)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +182,7 @@ zlib_decompressobj(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject
|
||||||
int wbits = MAX_WBITS;
|
int wbits = MAX_WBITS;
|
||||||
PyObject *zdict = NULL;
|
PyObject *zdict = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&wbits, &zdict)) {
|
&wbits, &zdict)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +264,7 @@ zlib_Decompress_decompress(compobject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
Py_ssize_t max_length = 0;
|
Py_ssize_t max_length = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&data, ssize_t_converter, &max_length)) {
|
&data, ssize_t_converter, &max_length)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -289,21 +292,25 @@ PyDoc_STRVAR(zlib_Compress_flush__doc__,
|
||||||
" can still be compressed.");
|
" can still be compressed.");
|
||||||
|
|
||||||
#define ZLIB_COMPRESS_FLUSH_METHODDEF \
|
#define ZLIB_COMPRESS_FLUSH_METHODDEF \
|
||||||
{"flush", (PyCFunction)zlib_Compress_flush, METH_VARARGS, zlib_Compress_flush__doc__},
|
{"flush", (PyCFunction)zlib_Compress_flush, METH_FASTCALL, zlib_Compress_flush__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_Compress_flush_impl(compobject *self, int mode);
|
zlib_Compress_flush_impl(compobject *self, int mode);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_Compress_flush(compobject *self, PyObject *args)
|
zlib_Compress_flush(compobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int mode = Z_FINISH;
|
int mode = Z_FINISH;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|i:flush",
|
if (!_PyArg_ParseStack(args, nargs, "|i:flush",
|
||||||
&mode)) {
|
&mode)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("flush", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = zlib_Compress_flush_impl(self, mode);
|
return_value = zlib_Compress_flush_impl(self, mode);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -364,21 +371,25 @@ PyDoc_STRVAR(zlib_Decompress_flush__doc__,
|
||||||
" the initial size of the output buffer.");
|
" the initial size of the output buffer.");
|
||||||
|
|
||||||
#define ZLIB_DECOMPRESS_FLUSH_METHODDEF \
|
#define ZLIB_DECOMPRESS_FLUSH_METHODDEF \
|
||||||
{"flush", (PyCFunction)zlib_Decompress_flush, METH_VARARGS, zlib_Decompress_flush__doc__},
|
{"flush", (PyCFunction)zlib_Decompress_flush, METH_FASTCALL, zlib_Decompress_flush__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length);
|
zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_Decompress_flush(compobject *self, PyObject *args)
|
zlib_Decompress_flush(compobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t length = DEF_BUF_SIZE;
|
Py_ssize_t length = DEF_BUF_SIZE;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|O&:flush",
|
if (!_PyArg_ParseStack(args, nargs, "|O&:flush",
|
||||||
ssize_t_converter, &length)) {
|
ssize_t_converter, &length)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("flush", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = zlib_Decompress_flush_impl(self, length);
|
return_value = zlib_Decompress_flush_impl(self, length);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -397,22 +408,26 @@ PyDoc_STRVAR(zlib_adler32__doc__,
|
||||||
"The returned checksum is an integer.");
|
"The returned checksum is an integer.");
|
||||||
|
|
||||||
#define ZLIB_ADLER32_METHODDEF \
|
#define ZLIB_ADLER32_METHODDEF \
|
||||||
{"adler32", (PyCFunction)zlib_adler32, METH_VARARGS, zlib_adler32__doc__},
|
{"adler32", (PyCFunction)zlib_adler32, METH_FASTCALL, zlib_adler32__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_adler32_impl(PyObject *module, Py_buffer *data, unsigned int value);
|
zlib_adler32_impl(PyObject *module, Py_buffer *data, unsigned int value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_adler32(PyObject *module, PyObject *args)
|
zlib_adler32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
unsigned int value = 1;
|
unsigned int value = 1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*|I:adler32",
|
if (!_PyArg_ParseStack(args, nargs, "y*|I:adler32",
|
||||||
&data, &value)) {
|
&data, &value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("adler32", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = zlib_adler32_impl(module, &data, value);
|
return_value = zlib_adler32_impl(module, &data, value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -436,22 +451,26 @@ PyDoc_STRVAR(zlib_crc32__doc__,
|
||||||
"The returned checksum is an integer.");
|
"The returned checksum is an integer.");
|
||||||
|
|
||||||
#define ZLIB_CRC32_METHODDEF \
|
#define ZLIB_CRC32_METHODDEF \
|
||||||
{"crc32", (PyCFunction)zlib_crc32, METH_VARARGS, zlib_crc32__doc__},
|
{"crc32", (PyCFunction)zlib_crc32, METH_FASTCALL, zlib_crc32__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_crc32_impl(PyObject *module, Py_buffer *data, unsigned int value);
|
zlib_crc32_impl(PyObject *module, Py_buffer *data, unsigned int value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_crc32(PyObject *module, PyObject *args)
|
zlib_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer data = {NULL, NULL};
|
Py_buffer data = {NULL, NULL};
|
||||||
unsigned int value = 0;
|
unsigned int value = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*|I:crc32",
|
if (!_PyArg_ParseStack(args, nargs, "y*|I:crc32",
|
||||||
&data, &value)) {
|
&data, &value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("crc32", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = zlib_crc32_impl(module, &data, value);
|
return_value = zlib_crc32_impl(module, &data, value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -466,8 +485,4 @@ exit:
|
||||||
#ifndef ZLIB_COMPRESS_COPY_METHODDEF
|
#ifndef ZLIB_COMPRESS_COPY_METHODDEF
|
||||||
#define ZLIB_COMPRESS_COPY_METHODDEF
|
#define ZLIB_COMPRESS_COPY_METHODDEF
|
||||||
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
|
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
|
||||||
|
/*[clinic end generated code: output=c6cb10ed66f226b2 input=a9049054013a1b77]*/
|
||||||
#ifndef ZLIB_DECOMPRESS_COPY_METHODDEF
|
|
||||||
#define ZLIB_DECOMPRESS_COPY_METHODDEF
|
|
||||||
#endif /* !defined(ZLIB_DECOMPRESS_COPY_METHODDEF) */
|
|
||||||
/*[clinic end generated code: output=497dad1132c962e2 input=a9049054013a1b77]*/
|
|
||||||
|
|
12
third_party/python/Modules/socketmodule.c
vendored
12
third_party/python/Modules/socketmodule.c
vendored
|
@ -3867,11 +3867,15 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
|
||||||
arglen = PyTuple_Size(args);
|
arglen = PyTuple_Size(args);
|
||||||
switch (arglen) {
|
switch (arglen) {
|
||||||
case 2:
|
case 2:
|
||||||
PyArg_ParseTuple(args, "y*O:sendto", &pbuf, &addro);
|
if (!PyArg_ParseTuple(args, "y*O:sendto", &pbuf, &addro)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PyArg_ParseTuple(args, "y*iO:sendto",
|
if (!PyArg_ParseTuple(args, "y*iO:sendto",
|
||||||
&pbuf, &flags, &addro);
|
&pbuf, &flags, &addro)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
|
@ -3879,8 +3883,6 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
|
||||||
arglen);
|
arglen);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (PyErr_Occurred())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!IS_SELECTABLE(s)) {
|
if (!IS_SELECTABLE(s)) {
|
||||||
PyBuffer_Release(&pbuf);
|
PyBuffer_Release(&pbuf);
|
||||||
|
|
2
third_party/python/Modules/zlibmodule.c
vendored
2
third_party/python/Modules/zlibmodule.c
vendored
|
@ -503,7 +503,7 @@ Return a compressor object.
|
||||||
static PyObject *
|
static PyObject *
|
||||||
zlib_compressobj_impl(PyObject *module, int level, int method, int wbits,
|
zlib_compressobj_impl(PyObject *module, int level, int method, int wbits,
|
||||||
int memLevel, int strategy, Py_buffer *zdict)
|
int memLevel, int strategy, Py_buffer *zdict)
|
||||||
/*[clinic end generated code: output=8b5bed9c8fc3814d input=2fa3d026f90ab8d5]*/
|
/*[clinic end generated code: output=8b5bed9c8fc3814d input=b5a08c304c3bae52]*/
|
||||||
{
|
{
|
||||||
compobject *self = NULL;
|
compobject *self = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
199
third_party/python/Objects/abstract.c
vendored
199
third_party/python/Objects/abstract.c
vendored
|
@ -2255,27 +2255,38 @@ PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
/* PyObject_Call() must not be called with an exception set,
|
/* PyObject_Call() must not be called with an exception set,
|
||||||
because it may clear it (directly or indirectly) and so the
|
because it can clear it (directly or indirectly) and so the
|
||||||
caller loses its exception */
|
caller loses its exception */
|
||||||
assert(!PyErr_Occurred());
|
assert(!PyErr_Occurred());
|
||||||
assert(PyTuple_Check(args));
|
assert(PyTuple_Check(args));
|
||||||
assert(kwargs == NULL || PyDict_Check(kwargs));
|
assert(kwargs == NULL || PyDict_Check(kwargs));
|
||||||
|
|
||||||
call = callable->ob_type->tp_call;
|
if (PyFunction_Check(callable)) {
|
||||||
if (call == NULL) {
|
return _PyFunction_FastCallDict(callable,
|
||||||
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
&PyTuple_GET_ITEM(args, 0),
|
||||||
callable->ob_type->tp_name);
|
PyTuple_GET_SIZE(args),
|
||||||
return NULL;
|
kwargs);
|
||||||
}
|
}
|
||||||
|
else if (PyCFunction_Check(callable)) {
|
||||||
|
return PyCFunction_Call(callable, args, kwargs);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
call = callable->ob_type->tp_call;
|
||||||
|
if (call == NULL) {
|
||||||
|
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
||||||
|
callable->ob_type->tp_name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (Py_EnterRecursiveCall(" while calling a Python object"))
|
if (Py_EnterRecursiveCall(" while calling a Python object"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
result = (*call)(callable, args, kwargs);
|
result = (*call)(callable, args, kwargs);
|
||||||
|
|
||||||
Py_LeaveRecursiveCall();
|
Py_LeaveRecursiveCall();
|
||||||
|
|
||||||
return _Py_CheckFunctionResult(callable, result, NULL);
|
return _Py_CheckFunctionResult(callable, result, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their
|
/* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their
|
||||||
|
@ -2300,15 +2311,36 @@ _PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs)
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject*
|
||||||
|
_PyStack_AsTupleSlice(PyObject **stack, Py_ssize_t nargs,
|
||||||
|
Py_ssize_t start, Py_ssize_t end)
|
||||||
|
{
|
||||||
|
PyObject *args;
|
||||||
|
Py_ssize_t i;
|
||||||
|
|
||||||
|
assert(0 <= start);
|
||||||
|
assert(end <= nargs);
|
||||||
|
assert(start <= end);
|
||||||
|
|
||||||
|
args = PyTuple_New(end - start);
|
||||||
|
if (args == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=start; i < end; i++) {
|
||||||
|
PyObject *item = stack[i];
|
||||||
|
Py_INCREF(item);
|
||||||
|
PyTuple_SET_ITEM(args, i - start, item);
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
|
_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
|
||||||
PyObject *kwargs)
|
PyObject *kwargs)
|
||||||
{
|
{
|
||||||
ternaryfunc call;
|
|
||||||
PyObject *result = NULL;
|
|
||||||
|
|
||||||
/* _PyObject_FastCallDict() must not be called with an exception set,
|
/* _PyObject_FastCallDict() must not be called with an exception set,
|
||||||
because it may clear it (directly or indirectly) and so the
|
because it can clear it (directly or indirectly) and so the
|
||||||
caller loses its exception */
|
caller loses its exception */
|
||||||
assert(!PyErr_Occurred());
|
assert(!PyErr_Occurred());
|
||||||
|
|
||||||
|
@ -2317,51 +2349,84 @@ _PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
|
||||||
assert(nargs == 0 || args != NULL);
|
assert(nargs == 0 || args != NULL);
|
||||||
assert(kwargs == NULL || PyDict_Check(kwargs));
|
assert(kwargs == NULL || PyDict_Check(kwargs));
|
||||||
|
|
||||||
if (Py_EnterRecursiveCall(" while calling a Python object")) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PyFunction_Check(callable)) {
|
if (PyFunction_Check(callable)) {
|
||||||
result = _PyFunction_FastCallDict(callable, args, nargs, kwargs);
|
return _PyFunction_FastCallDict(callable, args, nargs, kwargs);
|
||||||
}
|
}
|
||||||
else if (PyCFunction_Check(callable)) {
|
else if (PyCFunction_Check(callable)) {
|
||||||
result = _PyCFunction_FastCallDict(callable, args, nargs, kwargs);
|
return _PyCFunction_FastCallDict(callable, args, nargs, kwargs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyObject *tuple;
|
PyObject *argstuple, *result;
|
||||||
|
ternaryfunc call;
|
||||||
|
|
||||||
/* Slow-path: build a temporary tuple */
|
/* Slow-path: build a temporary tuple */
|
||||||
call = callable->ob_type->tp_call;
|
call = callable->ob_type->tp_call;
|
||||||
if (call == NULL) {
|
if (call == NULL) {
|
||||||
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
||||||
callable->ob_type->tp_name);
|
callable->ob_type->tp_name);
|
||||||
goto exit;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tuple = _PyStack_AsTuple(args, nargs);
|
argstuple = _PyStack_AsTuple(args, nargs);
|
||||||
if (tuple == NULL) {
|
if (argstuple == NULL) {
|
||||||
goto exit;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*call)(callable, tuple, kwargs);
|
if (Py_EnterRecursiveCall(" while calling a Python object")) {
|
||||||
Py_DECREF(tuple);
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*call)(callable, argstuple, kwargs);
|
||||||
|
|
||||||
|
Py_LeaveRecursiveCall();
|
||||||
|
|
||||||
|
Py_DECREF(argstuple);
|
||||||
result = _Py_CheckFunctionResult(callable, result, NULL);
|
result = _Py_CheckFunctionResult(callable, result, NULL);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
|
||||||
Py_LeaveRecursiveCall();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Positional arguments are obj followed by args:
|
/* Positional arguments are obj followed by args:
|
||||||
call callable(obj, *args, **kwargs) */
|
call callable(obj, *args, **kwargs) */
|
||||||
PyObject *
|
PyObject *
|
||||||
|
_PyObject_FastCall_Prepend(PyObject *callable,
|
||||||
|
PyObject *obj, PyObject **args, Py_ssize_t nargs)
|
||||||
|
{
|
||||||
|
PyObject *small_stack[_PY_FASTCALL_SMALL_STACK];
|
||||||
|
PyObject **args2;
|
||||||
|
PyObject *result;
|
||||||
|
|
||||||
|
nargs++;
|
||||||
|
if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) {
|
||||||
|
args2 = small_stack;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
args2 = PyMem_Malloc(nargs * sizeof(PyObject *));
|
||||||
|
if (args2 == NULL) {
|
||||||
|
PyErr_NoMemory();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* use borrowed references */
|
||||||
|
args2[0] = obj;
|
||||||
|
memcpy(&args2[1],
|
||||||
|
args,
|
||||||
|
(nargs - 1)* sizeof(PyObject *));
|
||||||
|
|
||||||
|
result = _PyObject_FastCall(callable, args2, nargs);
|
||||||
|
if (args2 != small_stack) {
|
||||||
|
PyMem_Free(args2);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call callable(obj, *args, **kwargs). */
|
||||||
|
PyObject *
|
||||||
_PyObject_Call_Prepend(PyObject *callable,
|
_PyObject_Call_Prepend(PyObject *callable,
|
||||||
PyObject *obj, PyObject *args, PyObject *kwargs)
|
PyObject *obj, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
PyObject *small_stack[5];
|
PyObject *small_stack[_PY_FASTCALL_SMALL_STACK];
|
||||||
PyObject **stack;
|
PyObject **stack;
|
||||||
Py_ssize_t argcount;
|
Py_ssize_t argcount;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
@ -2398,10 +2463,12 @@ _PyObject_Call_Prepend(PyObject *callable,
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyStack_AsDict(PyObject **values, PyObject *kwnames)
|
_PyStack_AsDict(PyObject **values, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwnames);
|
Py_ssize_t nkwargs;
|
||||||
PyObject *kwdict;
|
PyObject *kwdict;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
|
|
||||||
|
assert(kwnames != NULL);
|
||||||
|
nkwargs = PyTuple_GET_SIZE(kwnames);
|
||||||
kwdict = _PyDict_NewPresized(nkwargs);
|
kwdict = _PyDict_NewPresized(nkwargs);
|
||||||
if (kwdict == NULL) {
|
if (kwdict == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2410,8 +2477,6 @@ _PyStack_AsDict(PyObject **values, PyObject *kwnames)
|
||||||
for (i = 0; i < nkwargs; i++) {
|
for (i = 0; i < nkwargs; i++) {
|
||||||
PyObject *key = PyTuple_GET_ITEM(kwnames, i);
|
PyObject *key = PyTuple_GET_ITEM(kwnames, i);
|
||||||
PyObject *value = *values++;
|
PyObject *value = *values++;
|
||||||
assert(PyUnicode_CheckExact(key));
|
|
||||||
assert(PyDict_GetItem(kwdict, key) == NULL);
|
|
||||||
if (PyDict_SetItem(kwdict, key, value)) {
|
if (PyDict_SetItem(kwdict, key, value)) {
|
||||||
Py_DECREF(kwdict);
|
Py_DECREF(kwdict);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2420,9 +2485,9 @@ _PyStack_AsDict(PyObject **values, PyObject *kwnames)
|
||||||
return kwdict;
|
return kwdict;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject **
|
int
|
||||||
_PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs,
|
_PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs,
|
||||||
PyObject **p_kwnames, PyObject *func)
|
PyObject ***p_stack, PyObject **p_kwnames)
|
||||||
{
|
{
|
||||||
PyObject **stack, **kwstack;
|
PyObject **stack, **kwstack;
|
||||||
Py_ssize_t nkwargs;
|
Py_ssize_t nkwargs;
|
||||||
|
@ -2434,25 +2499,26 @@ _PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs,
|
||||||
assert(kwargs == NULL || PyDict_CheckExact(kwargs));
|
assert(kwargs == NULL || PyDict_CheckExact(kwargs));
|
||||||
|
|
||||||
if (kwargs == NULL || (nkwargs = PyDict_GET_SIZE(kwargs)) == 0) {
|
if (kwargs == NULL || (nkwargs = PyDict_GET_SIZE(kwargs)) == 0) {
|
||||||
|
*p_stack = args;
|
||||||
*p_kwnames = NULL;
|
*p_kwnames = NULL;
|
||||||
return args;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)nargs > PY_SSIZE_T_MAX / sizeof(stack[0]) - (size_t)nkwargs) {
|
if ((size_t)nargs > PY_SSIZE_T_MAX / sizeof(stack[0]) - (size_t)nkwargs) {
|
||||||
PyErr_NoMemory();
|
PyErr_NoMemory();
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack = PyMem_Malloc((nargs + nkwargs) * sizeof(stack[0]));
|
stack = PyMem_Malloc((nargs + nkwargs) * sizeof(stack[0]));
|
||||||
if (stack == NULL) {
|
if (stack == NULL) {
|
||||||
PyErr_NoMemory();
|
PyErr_NoMemory();
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
kwnames = PyTuple_New(nkwargs);
|
kwnames = PyTuple_New(nkwargs);
|
||||||
if (kwnames == NULL) {
|
if (kwnames == NULL) {
|
||||||
PyMem_Free(stack);
|
PyMem_Free(stack);
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy position arguments (borrowed references) */
|
/* Copy position arguments (borrowed references) */
|
||||||
|
@ -2471,20 +2537,26 @@ _PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs,
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*p_stack = stack;
|
||||||
*p_kwnames = kwnames;
|
*p_kwnames = kwnames;
|
||||||
return stack;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs,
|
_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs,
|
||||||
PyObject *kwnames)
|
PyObject *kwnames)
|
||||||
{
|
{
|
||||||
|
/* _PyObject_FastCallKeywords() must not be called with an exception set,
|
||||||
|
because it can clear it (directly or indirectly) and so the
|
||||||
|
caller loses its exception */
|
||||||
|
assert(!PyErr_Occurred());
|
||||||
|
|
||||||
assert(nargs >= 0);
|
assert(nargs >= 0);
|
||||||
assert(kwnames == NULL || PyTuple_CheckExact(kwnames));
|
assert(kwnames == NULL || PyTuple_CheckExact(kwnames));
|
||||||
|
|
||||||
/* kwnames must only contains str strings, no subclass, and all keys must
|
/* kwnames must only contains str strings, no subclass, and all keys must
|
||||||
be unique: these checks are implemented in Python/ceval.c and
|
be unique: these checks are implemented in Python/ceval.c and
|
||||||
_PyArg_ParseStack(). */
|
_PyArg_ParseStackAndKeywords(). */
|
||||||
|
|
||||||
if (PyFunction_Check(callable)) {
|
if (PyFunction_Check(callable)) {
|
||||||
return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames);
|
return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames);
|
||||||
|
@ -2497,47 +2569,48 @@ _PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t narg
|
||||||
temporary dictionary for keyword arguments (if any) */
|
temporary dictionary for keyword arguments (if any) */
|
||||||
|
|
||||||
ternaryfunc call;
|
ternaryfunc call;
|
||||||
PyObject *argtuple;
|
PyObject *argstuple;
|
||||||
PyObject *kwdict, *result;
|
PyObject *kwdict, *result;
|
||||||
Py_ssize_t nkwargs;
|
Py_ssize_t nkwargs;
|
||||||
|
|
||||||
result = NULL;
|
|
||||||
nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
|
nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
|
||||||
assert((nargs == 0 && nkwargs == 0) || stack != NULL);
|
assert((nargs == 0 && nkwargs == 0) || stack != NULL);
|
||||||
|
|
||||||
if (Py_EnterRecursiveCall(" while calling a Python object")) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
call = callable->ob_type->tp_call;
|
call = callable->ob_type->tp_call;
|
||||||
if (call == NULL) {
|
if (call == NULL) {
|
||||||
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable",
|
||||||
callable->ob_type->tp_name);
|
callable->ob_type->tp_name);
|
||||||
goto exit;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
argtuple = _PyStack_AsTuple(stack, nargs);
|
argstuple = _PyStack_AsTuple(stack, nargs);
|
||||||
if (argtuple == NULL) {
|
if (argstuple == NULL) {
|
||||||
goto exit;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nkwargs > 0) {
|
if (nkwargs > 0) {
|
||||||
kwdict = _PyStack_AsDict(stack + nargs, kwnames);
|
kwdict = _PyStack_AsDict(stack + nargs, kwnames);
|
||||||
if (kwdict == NULL) {
|
if (kwdict == NULL) {
|
||||||
Py_DECREF(argtuple);
|
Py_DECREF(argstuple);
|
||||||
goto exit;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
kwdict = NULL;
|
kwdict = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*call)(callable, argtuple, kwdict);
|
if (Py_EnterRecursiveCall(" while calling a Python object")) {
|
||||||
Py_DECREF(argtuple);
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*call)(callable, argstuple, kwdict);
|
||||||
|
|
||||||
|
Py_LeaveRecursiveCall();
|
||||||
|
|
||||||
|
Py_DECREF(argstuple);
|
||||||
Py_XDECREF(kwdict);
|
Py_XDECREF(kwdict);
|
||||||
|
|
||||||
exit:
|
result = _Py_CheckFunctionResult(callable, result, NULL);
|
||||||
Py_LeaveRecursiveCall();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2561,10 +2634,10 @@ _PyObject_CallFunctionVa(PyObject *callable, const char *format,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_size_t) {
|
if (is_size_t) {
|
||||||
stack = _Py_VaBuildStack(small_stack, small_stack_len, format, va, &nargs);
|
stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, format, va, &nargs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, format, va, &nargs);
|
stack = _Py_VaBuildStack(small_stack, small_stack_len, format, va, &nargs);
|
||||||
}
|
}
|
||||||
if (stack == NULL) {
|
if (stack == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Python 3 │
|
|
||||||
│ https://docs.python.org/3/license.html │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
@ -74,7 +67,7 @@ bytearray_translate(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
PyObject *table;
|
PyObject *table;
|
||||||
PyObject *deletechars = NULL;
|
PyObject *deletechars = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&table, &deletechars)) {
|
&table, &deletechars)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -96,22 +89,26 @@ PyDoc_STRVAR(bytearray_maketrans__doc__,
|
||||||
"The bytes objects frm and to must be of the same length.");
|
"The bytes objects frm and to must be of the same length.");
|
||||||
|
|
||||||
#define BYTEARRAY_MAKETRANS_METHODDEF \
|
#define BYTEARRAY_MAKETRANS_METHODDEF \
|
||||||
{"maketrans", (PyCFunction)bytearray_maketrans, METH_VARARGS|METH_STATIC, bytearray_maketrans__doc__},
|
{"maketrans", (PyCFunction)bytearray_maketrans, METH_FASTCALL|METH_STATIC, bytearray_maketrans__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to);
|
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_maketrans(void *null, PyObject *args)
|
bytearray_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer frm = {NULL, NULL};
|
Py_buffer frm = {NULL, NULL};
|
||||||
Py_buffer to = {NULL, NULL};
|
Py_buffer to = {NULL, NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*y*:maketrans",
|
if (!_PyArg_ParseStack(args, nargs, "y*y*:maketrans",
|
||||||
&frm, &to)) {
|
&frm, &to)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytearray_maketrans_impl(&frm, &to);
|
return_value = bytearray_maketrans_impl(&frm, &to);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -141,24 +138,28 @@ PyDoc_STRVAR(bytearray_replace__doc__,
|
||||||
"replaced.");
|
"replaced.");
|
||||||
|
|
||||||
#define BYTEARRAY_REPLACE_METHODDEF \
|
#define BYTEARRAY_REPLACE_METHODDEF \
|
||||||
{"replace", (PyCFunction)bytearray_replace, METH_VARARGS, bytearray_replace__doc__},
|
{"replace", (PyCFunction)bytearray_replace, METH_FASTCALL, bytearray_replace__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_replace_impl(PyByteArrayObject *self, Py_buffer *old,
|
bytearray_replace_impl(PyByteArrayObject *self, Py_buffer *old,
|
||||||
Py_buffer *new, Py_ssize_t count);
|
Py_buffer *new, Py_ssize_t count);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_replace(PyByteArrayObject *self, PyObject *args)
|
bytearray_replace(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer old = {NULL, NULL};
|
Py_buffer old = {NULL, NULL};
|
||||||
Py_buffer new = {NULL, NULL};
|
Py_buffer new = {NULL, NULL};
|
||||||
Py_ssize_t count = -1;
|
Py_ssize_t count = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*y*|n:replace",
|
if (!_PyArg_ParseStack(args, nargs, "y*y*|n:replace",
|
||||||
&old, &new, &count)) {
|
&old, &new, &count)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("replace", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytearray_replace_impl(self, &old, &new, count);
|
return_value = bytearray_replace_impl(self, &old, &new, count);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -204,7 +205,7 @@ bytearray_split(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyOb
|
||||||
PyObject *sep = Py_None;
|
PyObject *sep = Py_None;
|
||||||
Py_ssize_t maxsplit = -1;
|
Py_ssize_t maxsplit = -1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&sep, &maxsplit)) {
|
&sep, &maxsplit)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -279,7 +280,7 @@ bytearray_rsplit(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyO
|
||||||
PyObject *sep = Py_None;
|
PyObject *sep = Py_None;
|
||||||
Py_ssize_t maxsplit = -1;
|
Py_ssize_t maxsplit = -1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&sep, &maxsplit)) {
|
&sep, &maxsplit)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -319,22 +320,26 @@ PyDoc_STRVAR(bytearray_insert__doc__,
|
||||||
" The item to be inserted.");
|
" The item to be inserted.");
|
||||||
|
|
||||||
#define BYTEARRAY_INSERT_METHODDEF \
|
#define BYTEARRAY_INSERT_METHODDEF \
|
||||||
{"insert", (PyCFunction)bytearray_insert, METH_VARARGS, bytearray_insert__doc__},
|
{"insert", (PyCFunction)bytearray_insert, METH_FASTCALL, bytearray_insert__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item);
|
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_insert(PyByteArrayObject *self, PyObject *args)
|
bytearray_insert(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t index;
|
Py_ssize_t index;
|
||||||
int item;
|
int item;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "nO&:insert",
|
if (!_PyArg_ParseStack(args, nargs, "nO&:insert",
|
||||||
&index, _getbytevalue, &item)) {
|
&index, _getbytevalue, &item)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytearray_insert_impl(self, index, item);
|
return_value = bytearray_insert_impl(self, index, item);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -396,21 +401,25 @@ PyDoc_STRVAR(bytearray_pop__doc__,
|
||||||
"If no index argument is given, will pop the last item.");
|
"If no index argument is given, will pop the last item.");
|
||||||
|
|
||||||
#define BYTEARRAY_POP_METHODDEF \
|
#define BYTEARRAY_POP_METHODDEF \
|
||||||
{"pop", (PyCFunction)bytearray_pop, METH_VARARGS, bytearray_pop__doc__},
|
{"pop", (PyCFunction)bytearray_pop, METH_FASTCALL, bytearray_pop__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index);
|
bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_pop(PyByteArrayObject *self, PyObject *args)
|
bytearray_pop(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_ssize_t index = -1;
|
Py_ssize_t index = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|n:pop",
|
if (!_PyArg_ParseStack(args, nargs, "|n:pop",
|
||||||
&index)) {
|
&index)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("pop", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytearray_pop_impl(self, index);
|
return_value = bytearray_pop_impl(self, index);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -456,22 +465,26 @@ PyDoc_STRVAR(bytearray_strip__doc__,
|
||||||
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
|
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
|
||||||
|
|
||||||
#define BYTEARRAY_STRIP_METHODDEF \
|
#define BYTEARRAY_STRIP_METHODDEF \
|
||||||
{"strip", (PyCFunction)bytearray_strip, METH_VARARGS, bytearray_strip__doc__},
|
{"strip", (PyCFunction)bytearray_strip, METH_FASTCALL, bytearray_strip__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes);
|
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_strip(PyByteArrayObject *self, PyObject *args)
|
bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *bytes = Py_None;
|
PyObject *bytes = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "strip",
|
if (!_PyArg_UnpackStack(args, nargs, "strip",
|
||||||
0, 1,
|
0, 1,
|
||||||
&bytes)) {
|
&bytes)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("strip", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytearray_strip_impl(self, bytes);
|
return_value = bytearray_strip_impl(self, bytes);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -487,22 +500,26 @@ PyDoc_STRVAR(bytearray_lstrip__doc__,
|
||||||
"If the argument is omitted or None, strip leading ASCII whitespace.");
|
"If the argument is omitted or None, strip leading ASCII whitespace.");
|
||||||
|
|
||||||
#define BYTEARRAY_LSTRIP_METHODDEF \
|
#define BYTEARRAY_LSTRIP_METHODDEF \
|
||||||
{"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, bytearray_lstrip__doc__},
|
{"lstrip", (PyCFunction)bytearray_lstrip, METH_FASTCALL, bytearray_lstrip__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes);
|
bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_lstrip(PyByteArrayObject *self, PyObject *args)
|
bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *bytes = Py_None;
|
PyObject *bytes = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "lstrip",
|
if (!_PyArg_UnpackStack(args, nargs, "lstrip",
|
||||||
0, 1,
|
0, 1,
|
||||||
&bytes)) {
|
&bytes)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytearray_lstrip_impl(self, bytes);
|
return_value = bytearray_lstrip_impl(self, bytes);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -518,22 +535,26 @@ PyDoc_STRVAR(bytearray_rstrip__doc__,
|
||||||
"If the argument is omitted or None, strip trailing ASCII whitespace.");
|
"If the argument is omitted or None, strip trailing ASCII whitespace.");
|
||||||
|
|
||||||
#define BYTEARRAY_RSTRIP_METHODDEF \
|
#define BYTEARRAY_RSTRIP_METHODDEF \
|
||||||
{"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, bytearray_rstrip__doc__},
|
{"rstrip", (PyCFunction)bytearray_rstrip, METH_FASTCALL, bytearray_rstrip__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes);
|
bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_rstrip(PyByteArrayObject *self, PyObject *args)
|
bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *bytes = Py_None;
|
PyObject *bytes = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "rstrip",
|
if (!_PyArg_UnpackStack(args, nargs, "rstrip",
|
||||||
0, 1,
|
0, 1,
|
||||||
&bytes)) {
|
&bytes)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytearray_rstrip_impl(self, bytes);
|
return_value = bytearray_rstrip_impl(self, bytes);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -571,7 +592,7 @@ bytearray_decode(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyO
|
||||||
const char *encoding = NULL;
|
const char *encoding = NULL;
|
||||||
const char *errors = NULL;
|
const char *errors = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&encoding, &errors)) {
|
&encoding, &errors)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -617,7 +638,7 @@ bytearray_splitlines(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0};
|
static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0};
|
||||||
int keepends = 0;
|
int keepends = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&keepends)) {
|
&keepends)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -682,21 +703,25 @@ PyDoc_STRVAR(bytearray_reduce_ex__doc__,
|
||||||
"Return state information for pickling.");
|
"Return state information for pickling.");
|
||||||
|
|
||||||
#define BYTEARRAY_REDUCE_EX_METHODDEF \
|
#define BYTEARRAY_REDUCE_EX_METHODDEF \
|
||||||
{"__reduce_ex__", (PyCFunction)bytearray_reduce_ex, METH_VARARGS, bytearray_reduce_ex__doc__},
|
{"__reduce_ex__", (PyCFunction)bytearray_reduce_ex, METH_FASTCALL, bytearray_reduce_ex__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto);
|
bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytearray_reduce_ex(PyByteArrayObject *self, PyObject *args)
|
bytearray_reduce_ex(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
int proto = 0;
|
int proto = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|i:__reduce_ex__",
|
if (!_PyArg_ParseStack(args, nargs, "|i:__reduce_ex__",
|
||||||
&proto)) {
|
&proto)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("__reduce_ex__", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytearray_reduce_ex_impl(self, proto);
|
return_value = bytearray_reduce_ex_impl(self, proto);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -720,4 +745,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
return bytearray_sizeof_impl(self);
|
return bytearray_sizeof_impl(self);
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=8f022100f059226c input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=c1b1b83b0e19df74 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Python 3 │
|
|
||||||
│ https://docs.python.org/3/license.html │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
@ -39,7 +32,7 @@ bytes_split(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kw
|
||||||
PyObject *sep = Py_None;
|
PyObject *sep = Py_None;
|
||||||
Py_ssize_t maxsplit = -1;
|
Py_ssize_t maxsplit = -1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&sep, &maxsplit)) {
|
&sep, &maxsplit)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +151,7 @@ bytes_rsplit(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *k
|
||||||
PyObject *sep = Py_None;
|
PyObject *sep = Py_None;
|
||||||
Py_ssize_t maxsplit = -1;
|
Py_ssize_t maxsplit = -1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&sep, &maxsplit)) {
|
&sep, &maxsplit)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -192,22 +185,26 @@ PyDoc_STRVAR(bytes_strip__doc__,
|
||||||
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
|
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
|
||||||
|
|
||||||
#define BYTES_STRIP_METHODDEF \
|
#define BYTES_STRIP_METHODDEF \
|
||||||
{"strip", (PyCFunction)bytes_strip, METH_VARARGS, bytes_strip__doc__},
|
{"strip", (PyCFunction)bytes_strip, METH_FASTCALL, bytes_strip__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
|
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_strip(PyBytesObject *self, PyObject *args)
|
bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *bytes = Py_None;
|
PyObject *bytes = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "strip",
|
if (!_PyArg_UnpackStack(args, nargs, "strip",
|
||||||
0, 1,
|
0, 1,
|
||||||
&bytes)) {
|
&bytes)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("strip", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytes_strip_impl(self, bytes);
|
return_value = bytes_strip_impl(self, bytes);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -223,22 +220,26 @@ PyDoc_STRVAR(bytes_lstrip__doc__,
|
||||||
"If the argument is omitted or None, strip leading ASCII whitespace.");
|
"If the argument is omitted or None, strip leading ASCII whitespace.");
|
||||||
|
|
||||||
#define BYTES_LSTRIP_METHODDEF \
|
#define BYTES_LSTRIP_METHODDEF \
|
||||||
{"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, bytes_lstrip__doc__},
|
{"lstrip", (PyCFunction)bytes_lstrip, METH_FASTCALL, bytes_lstrip__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
|
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_lstrip(PyBytesObject *self, PyObject *args)
|
bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *bytes = Py_None;
|
PyObject *bytes = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "lstrip",
|
if (!_PyArg_UnpackStack(args, nargs, "lstrip",
|
||||||
0, 1,
|
0, 1,
|
||||||
&bytes)) {
|
&bytes)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytes_lstrip_impl(self, bytes);
|
return_value = bytes_lstrip_impl(self, bytes);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -254,22 +255,26 @@ PyDoc_STRVAR(bytes_rstrip__doc__,
|
||||||
"If the argument is omitted or None, strip trailing ASCII whitespace.");
|
"If the argument is omitted or None, strip trailing ASCII whitespace.");
|
||||||
|
|
||||||
#define BYTES_RSTRIP_METHODDEF \
|
#define BYTES_RSTRIP_METHODDEF \
|
||||||
{"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, bytes_rstrip__doc__},
|
{"rstrip", (PyCFunction)bytes_rstrip, METH_FASTCALL, bytes_rstrip__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
|
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_rstrip(PyBytesObject *self, PyObject *args)
|
bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *bytes = Py_None;
|
PyObject *bytes = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "rstrip",
|
if (!_PyArg_UnpackStack(args, nargs, "rstrip",
|
||||||
0, 1,
|
0, 1,
|
||||||
&bytes)) {
|
&bytes)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytes_rstrip_impl(self, bytes);
|
return_value = bytes_rstrip_impl(self, bytes);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -304,7 +309,7 @@ bytes_translate(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject
|
||||||
PyObject *table;
|
PyObject *table;
|
||||||
PyObject *deletechars = NULL;
|
PyObject *deletechars = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&table, &deletechars)) {
|
&table, &deletechars)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -326,22 +331,26 @@ PyDoc_STRVAR(bytes_maketrans__doc__,
|
||||||
"The bytes objects frm and to must be of the same length.");
|
"The bytes objects frm and to must be of the same length.");
|
||||||
|
|
||||||
#define BYTES_MAKETRANS_METHODDEF \
|
#define BYTES_MAKETRANS_METHODDEF \
|
||||||
{"maketrans", (PyCFunction)bytes_maketrans, METH_VARARGS|METH_STATIC, bytes_maketrans__doc__},
|
{"maketrans", (PyCFunction)bytes_maketrans, METH_FASTCALL|METH_STATIC, bytes_maketrans__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to);
|
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_maketrans(void *null, PyObject *args)
|
bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer frm = {NULL, NULL};
|
Py_buffer frm = {NULL, NULL};
|
||||||
Py_buffer to = {NULL, NULL};
|
Py_buffer to = {NULL, NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*y*:maketrans",
|
if (!_PyArg_ParseStack(args, nargs, "y*y*:maketrans",
|
||||||
&frm, &to)) {
|
&frm, &to)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytes_maketrans_impl(&frm, &to);
|
return_value = bytes_maketrans_impl(&frm, &to);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -371,24 +380,28 @@ PyDoc_STRVAR(bytes_replace__doc__,
|
||||||
"replaced.");
|
"replaced.");
|
||||||
|
|
||||||
#define BYTES_REPLACE_METHODDEF \
|
#define BYTES_REPLACE_METHODDEF \
|
||||||
{"replace", (PyCFunction)bytes_replace, METH_VARARGS, bytes_replace__doc__},
|
{"replace", (PyCFunction)bytes_replace, METH_FASTCALL, bytes_replace__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_replace_impl(PyBytesObject *self, Py_buffer *old, Py_buffer *new,
|
bytes_replace_impl(PyBytesObject *self, Py_buffer *old, Py_buffer *new,
|
||||||
Py_ssize_t count);
|
Py_ssize_t count);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bytes_replace(PyBytesObject *self, PyObject *args)
|
bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
Py_buffer old = {NULL, NULL};
|
Py_buffer old = {NULL, NULL};
|
||||||
Py_buffer new = {NULL, NULL};
|
Py_buffer new = {NULL, NULL};
|
||||||
Py_ssize_t count = -1;
|
Py_ssize_t count = -1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "y*y*|n:replace",
|
if (!_PyArg_ParseStack(args, nargs, "y*y*|n:replace",
|
||||||
&old, &new, &count)) {
|
&old, &new, &count)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("replace", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = bytes_replace_impl(self, &old, &new, count);
|
return_value = bytes_replace_impl(self, &old, &new, count);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -435,7 +448,7 @@ bytes_decode(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *k
|
||||||
const char *encoding = NULL;
|
const char *encoding = NULL;
|
||||||
const char *errors = NULL;
|
const char *errors = NULL;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&encoding, &errors)) {
|
&encoding, &errors)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -468,7 +481,7 @@ bytes_splitlines(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObjec
|
||||||
static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0};
|
static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0};
|
||||||
int keepends = 0;
|
int keepends = 0;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&keepends)) {
|
&keepends)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -507,4 +520,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=4ac7e35150d47467 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=debf785947e0eec2 input=a9049054013a1b77]*/
|
||||||
|
|
69
third_party/python/Objects/clinic/dictobject.inc
vendored
69
third_party/python/Objects/clinic/dictobject.inc
vendored
|
@ -1,49 +1,48 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Python 3 │
|
|
||||||
│ https://docs.python.org/3/license.html │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
|
||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(dict_fromkeys__doc__,
|
||||||
dict_fromkeys__doc__,
|
"fromkeys($type, iterable, value=None, /)\n"
|
||||||
"fromkeys($type, iterable, value=None, /)\n"
|
"--\n"
|
||||||
"--\n"
|
"\n"
|
||||||
"\n"
|
"Returns a new dict with keys from iterable and values equal to value.");
|
||||||
"Returns a new dict with keys from iterable and values equal to value.");
|
|
||||||
|
|
||||||
#define DICT_FROMKEYS_METHODDEF \
|
#define DICT_FROMKEYS_METHODDEF \
|
||||||
{"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS | METH_CLASS, \
|
{"fromkeys", (PyCFunction)dict_fromkeys, METH_FASTCALL|METH_CLASS, dict_fromkeys__doc__},
|
||||||
dict_fromkeys__doc__},
|
|
||||||
|
|
||||||
static PyObject *dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable,
|
static PyObject *
|
||||||
PyObject *value);
|
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
|
||||||
|
|
||||||
static PyObject *dict_fromkeys(PyTypeObject *type, PyObject *args) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
PyObject *iterable;
|
{
|
||||||
PyObject *value = Py_None;
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *iterable;
|
||||||
|
PyObject *value = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "fromkeys", 1, 2, &iterable, &value)) {
|
if (!_PyArg_UnpackStack(args, nargs, "fromkeys",
|
||||||
goto exit;
|
1, 2,
|
||||||
}
|
&iterable, &value)) {
|
||||||
return_value = dict_fromkeys_impl(type, iterable, value);
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("fromkeys", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = dict_fromkeys_impl(type, iterable, value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(dict___contains____doc__, "__contains__($self, key, /)\n"
|
PyDoc_STRVAR(dict___contains____doc__,
|
||||||
"--\n"
|
"__contains__($self, key, /)\n"
|
||||||
"\n"
|
"--\n"
|
||||||
"True if D has a key k, else False.");
|
"\n"
|
||||||
|
"True if D has a key k, else False.");
|
||||||
|
|
||||||
#define DICT___CONTAINS___METHODDEF \
|
#define DICT___CONTAINS___METHODDEF \
|
||||||
{"__contains__", (PyCFunction)dict___contains__, METH_O | METH_COEXIST, \
|
{"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
|
||||||
dict___contains____doc__},
|
/*[clinic end generated code: output=69f3d767ed44e8ec input=a9049054013a1b77]*/
|
||||||
/*[clinic end generated code: output=926326109e3d9839 input=a9049054013a1b77]*/
|
|
||||||
|
|
136
third_party/python/Objects/clinic/odictobject.inc
vendored
Normal file
136
third_party/python/Objects/clinic/odictobject.inc
vendored
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
/* clang-format off */
|
||||||
|
/*[clinic input]
|
||||||
|
preserve
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
|
PyDoc_STRVAR(OrderedDict_fromkeys__doc__,
|
||||||
|
"fromkeys($type, /, iterable, value=None)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"New ordered dictionary with keys from S.\n"
|
||||||
|
"\n"
|
||||||
|
"If not specified, the value defaults to None.");
|
||||||
|
|
||||||
|
#define ORDEREDDICT_FROMKEYS_METHODDEF \
|
||||||
|
{"fromkeys", (PyCFunction)OrderedDict_fromkeys, METH_FASTCALL|METH_CLASS, OrderedDict_fromkeys__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
OrderedDict_fromkeys_impl(PyTypeObject *type, PyObject *seq, PyObject *value);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
OrderedDict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
static const char * const _keywords[] = {"iterable", "value", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"O|O:fromkeys", _keywords, 0};
|
||||||
|
PyObject *seq;
|
||||||
|
PyObject *value = Py_None;
|
||||||
|
|
||||||
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
|
&seq, &value)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = OrderedDict_fromkeys_impl(type, seq, value);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(OrderedDict_setdefault__doc__,
|
||||||
|
"setdefault($self, /, key, default=None)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"od.get(k,d), also set od[k]=d if k not in od.");
|
||||||
|
|
||||||
|
#define ORDEREDDICT_SETDEFAULT_METHODDEF \
|
||||||
|
{"setdefault", (PyCFunction)OrderedDict_setdefault, METH_FASTCALL, OrderedDict_setdefault__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||||
|
PyObject *failobj);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
OrderedDict_setdefault(PyODictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
static const char * const _keywords[] = {"key", "default", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
|
||||||
|
PyObject *key;
|
||||||
|
PyObject *failobj = Py_None;
|
||||||
|
|
||||||
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
|
&key, &failobj)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = OrderedDict_setdefault_impl(self, key, failobj);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(OrderedDict_popitem__doc__,
|
||||||
|
"popitem($self, /, last=True)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"Return (k, v) and remove a (key, value) pair.\n"
|
||||||
|
"\n"
|
||||||
|
"Pairs are returned in LIFO order if last is true or FIFO order if false.");
|
||||||
|
|
||||||
|
#define ORDEREDDICT_POPITEM_METHODDEF \
|
||||||
|
{"popitem", (PyCFunction)OrderedDict_popitem, METH_FASTCALL, OrderedDict_popitem__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
OrderedDict_popitem_impl(PyODictObject *self, int last);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
OrderedDict_popitem(PyODictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
static const char * const _keywords[] = {"last", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"|p:popitem", _keywords, 0};
|
||||||
|
int last = 1;
|
||||||
|
|
||||||
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
|
&last)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = OrderedDict_popitem_impl(self, last);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDoc_STRVAR(OrderedDict_move_to_end__doc__,
|
||||||
|
"move_to_end($self, /, key, last=True)\n"
|
||||||
|
"--\n"
|
||||||
|
"\n"
|
||||||
|
"\"Move an existing element to the end (or beginning if last==False).\n"
|
||||||
|
"\n"
|
||||||
|
" Raises KeyError if the element does not exist.\n"
|
||||||
|
" When last=True, acts like a fast version of self[key]=self.pop(key).");
|
||||||
|
|
||||||
|
#define ORDEREDDICT_MOVE_TO_END_METHODDEF \
|
||||||
|
{"move_to_end", (PyCFunction)OrderedDict_move_to_end, METH_FASTCALL, OrderedDict_move_to_end__doc__},
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
OrderedDict_move_to_end_impl(PyODictObject *self, PyObject *key, int last);
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
OrderedDict_move_to_end(PyODictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
static const char * const _keywords[] = {"key", "last", NULL};
|
||||||
|
static _PyArg_Parser _parser = {"O|p:move_to_end", _keywords, 0};
|
||||||
|
PyObject *key;
|
||||||
|
int last = 1;
|
||||||
|
|
||||||
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
|
&key, &last)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = OrderedDict_move_to_end_impl(self, key, last);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
/*[clinic end generated code: output=f2641e1277045b59 input=a9049054013a1b77]*/
|
|
@ -1,11 +1,4 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Python 3 │
|
|
||||||
│ https://docs.python.org/3/license.html │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
@ -25,26 +18,30 @@ PyDoc_STRVAR(unicode_maketrans__doc__,
|
||||||
"must be a string, whose characters will be mapped to None in the result.");
|
"must be a string, whose characters will be mapped to None in the result.");
|
||||||
|
|
||||||
#define UNICODE_MAKETRANS_METHODDEF \
|
#define UNICODE_MAKETRANS_METHODDEF \
|
||||||
{"maketrans", (PyCFunction)unicode_maketrans, METH_VARARGS|METH_STATIC, unicode_maketrans__doc__},
|
{"maketrans", (PyCFunction)unicode_maketrans, METH_FASTCALL|METH_STATIC, unicode_maketrans__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
|
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
unicode_maketrans(void *null, PyObject *args)
|
unicode_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *x;
|
PyObject *x;
|
||||||
PyObject *y = NULL;
|
PyObject *y = NULL;
|
||||||
PyObject *z = NULL;
|
PyObject *z = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|UU:maketrans",
|
if (!_PyArg_ParseStack(args, nargs, "O|UU:maketrans",
|
||||||
&x, &y, &z)) {
|
&x, &y, &z)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = unicode_maketrans_impl(x, y, z);
|
return_value = unicode_maketrans_impl(x, y, z);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=4a86dd108d92d104 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=af4804dbf21463b5 input=a9049054013a1b77]*/
|
||||||
|
|
20
third_party/python/Objects/descrobject.c
vendored
20
third_party/python/Objects/descrobject.c
vendored
|
@ -228,15 +228,15 @@ getset_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds)
|
methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
Py_ssize_t argc;
|
Py_ssize_t nargs;
|
||||||
PyObject *self, *func, *result, **stack;
|
PyObject *self, *result;
|
||||||
|
|
||||||
/* Make sure that the first argument is acceptable as 'self' */
|
/* Make sure that the first argument is acceptable as 'self' */
|
||||||
assert(PyTuple_Check(args));
|
assert(PyTuple_Check(args));
|
||||||
argc = PyTuple_GET_SIZE(args);
|
nargs = PyTuple_GET_SIZE(args);
|
||||||
if (argc < 1) {
|
if (nargs < 1) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"descriptor '%V' of '%.100s' "
|
"descriptor '%V' of '%.100s' "
|
||||||
"object needs an argument",
|
"object needs an argument",
|
||||||
|
@ -257,12 +257,10 @@ methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
func = PyCFunction_NewEx(descr->d_method, self, NULL);
|
result = _PyMethodDef_RawFastCallDict(descr->d_method, self,
|
||||||
if (func == NULL)
|
&PyTuple_GET_ITEM(args, 1), nargs - 1,
|
||||||
return NULL;
|
kwargs);
|
||||||
stack = &PyTuple_GET_ITEM(args, 1);
|
result = _Py_CheckFunctionResult((PyObject *)descr, result, NULL);
|
||||||
result = _PyObject_FastCallDict(func, stack, argc - 1, kwds);
|
|
||||||
Py_DECREF(func);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
99
third_party/python/Objects/dictobject.c
vendored
99
third_party/python/Objects/dictobject.c
vendored
|
@ -638,6 +638,51 @@ new_dict_with_shared_keys(PyDictKeysObject *keys)
|
||||||
return new_dict(keys, values);
|
return new_dict(keys, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
clone_combined_dict(PyDictObject *orig)
|
||||||
|
{
|
||||||
|
assert(PyDict_CheckExact(orig));
|
||||||
|
assert(orig->ma_values == NULL);
|
||||||
|
assert(orig->ma_keys->dk_refcnt == 1);
|
||||||
|
|
||||||
|
Py_ssize_t keys_size = _PyDict_KeysSize(orig->ma_keys);
|
||||||
|
PyDictKeysObject *keys = PyObject_Malloc(keys_size);
|
||||||
|
if (keys == NULL) {
|
||||||
|
PyErr_NoMemory();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(keys, orig->ma_keys, keys_size);
|
||||||
|
|
||||||
|
/* After copying key/value pairs, we need to incref all
|
||||||
|
keys and values and they are about to be co-owned by a
|
||||||
|
new dict object. */
|
||||||
|
PyDictKeyEntry *ep0 = DK_ENTRIES(keys);
|
||||||
|
Py_ssize_t n = keys->dk_nentries;
|
||||||
|
for (Py_ssize_t i = 0; i < n; i++) {
|
||||||
|
PyDictKeyEntry *entry = &ep0[i];
|
||||||
|
PyObject *value = entry->me_value;
|
||||||
|
if (value != NULL) {
|
||||||
|
Py_INCREF(value);
|
||||||
|
Py_INCREF(entry->me_key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PyDictObject *new = (PyDictObject *)new_dict(keys, NULL);
|
||||||
|
if (new == NULL) {
|
||||||
|
/* In case of an error, `new_dict()` takes care of
|
||||||
|
cleaning up `keys`. */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
new->ma_used = orig->ma_used;
|
||||||
|
assert(_PyDict_CheckConsistency(new));
|
||||||
|
if (_PyObject_GC_IS_TRACKED(orig)) {
|
||||||
|
/* Maintain tracking. */
|
||||||
|
_PyObject_GC_TRACK(new);
|
||||||
|
}
|
||||||
|
return (PyObject *)new;
|
||||||
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyDict_New(void)
|
PyDict_New(void)
|
||||||
{
|
{
|
||||||
|
@ -2656,6 +2701,12 @@ PyDict_Copy(PyObject *o)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
mp = (PyDictObject *)o;
|
mp = (PyDictObject *)o;
|
||||||
|
if (mp->ma_used == 0) {
|
||||||
|
/* The dict is empty; just return a new dict. */
|
||||||
|
return PyDict_New();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_PyDict_HasSplitTable(mp)) {
|
if (_PyDict_HasSplitTable(mp)) {
|
||||||
PyDictObject *split_copy;
|
PyDictObject *split_copy;
|
||||||
Py_ssize_t size = USABLE_FRACTION(DK_SIZE(mp->ma_keys));
|
Py_ssize_t size = USABLE_FRACTION(DK_SIZE(mp->ma_keys));
|
||||||
|
@ -2682,6 +2733,27 @@ PyDict_Copy(PyObject *o)
|
||||||
_PyObject_GC_TRACK(split_copy);
|
_PyObject_GC_TRACK(split_copy);
|
||||||
return (PyObject *)split_copy;
|
return (PyObject *)split_copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PyDict_CheckExact(mp) && mp->ma_values == NULL &&
|
||||||
|
(mp->ma_used >= (mp->ma_keys->dk_nentries * 2) / 3))
|
||||||
|
{
|
||||||
|
/* Use fast-copy if:
|
||||||
|
|
||||||
|
(1) 'mp' is an instance of a subclassed dict; and
|
||||||
|
|
||||||
|
(2) 'mp' is not a split-dict; and
|
||||||
|
|
||||||
|
(3) if 'mp' is non-compact ('del' operation does not resize dicts),
|
||||||
|
do fast-copy only if it has at most 1/3 non-used keys.
|
||||||
|
|
||||||
|
The last condition (3) is important to guard against a pathalogical
|
||||||
|
case when a large dict is almost emptied with multiple del/pop
|
||||||
|
operations and copied after that. In cases like this, we defer to
|
||||||
|
PyDict_Merge, which produces a compacted copy.
|
||||||
|
*/
|
||||||
|
return clone_combined_dict(mp);
|
||||||
|
}
|
||||||
|
|
||||||
copy = PyDict_New();
|
copy = PyDict_New();
|
||||||
if (copy == NULL)
|
if (copy == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2839,7 +2911,7 @@ dict___contains__(PyDictObject *self, PyObject *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dict_get(PyDictObject *mp, PyObject *args)
|
dict_get(PyDictObject *mp, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *key;
|
PyObject *key;
|
||||||
PyObject *failobj = Py_None;
|
PyObject *failobj = Py_None;
|
||||||
|
@ -2848,7 +2920,10 @@ dict_get(PyDictObject *mp, PyObject *args)
|
||||||
Py_ssize_t ix;
|
Py_ssize_t ix;
|
||||||
PyObject **value_addr;
|
PyObject **value_addr;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &failobj))
|
if (!_PyArg_UnpackStack(args, nargs, "get", 1, 2, &key, &failobj))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("get", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!PyUnicode_CheckExact(key) ||
|
if (!PyUnicode_CheckExact(key) ||
|
||||||
|
@ -2957,14 +3032,17 @@ PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dict_setdefault(PyDictObject *mp, PyObject *args)
|
dict_setdefault(PyDictObject *mp, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *key, *val;
|
PyObject *key, *val;
|
||||||
PyObject *defaultobj = Py_None;
|
PyObject *defaultobj = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &defaultobj))
|
if (!_PyArg_UnpackStack(args, nargs, "setdefault", 1, 2, &key, &defaultobj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if(!_PyArg_NoStackKeywords("pop", kwnames))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
val = PyDict_SetDefault((PyObject *)mp, key, defaultobj);
|
val = PyDict_SetDefault((PyObject *)mp, key, defaultobj);
|
||||||
Py_XINCREF(val);
|
Py_XINCREF(val);
|
||||||
return val;
|
return val;
|
||||||
|
@ -2978,11 +3056,14 @@ dict_clear(PyDictObject *mp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dict_pop(PyDictObject *mp, PyObject *args)
|
dict_pop(PyDictObject *mp, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *key, *deflt = NULL;
|
PyObject *key, *deflt = NULL;
|
||||||
|
|
||||||
if(!PyArg_UnpackTuple(args, "pop", 1, 2, &key, &deflt))
|
if(!_PyArg_UnpackStack(args, nargs, "pop", 1, 2, &key, &deflt))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if(!_PyArg_NoStackKeywords("pop", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return _PyDict_Pop((PyObject*)mp, key, deflt);
|
return _PyDict_Pop((PyObject*)mp, key, deflt);
|
||||||
|
@ -3171,11 +3252,11 @@ static PyMethodDef mapp_methods[] = {
|
||||||
getitem__doc__},
|
getitem__doc__},
|
||||||
{"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS,
|
{"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS,
|
||||||
sizeof__doc__},
|
sizeof__doc__},
|
||||||
{"get", (PyCFunction)dict_get, METH_VARARGS,
|
{"get", (PyCFunction)dict_get, METH_FASTCALL,
|
||||||
get__doc__},
|
get__doc__},
|
||||||
{"setdefault", (PyCFunction)dict_setdefault, METH_VARARGS,
|
{"setdefault", (PyCFunction)dict_setdefault, METH_FASTCALL,
|
||||||
setdefault_doc__},
|
setdefault_doc__},
|
||||||
{"pop", (PyCFunction)dict_pop, METH_VARARGS,
|
{"pop", (PyCFunction)dict_pop, METH_FASTCALL,
|
||||||
pop__doc__},
|
pop__doc__},
|
||||||
{"popitem", (PyCFunction)dict_popitem, METH_NOARGS,
|
{"popitem", (PyCFunction)dict_popitem, METH_NOARGS,
|
||||||
popitem__doc__},
|
popitem__doc__},
|
||||||
|
|
9
third_party/python/Objects/fileobject.c
vendored
9
third_party/python/Objects/fileobject.c
vendored
|
@ -364,7 +364,7 @@ PyFile_NewStdPrinter(int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
|
stdprinter_write(PyStdPrinter_Object *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *unicode;
|
PyObject *unicode;
|
||||||
PyObject *bytes = NULL;
|
PyObject *bytes = NULL;
|
||||||
|
@ -380,7 +380,10 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "U", &unicode))
|
if (!_PyArg_UnpackStack(args, nargs, "write", 1, 1, &unicode))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if(!_PyArg_NoStackKeywords("write", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* encode Unicode to UTF-8 */
|
/* encode Unicode to UTF-8 */
|
||||||
|
@ -452,7 +455,7 @@ static PyMethodDef stdprinter_methods[] = {
|
||||||
{"flush", (PyCFunction)stdprinter_noop, METH_NOARGS, ""},
|
{"flush", (PyCFunction)stdprinter_noop, METH_NOARGS, ""},
|
||||||
{"fileno", (PyCFunction)stdprinter_fileno, METH_NOARGS, ""},
|
{"fileno", (PyCFunction)stdprinter_fileno, METH_NOARGS, ""},
|
||||||
{"isatty", (PyCFunction)stdprinter_isatty, METH_NOARGS, ""},
|
{"isatty", (PyCFunction)stdprinter_isatty, METH_NOARGS, ""},
|
||||||
{"write", (PyCFunction)stdprinter_write, METH_VARARGS, ""},
|
{"write", (PyCFunction)stdprinter_write, METH_FASTCALL, ""},
|
||||||
{NULL, NULL} /*sentinel */
|
{NULL, NULL} /*sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
19
third_party/python/Objects/floatobject.c
vendored
19
third_party/python/Objects/floatobject.c
vendored
|
@ -1038,15 +1038,19 @@ double_round(double x, int ndigits) {
|
||||||
/* round a Python float v to the closest multiple of 10**-ndigits */
|
/* round a Python float v to the closest multiple of 10**-ndigits */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
float_round(PyObject *v, PyObject *args)
|
float_round(PyObject *v, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
double x, rounded;
|
double x, rounded;
|
||||||
PyObject *o_ndigits = NULL;
|
PyObject *o_ndigits = NULL;
|
||||||
Py_ssize_t ndigits;
|
Py_ssize_t ndigits;
|
||||||
|
|
||||||
x = PyFloat_AsDouble(v);
|
x = PyFloat_AsDouble(v);
|
||||||
if (!PyArg_ParseTuple(args, "|O", &o_ndigits))
|
if (!_PyArg_UnpackStack(args, nargs, "__round__", 0, 1, &o_ndigits))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if(!_PyArg_NoStackKeywords("__round__", kwnames))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (o_ndigits == NULL || o_ndigits == Py_None) {
|
if (o_ndigits == NULL || o_ndigits == Py_None) {
|
||||||
/* single-argument round or with None ndigits:
|
/* single-argument round or with None ndigits:
|
||||||
* round to nearest integer */
|
* round to nearest integer */
|
||||||
|
@ -1762,13 +1766,16 @@ float_getzero(PyObject *v, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
float__format__(PyObject *self, PyObject *args)
|
float__format__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *format_spec;
|
PyObject *format_spec;
|
||||||
_PyUnicodeWriter writer;
|
_PyUnicodeWriter writer;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "U:__format__", &format_spec))
|
if (!_PyArg_ParseStack(args, nargs, "U:__format__", &format_spec))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if(!_PyArg_NoStackKeywords("__format__", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
_PyUnicodeWriter_Init(&writer);
|
_PyUnicodeWriter_Init(&writer);
|
||||||
|
@ -1794,7 +1801,7 @@ static PyMethodDef float_methods[] = {
|
||||||
"Return self, the complex conjugate of any float."},
|
"Return self, the complex conjugate of any float."},
|
||||||
{"__trunc__", (PyCFunction)float_trunc, METH_NOARGS,
|
{"__trunc__", (PyCFunction)float_trunc, METH_NOARGS,
|
||||||
"Return the Integral closest to x between 0 and x."},
|
"Return the Integral closest to x between 0 and x."},
|
||||||
{"__round__", (PyCFunction)float_round, METH_VARARGS,
|
{"__round__", (PyCFunction)float_round, METH_FASTCALL,
|
||||||
"Return the Integral closest to x, rounding half toward even.\n"
|
"Return the Integral closest to x, rounding half toward even.\n"
|
||||||
"When an argument is passed, work like built-in round(x, ndigits)."},
|
"When an argument is passed, work like built-in round(x, ndigits)."},
|
||||||
{"as_integer_ratio", (PyCFunction)float_as_integer_ratio, METH_NOARGS,
|
{"as_integer_ratio", (PyCFunction)float_as_integer_ratio, METH_NOARGS,
|
||||||
|
@ -1819,7 +1826,7 @@ static PyMethodDef float_methods[] = {
|
||||||
{"__setformat__", (PyCFunction)float_setformat,
|
{"__setformat__", (PyCFunction)float_setformat,
|
||||||
METH_VARARGS|METH_CLASS, float_setformat_doc},
|
METH_VARARGS|METH_CLASS, float_setformat_doc},
|
||||||
{"__format__", (PyCFunction)float__format__,
|
{"__format__", (PyCFunction)float__format__,
|
||||||
METH_VARARGS, float__format__doc},
|
METH_FASTCALL, float__format__doc},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
14
third_party/python/Objects/listobject.c
vendored
14
third_party/python/Objects/listobject.c
vendored
|
@ -755,11 +755,12 @@ list_ass_item(PyListObject *a, Py_ssize_t i, PyObject *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
listinsert(PyListObject *self, PyObject *args)
|
listinsert(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
if (!PyArg_ParseTuple(args, "nO:insert", &i, &v))
|
if (!_PyArg_ParseStack(args, nargs, "nO:insert", &i, &v)
|
||||||
|
|| !_PyArg_NoStackKeywords("insert", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (ins1(self, i, v) == 0)
|
if (ins1(self, i, v) == 0)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
@ -920,13 +921,14 @@ list_inplace_concat(PyListObject *self, PyObject *other)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
listpop(PyListObject *self, PyObject *args)
|
listpop(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
Py_ssize_t i = -1;
|
Py_ssize_t i = -1;
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|n:pop", &i))
|
if (!_PyArg_ParseStack(args, nargs, "|n:pop", &i)
|
||||||
|
|| !_PyArg_NoStackKeywords("pop", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (Py_SIZE(self) == 0) {
|
if (Py_SIZE(self) == 0) {
|
||||||
|
@ -2384,9 +2386,9 @@ static PyMethodDef list_methods[] = {
|
||||||
{"clear", (PyCFunction)listclear, METH_NOARGS, clear_doc},
|
{"clear", (PyCFunction)listclear, METH_NOARGS, clear_doc},
|
||||||
{"copy", (PyCFunction)listcopy, METH_NOARGS, copy_doc},
|
{"copy", (PyCFunction)listcopy, METH_NOARGS, copy_doc},
|
||||||
{"append", (PyCFunction)listappend, METH_O, append_doc},
|
{"append", (PyCFunction)listappend, METH_O, append_doc},
|
||||||
{"insert", (PyCFunction)listinsert, METH_VARARGS, insert_doc},
|
{"insert", (PyCFunction)listinsert, METH_FASTCALL, insert_doc},
|
||||||
{"extend", (PyCFunction)listextend, METH_O, extend_doc},
|
{"extend", (PyCFunction)listextend, METH_O, extend_doc},
|
||||||
{"pop", (PyCFunction)listpop, METH_VARARGS, pop_doc},
|
{"pop", (PyCFunction)listpop, METH_FASTCALL, pop_doc},
|
||||||
{"remove", (PyCFunction)listremove, METH_O, remove_doc},
|
{"remove", (PyCFunction)listremove, METH_O, remove_doc},
|
||||||
{"index", (PyCFunction)listindex, METH_VARARGS, index_doc},
|
{"index", (PyCFunction)listindex, METH_VARARGS, index_doc},
|
||||||
{"count", (PyCFunction)listcount, METH_O, count_doc},
|
{"count", (PyCFunction)listcount, METH_O, count_doc},
|
||||||
|
|
12
third_party/python/Objects/longobject.c
vendored
12
third_party/python/Objects/longobject.c
vendored
|
@ -4907,13 +4907,13 @@ long_get1(PyLongObject *v, void *context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
long__format__(PyObject *self, PyObject *args)
|
long__format__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *format_spec;
|
PyObject *format_spec;
|
||||||
_PyUnicodeWriter writer;
|
_PyUnicodeWriter writer;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "U:__format__", &format_spec))
|
if (!_PyArg_ParseStack(args, nargs, "U:__format__", &format_spec))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
_PyUnicodeWriter_Init(&writer);
|
_PyUnicodeWriter_Init(&writer);
|
||||||
|
@ -5026,7 +5026,7 @@ _PyLong_DivmodNear(PyObject *a, PyObject *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
long_round(PyObject *self, PyObject *args)
|
long_round(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *o_ndigits=NULL, *temp, *result, *ndigits;
|
PyObject *o_ndigits=NULL, *temp, *result, *ndigits;
|
||||||
|
|
||||||
|
@ -5044,7 +5044,7 @@ long_round(PyObject *self, PyObject *args)
|
||||||
*
|
*
|
||||||
* m - divmod_near(m, 10**n)[1].
|
* m - divmod_near(m, 10**n)[1].
|
||||||
*/
|
*/
|
||||||
if (!PyArg_ParseTuple(args, "|O", &o_ndigits))
|
if (!_PyArg_ParseStack(args, nargs, "|O", &o_ndigits))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (o_ndigits == NULL)
|
if (o_ndigits == NULL)
|
||||||
return long_long(self);
|
return long_long(self);
|
||||||
|
@ -5368,11 +5368,11 @@ static PyMethodDef long_methods[] = {
|
||||||
"Flooring an Integral returns itself."},
|
"Flooring an Integral returns itself."},
|
||||||
{"__ceil__", (PyCFunction)long_long, METH_NOARGS,
|
{"__ceil__", (PyCFunction)long_long, METH_NOARGS,
|
||||||
"Ceiling of an Integral returns itself."},
|
"Ceiling of an Integral returns itself."},
|
||||||
{"__round__", (PyCFunction)long_round, METH_VARARGS,
|
{"__round__", (PyCFunction)long_round, METH_FASTCALL,
|
||||||
"Rounding an Integral returns itself.\n"
|
"Rounding an Integral returns itself.\n"
|
||||||
"Rounding with an ndigits argument also returns an integer."},
|
"Rounding with an ndigits argument also returns an integer."},
|
||||||
{"__getnewargs__", (PyCFunction)long_getnewargs, METH_NOARGS},
|
{"__getnewargs__", (PyCFunction)long_getnewargs, METH_NOARGS},
|
||||||
{"__format__", (PyCFunction)long__format__, METH_VARARGS},
|
{"__format__", (PyCFunction)long__format__, METH_FASTCALL},
|
||||||
{"__sizeof__", (PyCFunction)long_sizeof, METH_NOARGS,
|
{"__sizeof__", (PyCFunction)long_sizeof, METH_NOARGS,
|
||||||
"Returns size in memory, in bytes"},
|
"Returns size in memory, in bytes"},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
|
|
295
third_party/python/Objects/methodobject.c
vendored
295
third_party/python/Objects/methodobject.c
vendored
|
@ -90,117 +90,95 @@ PyCFunction_GetFlags(PyObject *op)
|
||||||
return PyCFunction_GET_FLAGS(op);
|
return PyCFunction_GET_FLAGS(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
static PyObject *
|
||||||
PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwds)
|
cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
PyCFunctionObject* f = (PyCFunctionObject*)func;
|
assert(!PyErr_Occurred());
|
||||||
|
|
||||||
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
|
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
|
||||||
PyObject *self = PyCFunction_GET_SELF(func);
|
PyObject *self = PyCFunction_GET_SELF(func);
|
||||||
PyObject *arg, *res;
|
PyObject *result;
|
||||||
Py_ssize_t size;
|
|
||||||
int flags;
|
|
||||||
|
|
||||||
assert(kwds == NULL || PyDict_Check(kwds));
|
if (PyCFunction_GET_FLAGS(func) & METH_KEYWORDS) {
|
||||||
/* PyCFunction_Call() must not be called with an exception set,
|
if (Py_EnterRecursiveCall(" while calling a Python object")) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*(PyCFunctionWithKeywords)meth)(self, args, kwargs);
|
||||||
|
|
||||||
|
Py_LeaveRecursiveCall();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (kwargs != NULL && PyDict_Size(kwargs) != 0) {
|
||||||
|
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
|
||||||
|
((PyCFunctionObject*)func)->m_ml->ml_name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Py_EnterRecursiveCall(" while calling a Python object")) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*meth)(self, args);
|
||||||
|
|
||||||
|
Py_LeaveRecursiveCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _Py_CheckFunctionResult(func, result, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PyObject *
|
||||||
|
PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwargs)
|
||||||
|
{
|
||||||
|
/* first try METH_VARARGS to pass directly args tuple unchanged.
|
||||||
|
_PyMethodDef_RawFastCallDict() creates a new temporary tuple
|
||||||
|
for METH_VARARGS. */
|
||||||
|
if (PyCFunction_GET_FLAGS(func) & METH_VARARGS) {
|
||||||
|
return cfunction_call_varargs(func, args, kwargs);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return _PyCFunction_FastCallDict(func,
|
||||||
|
&PyTuple_GET_ITEM(args, 0),
|
||||||
|
PyTuple_GET_SIZE(args),
|
||||||
|
kwargs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject *
|
||||||
|
_PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **args,
|
||||||
|
Py_ssize_t nargs, PyObject *kwargs)
|
||||||
|
{
|
||||||
|
/* _PyMethodDef_RawFastCallDict() must not be called with an exception set,
|
||||||
because it can clear it (directly or indirectly) and so the
|
because it can clear it (directly or indirectly) and so the
|
||||||
caller loses its exception */
|
caller loses its exception */
|
||||||
assert(!PyErr_Occurred());
|
assert(!PyErr_Occurred());
|
||||||
|
|
||||||
flags = PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
|
assert(method != NULL);
|
||||||
|
|
||||||
if (flags == (METH_VARARGS | METH_KEYWORDS)) {
|
|
||||||
res = (*(PyCFunctionWithKeywords)meth)(self, args, kwds);
|
|
||||||
}
|
|
||||||
else if (flags == METH_FASTCALL) {
|
|
||||||
PyObject **stack = &PyTuple_GET_ITEM(args, 0);
|
|
||||||
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
|
|
||||||
res = _PyCFunction_FastCallDict(func, stack, nargs, kwds);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (kwds != NULL && PyDict_GET_SIZE(kwds) != 0) {
|
|
||||||
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
|
|
||||||
f->m_ml->ml_name);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (flags) {
|
|
||||||
case METH_VARARGS:
|
|
||||||
res = (*meth)(self, args);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case METH_NOARGS:
|
|
||||||
size = PyTuple_GET_SIZE(args);
|
|
||||||
if (size != 0) {
|
|
||||||
PyErr_Format(PyExc_TypeError,
|
|
||||||
"%.200s() takes no arguments (%zd given)",
|
|
||||||
f->m_ml->ml_name, size);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = (*meth)(self, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case METH_O:
|
|
||||||
size = PyTuple_GET_SIZE(args);
|
|
||||||
if (size != 1) {
|
|
||||||
PyErr_Format(PyExc_TypeError,
|
|
||||||
"%.200s() takes exactly one argument (%zd given)",
|
|
||||||
f->m_ml->ml_name, size);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg = PyTuple_GET_ITEM(args, 0);
|
|
||||||
res = (*meth)(self, arg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
PyErr_SetString(PyExc_SystemError,
|
|
||||||
"Bad call flags in PyCFunction_Call. "
|
|
||||||
"METH_OLDARGS is no longer supported!");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _Py_CheckFunctionResult(func, res, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
_PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
|
|
||||||
PyObject *kwargs)
|
|
||||||
{
|
|
||||||
PyCFunctionObject *func;
|
|
||||||
PyCFunction meth;
|
|
||||||
PyObject *self;
|
|
||||||
PyObject *result;
|
|
||||||
int flags;
|
|
||||||
|
|
||||||
assert(func_obj != NULL);
|
|
||||||
assert(PyCFunction_Check(func_obj));
|
|
||||||
assert(nargs >= 0);
|
assert(nargs >= 0);
|
||||||
assert(nargs == 0 || args != NULL);
|
assert(nargs == 0 || args != NULL);
|
||||||
assert(kwargs == NULL || PyDict_Check(kwargs));
|
assert(kwargs == NULL || PyDict_Check(kwargs));
|
||||||
|
|
||||||
/* _PyCFunction_FastCallDict() must not be called with an exception set,
|
PyCFunction meth = method->ml_meth;
|
||||||
because it may clear it (directly or indirectly) and so the
|
int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
|
||||||
caller loses its exception */
|
PyObject *result = NULL;
|
||||||
assert(!PyErr_Occurred());
|
|
||||||
|
|
||||||
func = (PyCFunctionObject*)func_obj;
|
if (Py_EnterRecursiveCall(" while calling a Python object")) {
|
||||||
meth = PyCFunction_GET_FUNCTION(func);
|
return NULL;
|
||||||
self = PyCFunction_GET_SELF(func);
|
}
|
||||||
flags = PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
|
|
||||||
|
|
||||||
switch (flags)
|
switch (flags)
|
||||||
{
|
{
|
||||||
case METH_NOARGS:
|
case METH_NOARGS:
|
||||||
if (nargs != 0) {
|
if (nargs != 0) {
|
||||||
goto no_keyword_error;
|
PyErr_Format(PyExc_TypeError,
|
||||||
|
"%.200s() takes no arguments (%zd given)",
|
||||||
|
method->ml_name, nargs);
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
|
if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
|
||||||
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
|
goto no_keyword_error;
|
||||||
func->m_ml->ml_name);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*meth) (self, NULL);
|
result = (*meth) (self, NULL);
|
||||||
|
@ -210,8 +188,8 @@ _PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"%.200s() takes exactly one argument (%zd given)",
|
"%.200s() takes exactly one argument (%zd given)",
|
||||||
func->m_ml->ml_name, nargs);
|
method->ml_name, nargs);
|
||||||
return NULL;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
|
if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
|
||||||
|
@ -222,28 +200,27 @@ _PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case METH_VARARGS:
|
case METH_VARARGS:
|
||||||
case METH_VARARGS | METH_KEYWORDS:
|
|
||||||
{
|
|
||||||
/* Slow-path: create a temporary tuple for positional arguments */
|
|
||||||
PyObject *tuple;
|
|
||||||
|
|
||||||
if (!(flags & METH_KEYWORDS)
|
if (!(flags & METH_KEYWORDS)
|
||||||
&& kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
|
&& kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
|
||||||
goto no_keyword_error;
|
goto no_keyword_error;
|
||||||
}
|
}
|
||||||
|
/* fall through next case */
|
||||||
|
|
||||||
tuple = _PyStack_AsTuple(args, nargs);
|
case METH_VARARGS | METH_KEYWORDS:
|
||||||
if (tuple == NULL) {
|
{
|
||||||
return NULL;
|
/* Slow-path: create a temporary tuple for positional arguments */
|
||||||
|
PyObject *argstuple = _PyStack_AsTuple(args, nargs);
|
||||||
|
if (argstuple == NULL) {
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & METH_KEYWORDS) {
|
if (flags & METH_KEYWORDS) {
|
||||||
result = (*(PyCFunctionWithKeywords)meth) (self, tuple, kwargs);
|
result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = (*meth) (self, tuple);
|
result = (*meth) (self, argstuple);
|
||||||
}
|
}
|
||||||
Py_DECREF(tuple);
|
Py_DECREF(argstuple);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,9 +230,8 @@ _PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
|
||||||
PyObject *kwnames;
|
PyObject *kwnames;
|
||||||
_PyCFunctionFast fastmeth = (_PyCFunctionFast)meth;
|
_PyCFunctionFast fastmeth = (_PyCFunctionFast)meth;
|
||||||
|
|
||||||
stack = _PyStack_UnpackDict(args, nargs, kwargs, &kwnames, func_obj);
|
if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) {
|
||||||
if (stack == NULL) {
|
goto exit;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*fastmeth) (self, stack, nargs, kwnames);
|
result = (*fastmeth) (self, stack, nargs, kwnames);
|
||||||
|
@ -268,49 +244,62 @@ _PyCFunction_FastCallDict(PyObject *func_obj, PyObject **args, Py_ssize_t nargs,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PyErr_SetString(PyExc_SystemError,
|
PyErr_SetString(PyExc_SystemError,
|
||||||
"Bad call flags in PyCFunction_Call. "
|
"Bad call flags in _PyMethodDef_RawFastCallDict. "
|
||||||
"METH_OLDARGS is no longer supported!");
|
"METH_OLDARGS is no longer supported!");
|
||||||
return NULL;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = _Py_CheckFunctionResult(func_obj, result, NULL);
|
goto exit;
|
||||||
|
|
||||||
return result;
|
|
||||||
|
|
||||||
no_keyword_error:
|
no_keyword_error:
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"%.200s() takes no arguments (%zd given)",
|
"%.200s() takes no keyword arguments",
|
||||||
func->m_ml->ml_name, nargs);
|
method->ml_name, nargs);
|
||||||
return NULL;
|
|
||||||
|
exit:
|
||||||
|
Py_LeaveRecursiveCall();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
|
_PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
|
||||||
Py_ssize_t nargs, PyObject *kwnames)
|
PyObject *kwargs)
|
||||||
{
|
{
|
||||||
PyCFunctionObject *func;
|
PyObject *result;
|
||||||
PyCFunction meth;
|
|
||||||
PyObject *self, *result;
|
|
||||||
Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
|
|
||||||
int flags;
|
|
||||||
|
|
||||||
assert(func_obj != NULL);
|
assert(func != NULL);
|
||||||
assert(PyCFunction_Check(func_obj));
|
assert(PyCFunction_Check(func));
|
||||||
|
|
||||||
|
result = _PyMethodDef_RawFastCallDict(((PyCFunctionObject*)func)->m_ml,
|
||||||
|
PyCFunction_GET_SELF(func),
|
||||||
|
args, nargs, kwargs);
|
||||||
|
result = _Py_CheckFunctionResult(func, result, NULL);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
PyObject *
|
||||||
|
_PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject **args,
|
||||||
|
Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
/* _PyMethodDef_RawFastCallKeywords() must not be called with an exception set,
|
||||||
|
because it can clear it (directly or indirectly) and so the
|
||||||
|
caller loses its exception */
|
||||||
|
assert(!PyErr_Occurred());
|
||||||
|
|
||||||
|
assert(method != NULL);
|
||||||
assert(nargs >= 0);
|
assert(nargs >= 0);
|
||||||
assert(kwnames == NULL || PyTuple_CheckExact(kwnames));
|
assert(kwnames == NULL || PyTuple_CheckExact(kwnames));
|
||||||
assert((nargs == 0 && nkwargs == 0) || args != NULL);
|
|
||||||
/* kwnames must only contains str strings, no subclass, and all keys must
|
/* kwnames must only contains str strings, no subclass, and all keys must
|
||||||
be unique */
|
be unique */
|
||||||
|
|
||||||
/* _PyCFunction_FastCallKeywords() must not be called with an exception
|
PyCFunction meth = method->ml_meth;
|
||||||
set, because it can clear it (directly or indirectly) and so the caller
|
int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
|
||||||
loses its exception */
|
Py_ssize_t nkwargs = kwnames == NULL ? 0 : PyTuple_Size(kwnames);
|
||||||
assert(!PyErr_Occurred());
|
PyObject *result = NULL;
|
||||||
|
|
||||||
func = (PyCFunctionObject*)func_obj;
|
if (Py_EnterRecursiveCall(" while calling a Python object")) {
|
||||||
meth = PyCFunction_GET_FUNCTION(func);
|
return NULL;
|
||||||
self = PyCFunction_GET_SELF(func);
|
}
|
||||||
flags = PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
|
|
||||||
|
|
||||||
switch (flags)
|
switch (flags)
|
||||||
{
|
{
|
||||||
|
@ -318,8 +307,8 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
|
||||||
if (nargs != 0) {
|
if (nargs != 0) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"%.200s() takes no arguments (%zd given)",
|
"%.200s() takes no arguments (%zd given)",
|
||||||
func->m_ml->ml_name, nargs);
|
method->ml_name, nargs);
|
||||||
return NULL;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nkwargs) {
|
if (nkwargs) {
|
||||||
|
@ -333,8 +322,8 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"%.200s() takes exactly one argument (%zd given)",
|
"%.200s() takes exactly one argument (%zd given)",
|
||||||
func->m_ml->ml_name, nargs);
|
method->ml_name, nargs);
|
||||||
return NULL;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nkwargs) {
|
if (nkwargs) {
|
||||||
|
@ -362,7 +351,7 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
|
||||||
|
|
||||||
argtuple = _PyStack_AsTuple(args, nargs);
|
argtuple = _PyStack_AsTuple(args, nargs);
|
||||||
if (argtuple == NULL) {
|
if (argtuple == NULL) {
|
||||||
return NULL;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & METH_KEYWORDS) {
|
if (flags & METH_KEYWORDS) {
|
||||||
|
@ -372,7 +361,7 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
|
||||||
kwdict = _PyStack_AsDict(args + nargs, kwnames);
|
kwdict = _PyStack_AsDict(args + nargs, kwnames);
|
||||||
if (kwdict == NULL) {
|
if (kwdict == NULL) {
|
||||||
Py_DECREF(argtuple);
|
Py_DECREF(argtuple);
|
||||||
return NULL;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -393,19 +382,39 @@ _PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args,
|
||||||
PyErr_SetString(PyExc_SystemError,
|
PyErr_SetString(PyExc_SystemError,
|
||||||
"Bad call flags in _PyCFunction_FastCallKeywords. "
|
"Bad call flags in _PyCFunction_FastCallKeywords. "
|
||||||
"METH_OLDARGS is no longer supported!");
|
"METH_OLDARGS is no longer supported!");
|
||||||
return NULL;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = _Py_CheckFunctionResult(func_obj, result, NULL);
|
goto exit;
|
||||||
return result;
|
|
||||||
|
|
||||||
no_keyword_error:
|
no_keyword_error:
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"%.200s() takes no keyword arguments",
|
"%.200s() takes no keyword arguments",
|
||||||
func->m_ml->ml_name);
|
method->ml_name);
|
||||||
return NULL;
|
|
||||||
|
exit:
|
||||||
|
Py_LeaveRecursiveCall();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject *
|
||||||
|
_PyCFunction_FastCallKeywords(PyObject *func, PyObject **args,
|
||||||
|
Py_ssize_t nargs, PyObject *kwnames)
|
||||||
|
{
|
||||||
|
PyObject *result;
|
||||||
|
|
||||||
|
assert(func != NULL);
|
||||||
|
assert(PyCFunction_Check(func));
|
||||||
|
|
||||||
|
result = _PyMethodDef_RawFastCallKeywords(((PyCFunctionObject*)func)->m_ml,
|
||||||
|
PyCFunction_GET_SELF(func),
|
||||||
|
args, nargs, kwnames);
|
||||||
|
result = _Py_CheckFunctionResult(func, result, NULL);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Methods (the standard built-in methods, that is) */
|
/* Methods (the standard built-in methods, that is) */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
1
third_party/python/Objects/object.c
vendored
1
third_party/python/Objects/object.c
vendored
|
@ -1255,6 +1255,7 @@ _PyObject_GenericSetAttrWithDict(PyObject *obj, PyObject *name,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value)
|
PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value)
|
||||||
{
|
{
|
||||||
|
|
299
third_party/python/Objects/odictobject.c
vendored
299
third_party/python/Objects/odictobject.c
vendored
|
@ -90,7 +90,7 @@ Linked-List API
|
||||||
As noted, the linked-list implemented here does not have all the bells and
|
As noted, the linked-list implemented here does not have all the bells and
|
||||||
whistles. However, we recognize that the implementation may need to
|
whistles. However, we recognize that the implementation may need to
|
||||||
change to accommodate performance improvements or extra functionality. To
|
change to accommodate performance improvements or extra functionality. To
|
||||||
that end, we use a simple API to interact with the linked-list. Here's a
|
that end, We use a simple API to interact with the linked-list. Here's a
|
||||||
summary of the methods/macros:
|
summary of the methods/macros:
|
||||||
|
|
||||||
Node info:
|
Node info:
|
||||||
|
@ -124,6 +124,10 @@ Others:
|
||||||
* _odict_find_node(od, key)
|
* _odict_find_node(od, key)
|
||||||
* _odict_keys_equal(od1, od2)
|
* _odict_keys_equal(od1, od2)
|
||||||
|
|
||||||
|
Used, but specific to the linked-list implementation:
|
||||||
|
|
||||||
|
* _odict_free_fast_nodes(od)
|
||||||
|
|
||||||
And here's a look at how the linked-list relates to the OrderedDict API:
|
And here's a look at how the linked-list relates to the OrderedDict API:
|
||||||
|
|
||||||
============ === === ==== ==== ==== === ==== ===== ==== ==== === ==== === ===
|
============ === === ==== ==== ==== === ==== ===== ==== ==== === ==== === ===
|
||||||
|
@ -397,6 +401,7 @@ tp_iter odict_iter
|
||||||
tp_dictoffset (offset)
|
tp_dictoffset (offset)
|
||||||
tp_init odict_init
|
tp_init odict_init
|
||||||
tp_alloc (repeated)
|
tp_alloc (repeated)
|
||||||
|
tp_new odict_new
|
||||||
================= ================
|
================= ================
|
||||||
|
|
||||||
================= ================
|
================= ================
|
||||||
|
@ -462,7 +467,7 @@ Potential Optimizations
|
||||||
- Set node->key to NULL to indicate the node is not-in-use.
|
- Set node->key to NULL to indicate the node is not-in-use.
|
||||||
- Add _odict_EXISTS()?
|
- Add _odict_EXISTS()?
|
||||||
- How to maintain consistency across resizes? Existing node pointers
|
- How to maintain consistency across resizes? Existing node pointers
|
||||||
would be invalidated after a resize, which is particularly problematic
|
would be invalidate after a resize, which is particularly problematic
|
||||||
for the iterators.
|
for the iterators.
|
||||||
* Use a more stream-lined implementation of update() and, likely indirectly,
|
* Use a more stream-lined implementation of update() and, likely indirectly,
|
||||||
__init__().
|
__init__().
|
||||||
|
@ -487,6 +492,14 @@ later:
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "third_party/python/Objects/clinic/odictobject.inc"
|
||||||
|
|
||||||
|
/*[clinic input]
|
||||||
|
class OrderedDict "PyODictObject *" "&PyODict_Type"
|
||||||
|
[clinic start generated code]*/
|
||||||
|
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ca0641cf6143d4af]*/
|
||||||
|
|
||||||
|
|
||||||
typedef struct _odictnode _ODictNode;
|
typedef struct _odictnode _ODictNode;
|
||||||
|
|
||||||
/* PyODictObject */
|
/* PyODictObject */
|
||||||
|
@ -534,15 +547,24 @@ struct _odictnode {
|
||||||
#define _odict_FOREACH(od, node) \
|
#define _odict_FOREACH(od, node) \
|
||||||
for (node = _odict_FIRST(od); node != NULL; node = _odictnode_NEXT(node))
|
for (node = _odict_FIRST(od); node != NULL; node = _odictnode_NEXT(node))
|
||||||
|
|
||||||
|
#define _odict_FAST_SIZE(od) ((PyDictObject *)od)->ma_keys->dk_size
|
||||||
|
|
||||||
|
static void
|
||||||
|
_odict_free_fast_nodes(PyODictObject *od) {
|
||||||
|
if (od->od_fast_nodes) {
|
||||||
|
PyMem_FREE(od->od_fast_nodes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Return the index into the hash table, regardless of a valid node. */
|
/* Return the index into the hash table, regardless of a valid node. */
|
||||||
static Py_ssize_t
|
static Py_ssize_t
|
||||||
_odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
_odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
||||||
{
|
{
|
||||||
PyObject **value_addr = NULL;
|
PyObject **value = NULL;
|
||||||
PyDictKeysObject *keys = ((PyDictObject *)od)->ma_keys;
|
PyDictKeysObject *keys = ((PyDictObject *)od)->ma_keys;
|
||||||
Py_ssize_t ix;
|
Py_ssize_t ix;
|
||||||
|
|
||||||
ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value_addr, NULL);
|
ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value, NULL);
|
||||||
if (ix == DKIX_EMPTY) {
|
if (ix == DKIX_EMPTY) {
|
||||||
return keys->dk_nentries; /* index of new entry */
|
return keys->dk_nentries; /* index of new entry */
|
||||||
}
|
}
|
||||||
|
@ -554,8 +576,7 @@ _odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
||||||
|
|
||||||
/* Replace od->od_fast_nodes with a new table matching the size of dict's. */
|
/* Replace od->od_fast_nodes with a new table matching the size of dict's. */
|
||||||
static int
|
static int
|
||||||
_odict_resize(PyODictObject *od)
|
_odict_resize(PyODictObject *od) {
|
||||||
{
|
|
||||||
Py_ssize_t size, i;
|
Py_ssize_t size, i;
|
||||||
_ODictNode **fast_nodes, *node;
|
_ODictNode **fast_nodes, *node;
|
||||||
|
|
||||||
|
@ -581,7 +602,7 @@ _odict_resize(PyODictObject *od)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Replace the old fast nodes table. */
|
/* Replace the old fast nodes table. */
|
||||||
PyMem_FREE(od->od_fast_nodes);
|
_odict_free_fast_nodes(od);
|
||||||
od->od_fast_nodes = fast_nodes;
|
od->od_fast_nodes = fast_nodes;
|
||||||
od->od_fast_nodes_size = size;
|
od->od_fast_nodes_size = size;
|
||||||
od->od_resize_sentinel = ((PyDictObject *)od)->ma_keys;
|
od->od_resize_sentinel = ((PyDictObject *)od)->ma_keys;
|
||||||
|
@ -619,7 +640,6 @@ _odict_find_node_hash(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
||||||
index = _odict_get_index(od, key, hash);
|
index = _odict_get_index(od, key, hash);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
assert(od->od_fast_nodes != NULL);
|
|
||||||
return od->od_fast_nodes[index];
|
return od->od_fast_nodes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,7 +657,6 @@ _odict_find_node(PyODictObject *od, PyObject *key)
|
||||||
index = _odict_get_index(od, key, hash);
|
index = _odict_get_index(od, key, hash);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
assert(od->od_fast_nodes != NULL);
|
|
||||||
return od->od_fast_nodes[index];
|
return od->od_fast_nodes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,8 +701,7 @@ _odict_add_new_node(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
||||||
Py_DECREF(key);
|
Py_DECREF(key);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
assert(od->od_fast_nodes != NULL);
|
else if (od->od_fast_nodes[i] != NULL) {
|
||||||
if (od->od_fast_nodes[i] != NULL) {
|
|
||||||
/* We already have a node for the key so there's no need to add one. */
|
/* We already have a node for the key so there's no need to add one. */
|
||||||
Py_DECREF(key);
|
Py_DECREF(key);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -762,7 +780,6 @@ _odict_clear_node(PyODictObject *od, _ODictNode *node, PyObject *key,
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return PyErr_Occurred() ? -1 : 0;
|
return PyErr_Occurred() ? -1 : 0;
|
||||||
|
|
||||||
assert(od->od_fast_nodes != NULL);
|
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
node = od->od_fast_nodes[i];
|
node = od->od_fast_nodes[i];
|
||||||
assert(node == od->od_fast_nodes[i]);
|
assert(node == od->od_fast_nodes[i]);
|
||||||
|
@ -783,10 +800,8 @@ _odict_clear_nodes(PyODictObject *od)
|
||||||
{
|
{
|
||||||
_ODictNode *node, *next;
|
_ODictNode *node, *next;
|
||||||
|
|
||||||
PyMem_FREE(od->od_fast_nodes);
|
_odict_free_fast_nodes(od);
|
||||||
od->od_fast_nodes = NULL;
|
od->od_fast_nodes = NULL;
|
||||||
od->od_fast_nodes_size = 0;
|
|
||||||
od->od_resize_sentinel = NULL;
|
|
||||||
|
|
||||||
node = _odict_FIRST(od);
|
node = _odict_FIRST(od);
|
||||||
_odict_FIRST(od) = NULL;
|
_odict_FIRST(od) = NULL;
|
||||||
|
@ -885,7 +900,8 @@ odict_eq(PyObject *a, PyObject *b)
|
||||||
|
|
||||||
PyDoc_STRVAR(odict_init__doc__,
|
PyDoc_STRVAR(odict_init__doc__,
|
||||||
"Initialize an ordered dictionary. The signature is the same as\n\
|
"Initialize an ordered dictionary. The signature is the same as\n\
|
||||||
regular dictionaries. Keyword argument order is preserved.\n\
|
regular dictionaries, but keyword arguments are not recommended because\n\
|
||||||
|
their insertion order is arbitrary.\n\
|
||||||
\n\
|
\n\
|
||||||
");
|
");
|
||||||
|
|
||||||
|
@ -921,25 +937,23 @@ PyDoc_STRVAR(odict_setitem__doc__, "od.__setitem__(i, y) <==> od[i]=y");
|
||||||
|
|
||||||
/* fromkeys() */
|
/* fromkeys() */
|
||||||
|
|
||||||
PyDoc_STRVAR(odict_fromkeys__doc__,
|
/*[clinic input]
|
||||||
"OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.\n\
|
@classmethod
|
||||||
If not specified, the value defaults to None.\n\
|
OrderedDict.fromkeys
|
||||||
\n\
|
|
||||||
");
|
iterable as seq: object
|
||||||
|
value: object = None
|
||||||
|
|
||||||
|
New ordered dictionary with keys from S.
|
||||||
|
|
||||||
|
If not specified, the value defaults to None.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
odict_fromkeys(PyObject *cls, PyObject *args, PyObject *kwargs)
|
OrderedDict_fromkeys_impl(PyTypeObject *type, PyObject *seq, PyObject *value)
|
||||||
|
/*[clinic end generated code: output=c10390d452d78d6d input=33eefc496d5eee7b]*/
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"iterable", "value", 0};
|
return _PyDict_FromKeys((PyObject *)type, seq, value);
|
||||||
PyObject *seq;
|
|
||||||
PyObject *value = Py_None;
|
|
||||||
|
|
||||||
/* both borrowed */
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:fromkeys", kwlist,
|
|
||||||
&seq, &value)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return _PyDict_FromKeys(cls, seq, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* __sizeof__() */
|
/* __sizeof__() */
|
||||||
|
@ -951,7 +965,7 @@ static PyObject *
|
||||||
odict_sizeof(PyODictObject *od)
|
odict_sizeof(PyODictObject *od)
|
||||||
{
|
{
|
||||||
Py_ssize_t res = _PyDict_SizeOf((PyDictObject *)od);
|
Py_ssize_t res = _PyDict_SizeOf((PyDictObject *)od);
|
||||||
res += sizeof(_ODictNode *) * od->od_fast_nodes_size; /* od_fast_nodes */
|
res += sizeof(_ODictNode *) * _odict_FAST_SIZE(od); /* od_fast_nodes */
|
||||||
if (!_odict_EMPTY(od)) {
|
if (!_odict_EMPTY(od)) {
|
||||||
res += sizeof(_ODictNode) * PyODict_SIZE(od); /* linked-list */
|
res += sizeof(_ODictNode) * PyODict_SIZE(od); /* linked-list */
|
||||||
}
|
}
|
||||||
|
@ -1009,32 +1023,32 @@ Done:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setdefault() */
|
/* setdefault(): Skips __missing__() calls. */
|
||||||
|
|
||||||
PyDoc_STRVAR(odict_setdefault__doc__,
|
|
||||||
"od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od");
|
|
||||||
|
|
||||||
/* Skips __missing__() calls. */
|
/*[clinic input]
|
||||||
|
OrderedDict.setdefault
|
||||||
|
|
||||||
|
key: object
|
||||||
|
default as failobj: object = None
|
||||||
|
|
||||||
|
od.get(k,d), also set od[k]=d if k not in od.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
odict_setdefault(register PyODictObject *od, PyObject *args, PyObject *kwargs)
|
OrderedDict_setdefault_impl(PyODictObject *self, PyObject *key,
|
||||||
|
PyObject *failobj)
|
||||||
|
/*[clinic end generated code: output=605d0f6f61ccb0a6 input=4ee5006f32f5691b]*/
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"key", "default", 0};
|
PyObject *result = NULL;
|
||||||
PyObject *key, *result = NULL;
|
|
||||||
PyObject *failobj = Py_None;
|
|
||||||
|
|
||||||
/* both borrowed */
|
if (PyODict_CheckExact(self)) {
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:setdefault", kwlist,
|
result = PyODict_GetItemWithError(self, key); /* borrowed */
|
||||||
&key, &failobj)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PyODict_CheckExact(od)) {
|
|
||||||
result = PyODict_GetItemWithError(od, key); /* borrowed */
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
assert(_odict_find_node(od, key) == NULL);
|
assert(_odict_find_node(self, key) == NULL);
|
||||||
if (PyODict_SetItem((PyObject *)od, key, failobj) >= 0) {
|
if (PyODict_SetItem((PyObject *)self, key, failobj) >= 0) {
|
||||||
result = failobj;
|
result = failobj;
|
||||||
Py_INCREF(failobj);
|
Py_INCREF(failobj);
|
||||||
}
|
}
|
||||||
|
@ -1044,14 +1058,14 @@ odict_setdefault(register PyODictObject *od, PyObject *args, PyObject *kwargs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int exists = PySequence_Contains((PyObject *)od, key);
|
int exists = PySequence_Contains((PyObject *)self, key);
|
||||||
if (exists < 0) {
|
if (exists < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (exists) {
|
else if (exists) {
|
||||||
result = PyObject_GetItem((PyObject *)od, key);
|
result = PyObject_GetItem((PyObject *)self, key);
|
||||||
}
|
}
|
||||||
else if (PyObject_SetItem((PyObject *)od, key, failobj) >= 0) {
|
else if (PyObject_SetItem((PyObject *)self, key, failobj) >= 0) {
|
||||||
result = failobj;
|
result = failobj;
|
||||||
Py_INCREF(failobj);
|
Py_INCREF(failobj);
|
||||||
}
|
}
|
||||||
|
@ -1161,41 +1175,37 @@ _odict_popkey(PyObject *od, PyObject *key, PyObject *failobj)
|
||||||
return _odict_popkey_hash(od, key, failobj, hash);
|
return _odict_popkey_hash(od, key, failobj, hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* popitem() */
|
/* popitem() */
|
||||||
|
|
||||||
PyDoc_STRVAR(odict_popitem__doc__,
|
/*[clinic input]
|
||||||
"popitem($self, /, last=True)\n"
|
OrderedDict.popitem
|
||||||
"--\n"
|
|
||||||
"\n"
|
last: bool = True
|
||||||
"Remove and return a (key, value) pair from the dictionary.\n"
|
|
||||||
"\n"
|
Return (k, v) and remove a (key, value) pair.
|
||||||
"Pairs are returned in LIFO order if last is true or FIFO order if false.");
|
|
||||||
|
Pairs are returned in LIFO order if last is true or FIFO order if false.
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
odict_popitem(PyObject *od, PyObject *args, PyObject *kwargs)
|
OrderedDict_popitem_impl(PyODictObject *self, int last)
|
||||||
|
/*[clinic end generated code: output=98e7d986690d49eb input=4937da2015939126]*/
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"last", 0};
|
|
||||||
PyObject *key, *value, *item = NULL;
|
PyObject *key, *value, *item = NULL;
|
||||||
_ODictNode *node;
|
_ODictNode *node;
|
||||||
int last = 1;
|
|
||||||
|
|
||||||
/* pull the item */
|
/* pull the item */
|
||||||
|
|
||||||
/* borrowed */
|
if (_odict_EMPTY(self)) {
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p:popitem", kwlist,
|
|
||||||
&last)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_odict_EMPTY(od)) {
|
|
||||||
PyErr_SetString(PyExc_KeyError, "dictionary is empty");
|
PyErr_SetString(PyExc_KeyError, "dictionary is empty");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = last ? _odict_LAST(od) : _odict_FIRST(od);
|
node = last ? _odict_LAST(self) : _odict_FIRST(self);
|
||||||
key = _odictnode_KEY(node);
|
key = _odictnode_KEY(node);
|
||||||
Py_INCREF(key);
|
Py_INCREF(key);
|
||||||
value = _odict_popkey_hash(od, key, NULL, _odictnode_HASH(node));
|
value = _odict_popkey_hash((PyObject *)self, key, NULL, _odictnode_HASH(node));
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
item = PyTuple_Pack(2, key, value);
|
item = PyTuple_Pack(2, key, value);
|
||||||
|
@ -1241,10 +1251,12 @@ PyDoc_STRVAR(odict_clear__doc__,
|
||||||
"od.clear() -> None. Remove all items from od.");
|
"od.clear() -> None. Remove all items from od.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
odict_clear(register PyODictObject *od, PyObject *Py_UNUSED(ignored))
|
odict_clear(register PyODictObject *od)
|
||||||
{
|
{
|
||||||
PyDict_Clear((PyObject *)od);
|
PyDict_Clear((PyObject *)od);
|
||||||
_odict_clear_nodes(od);
|
_odict_clear_nodes(od);
|
||||||
|
if (_odict_resize(od) < 0)
|
||||||
|
return NULL;
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1265,7 +1277,7 @@ odict_copy(register PyODictObject *od)
|
||||||
if (PyODict_CheckExact(od))
|
if (PyODict_CheckExact(od))
|
||||||
od_copy = PyODict_New();
|
od_copy = PyODict_New();
|
||||||
else
|
else
|
||||||
od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL);
|
od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od));
|
||||||
if (od_copy == NULL)
|
if (od_copy == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -1321,36 +1333,34 @@ odict_reversed(PyODictObject *od)
|
||||||
return odictiter_new(od, _odict_ITER_KEYS|_odict_ITER_REVERSED);
|
return odictiter_new(od, _odict_ITER_KEYS|_odict_ITER_REVERSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* move_to_end() */
|
/* move_to_end() */
|
||||||
|
|
||||||
PyDoc_STRVAR(odict_move_to_end__doc__,
|
/*[clinic input]
|
||||||
"Move an existing element to the end (or beginning if last==False).\n\
|
OrderedDict.move_to_end
|
||||||
\n\
|
|
||||||
Raises KeyError if the element does not exist.\n\
|
key: object
|
||||||
When last=True, acts like a fast version of self[key]=self.pop(key).\n\
|
last: bool = True
|
||||||
\n\
|
|
||||||
");
|
"Move an existing element to the end (or beginning if last==False).
|
||||||
|
|
||||||
|
Raises KeyError if the element does not exist.
|
||||||
|
When last=True, acts like a fast version of self[key]=self.pop(key).
|
||||||
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
odict_move_to_end(PyODictObject *od, PyObject *args, PyObject *kwargs)
|
OrderedDict_move_to_end_impl(PyODictObject *self, PyObject *key, int last)
|
||||||
|
/*[clinic end generated code: output=fafa4c5cc9b92f20 input=3b8283f7d0e15e43]*/
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"key", "last", 0};
|
|
||||||
PyObject *key;
|
|
||||||
int last = 1;
|
|
||||||
_ODictNode *node;
|
_ODictNode *node;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|p:move_to_end", kwlist,
|
if (_odict_EMPTY(self)) {
|
||||||
&key, &last)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_odict_EMPTY(od)) {
|
|
||||||
PyErr_SetObject(PyExc_KeyError, key);
|
PyErr_SetObject(PyExc_KeyError, key);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
node = last ? _odict_LAST(od) : _odict_FIRST(od);
|
node = last ? _odict_LAST(self) : _odict_FIRST(self);
|
||||||
if (key != _odictnode_KEY(node)) {
|
if (key != _odictnode_KEY(node)) {
|
||||||
node = _odict_find_node(od, key);
|
node = _odict_find_node(self, key);
|
||||||
if (node == NULL) {
|
if (node == NULL) {
|
||||||
if (!PyErr_Occurred())
|
if (!PyErr_Occurred())
|
||||||
PyErr_SetObject(PyExc_KeyError, key);
|
PyErr_SetObject(PyExc_KeyError, key);
|
||||||
|
@ -1358,16 +1368,16 @@ odict_move_to_end(PyODictObject *od, PyObject *args, PyObject *kwargs)
|
||||||
}
|
}
|
||||||
if (last) {
|
if (last) {
|
||||||
/* Only move if not already the last one. */
|
/* Only move if not already the last one. */
|
||||||
if (node != _odict_LAST(od)) {
|
if (node != _odict_LAST(self)) {
|
||||||
_odict_remove_node(od, node);
|
_odict_remove_node(self, node);
|
||||||
_odict_add_tail(od, node);
|
_odict_add_tail(self, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Only move if not already the first one. */
|
/* Only move if not already the first one. */
|
||||||
if (node != _odict_FIRST(od)) {
|
if (node != _odict_FIRST(self)) {
|
||||||
_odict_remove_node(od, node);
|
_odict_remove_node(self, node);
|
||||||
_odict_add_head(od, node);
|
_odict_add_head(self, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1395,20 +1405,17 @@ static PyMethodDef odict_methods[] = {
|
||||||
odict_repr__doc__},
|
odict_repr__doc__},
|
||||||
{"__setitem__", (PyCFunction)odict_mp_ass_sub, METH_NOARGS,
|
{"__setitem__", (PyCFunction)odict_mp_ass_sub, METH_NOARGS,
|
||||||
odict_setitem__doc__},
|
odict_setitem__doc__},
|
||||||
{"fromkeys", (PyCFunction)odict_fromkeys,
|
ORDEREDDICT_FROMKEYS_METHODDEF
|
||||||
METH_VARARGS | METH_KEYWORDS | METH_CLASS, odict_fromkeys__doc__},
|
|
||||||
|
|
||||||
/* overridden dict methods */
|
/* overridden dict methods */
|
||||||
{"__sizeof__", (PyCFunction)odict_sizeof, METH_NOARGS,
|
{"__sizeof__", (PyCFunction)odict_sizeof, METH_NOARGS,
|
||||||
odict_sizeof__doc__},
|
odict_sizeof__doc__},
|
||||||
{"__reduce__", (PyCFunction)odict_reduce, METH_NOARGS,
|
{"__reduce__", (PyCFunction)odict_reduce, METH_NOARGS,
|
||||||
odict_reduce__doc__},
|
odict_reduce__doc__},
|
||||||
{"setdefault", (PyCFunction)odict_setdefault,
|
ORDEREDDICT_SETDEFAULT_METHODDEF
|
||||||
METH_VARARGS | METH_KEYWORDS, odict_setdefault__doc__},
|
|
||||||
{"pop", (PyCFunction)odict_pop,
|
{"pop", (PyCFunction)odict_pop,
|
||||||
METH_VARARGS | METH_KEYWORDS, odict_pop__doc__},
|
METH_VARARGS | METH_KEYWORDS, odict_pop__doc__},
|
||||||
{"popitem", (PyCFunction)odict_popitem,
|
ORDEREDDICT_POPITEM_METHODDEF
|
||||||
METH_VARARGS | METH_KEYWORDS, odict_popitem__doc__},
|
|
||||||
{"keys", (PyCFunction)odictkeys_new, METH_NOARGS,
|
{"keys", (PyCFunction)odictkeys_new, METH_NOARGS,
|
||||||
odict_keys__doc__},
|
odict_keys__doc__},
|
||||||
{"values", (PyCFunction)odictvalues_new, METH_NOARGS,
|
{"values", (PyCFunction)odictvalues_new, METH_NOARGS,
|
||||||
|
@ -1425,8 +1432,7 @@ static PyMethodDef odict_methods[] = {
|
||||||
/* new methods */
|
/* new methods */
|
||||||
{"__reversed__", (PyCFunction)odict_reversed, METH_NOARGS,
|
{"__reversed__", (PyCFunction)odict_reversed, METH_NOARGS,
|
||||||
odict_reversed__doc__},
|
odict_reversed__doc__},
|
||||||
{"move_to_end", (PyCFunction)odict_move_to_end,
|
ORDEREDDICT_MOVE_TO_END_METHODDEF
|
||||||
METH_VARARGS | METH_KEYWORDS, odict_move_to_end__doc__},
|
|
||||||
|
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
@ -1578,10 +1584,13 @@ odict_traverse(PyODictObject *od, visitproc visit, void *arg)
|
||||||
static int
|
static int
|
||||||
odict_tp_clear(PyODictObject *od)
|
odict_tp_clear(PyODictObject *od)
|
||||||
{
|
{
|
||||||
|
PyObject *res;
|
||||||
Py_CLEAR(od->od_inst_dict);
|
Py_CLEAR(od->od_inst_dict);
|
||||||
Py_CLEAR(od->od_weakreflist);
|
Py_CLEAR(od->od_weakreflist);
|
||||||
PyDict_Clear((PyObject *)od);
|
res = odict_clear(od);
|
||||||
_odict_clear_nodes(od);
|
if (res == NULL)
|
||||||
|
return -1;
|
||||||
|
Py_DECREF(res);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1656,6 +1665,27 @@ odict_init(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* tp_new */
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
odict_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
|
{
|
||||||
|
PyODictObject *od;
|
||||||
|
|
||||||
|
od = (PyODictObject *)PyDict_Type.tp_new(type, args, kwds);
|
||||||
|
if (od == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* type constructor fills the memory with zeros (see
|
||||||
|
PyType_GenericAlloc()), there is no need to set them to zero again */
|
||||||
|
if (_odict_resize(od) < 0) {
|
||||||
|
Py_DECREF(od);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (PyObject*)od;
|
||||||
|
}
|
||||||
|
|
||||||
/* PyODict_Type */
|
/* PyODict_Type */
|
||||||
|
|
||||||
PyTypeObject PyODict_Type = {
|
PyTypeObject PyODict_Type = {
|
||||||
|
@ -1696,7 +1726,7 @@ PyTypeObject PyODict_Type = {
|
||||||
offsetof(PyODictObject, od_inst_dict), /* tp_dictoffset */
|
offsetof(PyODictObject, od_inst_dict), /* tp_dictoffset */
|
||||||
(initproc)odict_init, /* tp_init */
|
(initproc)odict_init, /* tp_init */
|
||||||
PyType_GenericAlloc, /* tp_alloc */
|
PyType_GenericAlloc, /* tp_alloc */
|
||||||
0, /* tp_new */
|
(newfunc)odict_new, /* tp_new */
|
||||||
0, /* tp_free */
|
0, /* tp_free */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1706,9 +1736,8 @@ PyTypeObject PyODict_Type = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyODict_New(void)
|
PyODict_New(void) {
|
||||||
{
|
return odict_new(&PyODict_Type, NULL, NULL);
|
||||||
return PyDict_Type.tp_new(&PyODict_Type, NULL, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1906,21 +1935,40 @@ done:
|
||||||
PyDoc_STRVAR(reduce_doc, "Return state information for pickling");
|
PyDoc_STRVAR(reduce_doc, "Return state information for pickling");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
odictiter_reduce(odictiterobject *di, PyObject *Py_UNUSED(ignored))
|
odictiter_reduce(odictiterobject *di)
|
||||||
{
|
{
|
||||||
/* copy the iterator state */
|
PyObject *list, *iter;
|
||||||
odictiterobject tmp = *di;
|
|
||||||
Py_XINCREF(tmp.di_odict);
|
list = PyList_New(0);
|
||||||
Py_XINCREF(tmp.di_current);
|
if (!list)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* iterate the temporary into a list */
|
/* iterate the temporary into a list */
|
||||||
PyObject *list = PySequence_List((PyObject*)&tmp);
|
for(;;) {
|
||||||
Py_XDECREF(tmp.di_odict);
|
PyObject *element = odictiter_iternext(di);
|
||||||
Py_XDECREF(tmp.di_current);
|
if (element) {
|
||||||
if (list == NULL) {
|
if (PyList_Append(list, element)) {
|
||||||
|
Py_DECREF(element);
|
||||||
|
Py_DECREF(list);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
Py_DECREF(element);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* done iterating? */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (PyErr_Occurred()) {
|
||||||
|
Py_DECREF(list);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return Py_BuildValue("N(N)", _PyObject_GetBuiltin("iter"), list);
|
iter = _PyObject_GetBuiltin("iter");
|
||||||
|
if (iter == NULL) {
|
||||||
|
Py_DECREF(list);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return Py_BuildValue("N(N)", iter, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef odictiter_methods[] = {
|
static PyMethodDef odictiter_methods[] = {
|
||||||
|
@ -2390,8 +2438,7 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
|
|
||||||
/* now handle kwargs */
|
/* now handle kwargs */
|
||||||
assert(kwargs == NULL || PyDict_Check(kwargs));
|
assert(kwargs == NULL || PyDict_Check(kwargs));
|
||||||
len = (kwargs != NULL) ? PyDict_Size(kwargs) : 0;
|
if (kwargs != NULL && PyDict_GET_SIZE(kwargs)) {
|
||||||
if (len > 0) {
|
|
||||||
PyObject *items = PyDict_Items(kwargs);
|
PyObject *items = PyDict_Items(kwargs);
|
||||||
if (items == NULL)
|
if (items == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
540
third_party/python/Objects/typeobject.c
vendored
540
third_party/python/Objects/typeobject.c
vendored
File diff suppressed because it is too large
Load diff
127
third_party/python/Python/bltinmodule.c
vendored
127
third_party/python/Python/bltinmodule.c
vendored
|
@ -239,51 +239,45 @@ _Py_IDENTIFIER(stderr);
|
||||||
|
|
||||||
/* AC: cannot convert yet, waiting for *args support */
|
/* AC: cannot convert yet, waiting for *args support */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
|
builtin___build_class__(PyObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
|
PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns;
|
PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns;
|
||||||
PyObject *cls = NULL, *cell = NULL;
|
PyObject *cls = NULL, *cell = NULL;
|
||||||
Py_ssize_t nargs;
|
|
||||||
int isclass = 0; /* initialize to prevent gcc warning */
|
int isclass = 0; /* initialize to prevent gcc warning */
|
||||||
|
|
||||||
assert(args != NULL);
|
|
||||||
if (!PyTuple_Check(args)) {
|
|
||||||
PyErr_SetString(PyExc_TypeError,
|
|
||||||
"__build_class__: args is not a tuple");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
nargs = PyTuple_GET_SIZE(args);
|
|
||||||
if (nargs < 2) {
|
if (nargs < 2) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"__build_class__: not enough arguments");
|
"__build_class__: not enough arguments");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
func = PyTuple_GET_ITEM(args, 0); /* Better be callable */
|
func = args[0]; /* Better be callable */
|
||||||
if (!PyFunction_Check(func)) {
|
if (!PyFunction_Check(func)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"__build_class__: func must be a function");
|
"__build_class__: func must be a function");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
name = PyTuple_GET_ITEM(args, 1);
|
name = args[1];
|
||||||
if (!PyUnicode_Check(name)) {
|
if (!PyUnicode_Check(name)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"__build_class__: name is not a string");
|
"__build_class__: name is not a string");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bases = PyTuple_GetSlice(args, 2, nargs);
|
bases = _PyStack_AsTupleSlice(args, nargs, 2, nargs);
|
||||||
if (bases == NULL)
|
if (bases == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (kwds == NULL) {
|
if (kwnames == NULL) {
|
||||||
meta = NULL;
|
meta = NULL;
|
||||||
mkw = NULL;
|
mkw = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mkw = PyDict_Copy(kwds); /* Don't modify kwds passed in! */
|
mkw = _PyStack_AsDict(args + nargs, kwnames);
|
||||||
if (mkw == NULL) {
|
if (mkw == NULL) {
|
||||||
Py_DECREF(bases);
|
Py_DECREF(bases);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta = _PyDict_GetItemId(mkw, &PyId_metaclass);
|
meta = _PyDict_GetItemId(mkw, &PyId_metaclass);
|
||||||
if (meta != NULL) {
|
if (meta != NULL) {
|
||||||
Py_INCREF(meta);
|
Py_INCREF(meta);
|
||||||
|
@ -412,15 +406,16 @@ PyDoc_STRVAR(build_class_doc,
|
||||||
Internal helper function used by the class statement.");
|
Internal helper function used by the class statement.");
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin___import__(PyObject *self, PyObject *args, PyObject *kwds)
|
builtin___import__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwds)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"name", "globals", "locals", "fromlist",
|
static const char * const kwlist[] = {"name", "globals", "locals", "fromlist",
|
||||||
"level", 0};
|
"level", 0};
|
||||||
PyObject *name, *globals = NULL, *locals = NULL, *fromlist = NULL;
|
PyObject *name, *globals = NULL, *locals = NULL, *fromlist = NULL;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
static _PyArg_Parser _parser = {"U|OOOi:__import__", kwlist, 0};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "U|OOOi:__import__",
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwds, &_parser,
|
||||||
kwlist, &name, &globals, &locals, &fromlist, &level))
|
&name, &globals, &locals, &fromlist, &level))
|
||||||
return NULL;
|
return NULL;
|
||||||
return PyImport_ImportModuleLevelObject(name, globals, locals,
|
return PyImport_ImportModuleLevelObject(name, globals, locals,
|
||||||
fromlist, level);
|
fromlist, level);
|
||||||
|
@ -979,11 +974,13 @@ finally:
|
||||||
|
|
||||||
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_dir(PyObject *self, PyObject *args)
|
builtin_dir(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *arg = NULL;
|
PyObject *arg = NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "dir", 0, 1, &arg))
|
if (!_PyArg_UnpackStack(args, nargs, "dir", 0, 1, &arg))
|
||||||
|
return NULL;
|
||||||
|
if (!_PyArg_NoStackKeywords("dir", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
return PyObject_Dir(arg);
|
return PyObject_Dir(arg);
|
||||||
}
|
}
|
||||||
|
@ -1195,14 +1192,19 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
|
||||||
|
|
||||||
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_getattr(PyObject *self, PyObject *args)
|
builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
|
PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *v, *result, *dflt = NULL;
|
PyObject *v, *result, *dflt = NULL;
|
||||||
PyObject *name;
|
PyObject *name;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "getattr", 2, 3, &v, &name, &dflt))
|
if (!_PyArg_UnpackStack(args, nargs, "getattr", 2, 3, &v, &name, &dflt))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("getattr", kwnames)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!PyUnicode_Check(name)) {
|
if (!PyUnicode_Check(name)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"getattr(): attribute name must be string");
|
"getattr(): attribute name must be string");
|
||||||
|
@ -1500,13 +1502,19 @@ PyTypeObject PyMap_Type = {
|
||||||
|
|
||||||
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_next(PyObject *self, PyObject *args)
|
builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs,
|
||||||
|
PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *it, *res;
|
PyObject *it, *res;
|
||||||
PyObject *def = NULL;
|
PyObject *def = NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "next", 1, 2, &it, &def))
|
if (!_PyArg_UnpackStack(args, nargs, "next", 1, 2, &it, &def))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("next", kwnames)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!PyIter_Check(it)) {
|
if (!PyIter_Check(it)) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"'%.200s' object is not an iterator",
|
"'%.200s' object is not an iterator",
|
||||||
|
@ -1635,11 +1643,13 @@ builtin_hex(PyObject *module, PyObject *number)
|
||||||
|
|
||||||
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_iter(PyObject *self, PyObject *args)
|
builtin_iter(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *v, *w = NULL;
|
PyObject *v, *w = NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "iter", 1, 2, &v, &w))
|
if (!_PyArg_UnpackStack(args, nargs, "iter", 1, 2, &v, &w))
|
||||||
|
return NULL;
|
||||||
|
if(!_PyArg_NoStackKeywords("iter", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (w == NULL)
|
if (w == NULL)
|
||||||
return PyObject_GetIter(v);
|
return PyObject_GetIter(v);
|
||||||
|
@ -1938,18 +1948,19 @@ builtin_pow_impl(PyObject *module, PyObject *x, PyObject *y, PyObject *z)
|
||||||
|
|
||||||
/* AC: cannot convert yet, waiting for *args support */
|
/* AC: cannot convert yet, waiting for *args support */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
|
builtin_print(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = {"sep", "end", "file", "flush", 0};
|
static const char * const _keywords[] = {"sep", "end", "file", "flush", 0};
|
||||||
static PyObject *dummy_args;
|
static struct _PyArg_Parser _parser = {"|OOOO:print", _keywords, 0};
|
||||||
PyObject *sep = NULL, *end = NULL, *file = NULL, *flush = NULL;
|
PyObject *sep = NULL, *end = NULL, *file = NULL, *flush = NULL;
|
||||||
int i, err;
|
int i, err;
|
||||||
|
|
||||||
if (dummy_args == NULL && !(dummy_args = PyTuple_New(0)))
|
if (kwnames != NULL &&
|
||||||
return NULL;
|
!_PyArg_ParseStackAndKeywords(args + nargs, 0, kwnames, &_parser,
|
||||||
if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOOO:print",
|
&sep, &end, &file, &flush)) {
|
||||||
kwlist, &sep, &end, &file, &flush))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (file == NULL || file == Py_None) {
|
if (file == NULL || file == Py_None) {
|
||||||
file = _PySys_GetObjectId(&PyId_stdout);
|
file = _PySys_GetObjectId(&PyId_stdout);
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
|
@ -1981,7 +1992,7 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < PyTuple_Size(args); i++) {
|
for (i = 0; i < nargs; i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
if (sep == NULL)
|
if (sep == NULL)
|
||||||
err = PyFile_WriteString(" ", file);
|
err = PyFile_WriteString(" ", file);
|
||||||
|
@ -1991,8 +2002,7 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
if (err)
|
if (err)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
err = PyFile_WriteObject(PyTuple_GetItem(args, i), file,
|
err = PyFile_WriteObject(args[i], file, Py_PRINT_RAW);
|
||||||
Py_PRINT_RAW);
|
|
||||||
if (err)
|
if (err)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2323,20 +2333,20 @@ PyDoc_STRVAR(builtin_sorted__doc__,
|
||||||
"reverse flag can be set to request the result in descending order.");
|
"reverse flag can be set to request the result in descending order.");
|
||||||
|
|
||||||
#define BUILTIN_SORTED_METHODDEF \
|
#define BUILTIN_SORTED_METHODDEF \
|
||||||
{"sorted", (PyCFunction)builtin_sorted, METH_VARARGS|METH_KEYWORDS, builtin_sorted__doc__},
|
{"sorted", (PyCFunction)builtin_sorted, METH_FASTCALL, builtin_sorted__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
|
builtin_sorted(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *newlist, *v, *seq, *keyfunc=NULL, **newargs;
|
PyObject *newlist, *v, *seq, *keyfunc=NULL;
|
||||||
PyObject *callable;
|
PyObject *callable;
|
||||||
static char *kwlist[] = {"", "key", "reverse", 0};
|
static const char * const kwlist[] = {"", "key", "reverse", 0};
|
||||||
int reverse;
|
|
||||||
Py_ssize_t nargs;
|
|
||||||
|
|
||||||
/* args 1-3 should match listsort in Objects/listobject.c */
|
/* args 1-3 should match listsort in Objects/listobject.c */
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|Oi:sorted",
|
static _PyArg_Parser parser = {"O|Oi:sorted", kwlist, 0};
|
||||||
kwlist, &seq, &keyfunc, &reverse))
|
int reverse;
|
||||||
|
|
||||||
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &parser,
|
||||||
|
&seq, &keyfunc, &reverse))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
newlist = PySequence_List(seq);
|
newlist = PySequence_List(seq);
|
||||||
|
@ -2349,10 +2359,7 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(PyTuple_GET_SIZE(args) >= 1);
|
v = _PyObject_FastCallKeywords(callable, args + 1, nargs - 1, kwnames);
|
||||||
newargs = &PyTuple_GET_ITEM(args, 1);
|
|
||||||
nargs = PyTuple_GET_SIZE(args) - 1;
|
|
||||||
v = _PyObject_FastCallDict(callable, newargs, nargs, kwds);
|
|
||||||
Py_DECREF(callable);
|
Py_DECREF(callable);
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
Py_DECREF(newlist);
|
Py_DECREF(newlist);
|
||||||
|
@ -2365,12 +2372,14 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
|
|
||||||
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_vars(PyObject *self, PyObject *args)
|
builtin_vars(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *v = NULL;
|
PyObject *v = NULL;
|
||||||
PyObject *d;
|
PyObject *d;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "vars", 0, 1, &v))
|
if (!_PyArg_UnpackStack(args, nargs, "vars", 0, 1, &v))
|
||||||
|
return NULL;
|
||||||
|
if(!_PyArg_NoStackKeywords("vars", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
d = PyEval_GetLocals();
|
d = PyEval_GetLocals();
|
||||||
|
@ -2825,8 +2834,8 @@ PyTypeObject PyZip_Type = {
|
||||||
|
|
||||||
static PyMethodDef builtin_methods[] = {
|
static PyMethodDef builtin_methods[] = {
|
||||||
{"__build_class__", (PyCFunction)builtin___build_class__,
|
{"__build_class__", (PyCFunction)builtin___build_class__,
|
||||||
METH_VARARGS | METH_KEYWORDS, build_class_doc},
|
METH_FASTCALL, build_class_doc},
|
||||||
{"__import__", (PyCFunction)builtin___import__, METH_VARARGS | METH_KEYWORDS, import_doc},
|
{"__import__", (PyCFunction)builtin___import__, METH_FASTCALL, import_doc},
|
||||||
BUILTIN_ABS_METHODDEF
|
BUILTIN_ABS_METHODDEF
|
||||||
BUILTIN_ALL_METHODDEF
|
BUILTIN_ALL_METHODDEF
|
||||||
BUILTIN_ANY_METHODDEF
|
BUILTIN_ANY_METHODDEF
|
||||||
|
@ -2836,12 +2845,12 @@ static PyMethodDef builtin_methods[] = {
|
||||||
BUILTIN_CHR_METHODDEF
|
BUILTIN_CHR_METHODDEF
|
||||||
BUILTIN_COMPILE_METHODDEF
|
BUILTIN_COMPILE_METHODDEF
|
||||||
BUILTIN_DELATTR_METHODDEF
|
BUILTIN_DELATTR_METHODDEF
|
||||||
{"dir", builtin_dir, METH_VARARGS, dir_doc},
|
{"dir", (PyCFunction)builtin_dir, METH_FASTCALL, dir_doc},
|
||||||
BUILTIN_DIVMOD_METHODDEF
|
BUILTIN_DIVMOD_METHODDEF
|
||||||
BUILTIN_EVAL_METHODDEF
|
BUILTIN_EVAL_METHODDEF
|
||||||
BUILTIN_EXEC_METHODDEF
|
BUILTIN_EXEC_METHODDEF
|
||||||
BUILTIN_FORMAT_METHODDEF
|
BUILTIN_FORMAT_METHODDEF
|
||||||
{"getattr", builtin_getattr, METH_VARARGS, getattr_doc},
|
{"getattr", (PyCFunction)builtin_getattr, METH_FASTCALL, getattr_doc},
|
||||||
BUILTIN_GLOBALS_METHODDEF
|
BUILTIN_GLOBALS_METHODDEF
|
||||||
BUILTIN_HASATTR_METHODDEF
|
BUILTIN_HASATTR_METHODDEF
|
||||||
BUILTIN_HASH_METHODDEF
|
BUILTIN_HASH_METHODDEF
|
||||||
|
@ -2850,22 +2859,22 @@ static PyMethodDef builtin_methods[] = {
|
||||||
BUILTIN_INPUT_METHODDEF
|
BUILTIN_INPUT_METHODDEF
|
||||||
BUILTIN_ISINSTANCE_METHODDEF
|
BUILTIN_ISINSTANCE_METHODDEF
|
||||||
BUILTIN_ISSUBCLASS_METHODDEF
|
BUILTIN_ISSUBCLASS_METHODDEF
|
||||||
{"iter", builtin_iter, METH_VARARGS, iter_doc},
|
{"iter", (PyCFunction)builtin_iter, METH_FASTCALL, iter_doc},
|
||||||
BUILTIN_LEN_METHODDEF
|
BUILTIN_LEN_METHODDEF
|
||||||
BUILTIN_LOCALS_METHODDEF
|
BUILTIN_LOCALS_METHODDEF
|
||||||
{"max", (PyCFunction)builtin_max, METH_VARARGS | METH_KEYWORDS, max_doc},
|
{"max", (PyCFunction)builtin_max, METH_VARARGS | METH_KEYWORDS, max_doc},
|
||||||
{"min", (PyCFunction)builtin_min, METH_VARARGS | METH_KEYWORDS, min_doc},
|
{"min", (PyCFunction)builtin_min, METH_VARARGS | METH_KEYWORDS, min_doc},
|
||||||
{"next", (PyCFunction)builtin_next, METH_VARARGS, next_doc},
|
{"next", (PyCFunction)builtin_next, METH_FASTCALL, next_doc},
|
||||||
BUILTIN_OCT_METHODDEF
|
BUILTIN_OCT_METHODDEF
|
||||||
BUILTIN_ORD_METHODDEF
|
BUILTIN_ORD_METHODDEF
|
||||||
BUILTIN_POW_METHODDEF
|
BUILTIN_POW_METHODDEF
|
||||||
{"print", (PyCFunction)builtin_print, METH_VARARGS | METH_KEYWORDS, print_doc},
|
{"print", (PyCFunction)builtin_print, METH_FASTCALL, print_doc},
|
||||||
BUILTIN_REPR_METHODDEF
|
BUILTIN_REPR_METHODDEF
|
||||||
{"round", (PyCFunction)builtin_round, METH_VARARGS | METH_KEYWORDS, round_doc},
|
{"round", (PyCFunction)builtin_round, METH_VARARGS | METH_KEYWORDS, round_doc},
|
||||||
BUILTIN_SETATTR_METHODDEF
|
BUILTIN_SETATTR_METHODDEF
|
||||||
BUILTIN_SORTED_METHODDEF
|
BUILTIN_SORTED_METHODDEF
|
||||||
BUILTIN_SUM_METHODDEF
|
BUILTIN_SUM_METHODDEF
|
||||||
{"vars", builtin_vars, METH_VARARGS, vars_doc},
|
{"vars", (PyCFunction)builtin_vars, METH_FASTCALL, vars_doc},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
142
third_party/python/Python/clinic/bltinmodule.inc
vendored
142
third_party/python/Python/clinic/bltinmodule.inc
vendored
|
@ -1,11 +1,4 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
|
||||||
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Python 3 │
|
|
||||||
│ https://docs.python.org/3/license.html │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
@ -90,22 +83,26 @@ PyDoc_STRVAR(builtin_format__doc__,
|
||||||
"details.");
|
"details.");
|
||||||
|
|
||||||
#define BUILTIN_FORMAT_METHODDEF \
|
#define BUILTIN_FORMAT_METHODDEF \
|
||||||
{"format", (PyCFunction)builtin_format, METH_VARARGS, builtin_format__doc__},
|
{"format", (PyCFunction)builtin_format, METH_FASTCALL, builtin_format__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec);
|
builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_format(PyObject *module, PyObject *args)
|
builtin_format(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
PyObject *format_spec = NULL;
|
PyObject *format_spec = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O|U:format",
|
if (!_PyArg_ParseStack(args, nargs, "O|U:format",
|
||||||
&value, &format_spec)) {
|
&value, &format_spec)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("format", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_format_impl(module, value, format_spec);
|
return_value = builtin_format_impl(module, value, format_spec);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -127,9 +124,16 @@ builtin_chr_impl(PyObject *module, int i);
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_chr(PyObject *module, PyObject *arg)
|
builtin_chr(PyObject *module, PyObject *arg)
|
||||||
{
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
int i;
|
int i;
|
||||||
if (!PyArg_Parse(arg, "i:chr", &i)) return 0;
|
|
||||||
return builtin_chr_impl(module, i);
|
if (!PyArg_Parse(arg, "i:chr", &i)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = builtin_chr_impl(module, i);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(builtin_compile__doc__,
|
PyDoc_STRVAR(builtin_compile__doc__,
|
||||||
|
@ -171,7 +175,7 @@ builtin_compile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *k
|
||||||
int dont_inherit = 0;
|
int dont_inherit = 0;
|
||||||
int optimize = -1;
|
int optimize = -1;
|
||||||
|
|
||||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||||
&source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize)) {
|
&source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -188,23 +192,27 @@ PyDoc_STRVAR(builtin_divmod__doc__,
|
||||||
"Return the tuple (x//y, x%y). Invariant: div*y + mod == x.");
|
"Return the tuple (x//y, x%y). Invariant: div*y + mod == x.");
|
||||||
|
|
||||||
#define BUILTIN_DIVMOD_METHODDEF \
|
#define BUILTIN_DIVMOD_METHODDEF \
|
||||||
{"divmod", (PyCFunction)builtin_divmod, METH_VARARGS, builtin_divmod__doc__},
|
{"divmod", (PyCFunction)builtin_divmod, METH_FASTCALL, builtin_divmod__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y);
|
builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_divmod(PyObject *module, PyObject *args)
|
builtin_divmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *x;
|
PyObject *x;
|
||||||
PyObject *y;
|
PyObject *y;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "divmod",
|
if (!_PyArg_UnpackStack(args, nargs, "divmod",
|
||||||
2, 2,
|
2, 2,
|
||||||
&x, &y)) {
|
&x, &y)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("divmod", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_divmod_impl(module, x, y);
|
return_value = builtin_divmod_impl(module, x, y);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -224,25 +232,29 @@ PyDoc_STRVAR(builtin_eval__doc__,
|
||||||
"If only globals is given, locals defaults to it.");
|
"If only globals is given, locals defaults to it.");
|
||||||
|
|
||||||
#define BUILTIN_EVAL_METHODDEF \
|
#define BUILTIN_EVAL_METHODDEF \
|
||||||
{"eval", (PyCFunction)builtin_eval, METH_VARARGS, builtin_eval__doc__},
|
{"eval", (PyCFunction)builtin_eval, METH_FASTCALL, builtin_eval__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals,
|
builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals,
|
||||||
PyObject *locals);
|
PyObject *locals);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_eval(PyObject *module, PyObject *args)
|
builtin_eval(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *source;
|
PyObject *source;
|
||||||
PyObject *globals = Py_None;
|
PyObject *globals = Py_None;
|
||||||
PyObject *locals = Py_None;
|
PyObject *locals = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "eval",
|
if (!_PyArg_UnpackStack(args, nargs, "eval",
|
||||||
1, 3,
|
1, 3,
|
||||||
&source, &globals, &locals)) {
|
&source, &globals, &locals)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("eval", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_eval_impl(module, source, globals, locals);
|
return_value = builtin_eval_impl(module, source, globals, locals);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -262,25 +274,29 @@ PyDoc_STRVAR(builtin_exec__doc__,
|
||||||
"If only globals is given, locals defaults to it.");
|
"If only globals is given, locals defaults to it.");
|
||||||
|
|
||||||
#define BUILTIN_EXEC_METHODDEF \
|
#define BUILTIN_EXEC_METHODDEF \
|
||||||
{"exec", (PyCFunction)builtin_exec, METH_VARARGS, builtin_exec__doc__},
|
{"exec", (PyCFunction)builtin_exec, METH_FASTCALL, builtin_exec__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
|
builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
|
||||||
PyObject *locals);
|
PyObject *locals);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_exec(PyObject *module, PyObject *args)
|
builtin_exec(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *source;
|
PyObject *source;
|
||||||
PyObject *globals = Py_None;
|
PyObject *globals = Py_None;
|
||||||
PyObject *locals = Py_None;
|
PyObject *locals = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "exec",
|
if (!_PyArg_UnpackStack(args, nargs, "exec",
|
||||||
1, 3,
|
1, 3,
|
||||||
&source, &globals, &locals)) {
|
&source, &globals, &locals)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("exec", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_exec_impl(module, source, globals, locals);
|
return_value = builtin_exec_impl(module, source, globals, locals);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -317,23 +333,27 @@ PyDoc_STRVAR(builtin_hasattr__doc__,
|
||||||
"This is done by calling getattr(obj, name) and catching AttributeError.");
|
"This is done by calling getattr(obj, name) and catching AttributeError.");
|
||||||
|
|
||||||
#define BUILTIN_HASATTR_METHODDEF \
|
#define BUILTIN_HASATTR_METHODDEF \
|
||||||
{"hasattr", (PyCFunction)builtin_hasattr, METH_VARARGS, builtin_hasattr__doc__},
|
{"hasattr", (PyCFunction)builtin_hasattr, METH_FASTCALL, builtin_hasattr__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name);
|
builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_hasattr(PyObject *module, PyObject *args)
|
builtin_hasattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
PyObject *name;
|
PyObject *name;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "hasattr",
|
if (!_PyArg_UnpackStack(args, nargs, "hasattr",
|
||||||
2, 2,
|
2, 2,
|
||||||
&obj, &name)) {
|
&obj, &name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("hasattr", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_hasattr_impl(module, obj, name);
|
return_value = builtin_hasattr_impl(module, obj, name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -361,25 +381,29 @@ PyDoc_STRVAR(builtin_setattr__doc__,
|
||||||
"setattr(x, \'y\', v) is equivalent to ``x.y = v\'\'");
|
"setattr(x, \'y\', v) is equivalent to ``x.y = v\'\'");
|
||||||
|
|
||||||
#define BUILTIN_SETATTR_METHODDEF \
|
#define BUILTIN_SETATTR_METHODDEF \
|
||||||
{"setattr", (PyCFunction)builtin_setattr, METH_VARARGS, builtin_setattr__doc__},
|
{"setattr", (PyCFunction)builtin_setattr, METH_FASTCALL, builtin_setattr__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name,
|
builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name,
|
||||||
PyObject *value);
|
PyObject *value);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_setattr(PyObject *module, PyObject *args)
|
builtin_setattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
PyObject *name;
|
PyObject *name;
|
||||||
PyObject *value;
|
PyObject *value;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "setattr",
|
if (!_PyArg_UnpackStack(args, nargs, "setattr",
|
||||||
3, 3,
|
3, 3,
|
||||||
&obj, &name, &value)) {
|
&obj, &name, &value)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("setattr", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_setattr_impl(module, obj, name, value);
|
return_value = builtin_setattr_impl(module, obj, name, value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -395,23 +419,27 @@ PyDoc_STRVAR(builtin_delattr__doc__,
|
||||||
"delattr(x, \'y\') is equivalent to ``del x.y\'\'");
|
"delattr(x, \'y\') is equivalent to ``del x.y\'\'");
|
||||||
|
|
||||||
#define BUILTIN_DELATTR_METHODDEF \
|
#define BUILTIN_DELATTR_METHODDEF \
|
||||||
{"delattr", (PyCFunction)builtin_delattr, METH_VARARGS, builtin_delattr__doc__},
|
{"delattr", (PyCFunction)builtin_delattr, METH_FASTCALL, builtin_delattr__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name);
|
builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_delattr(PyObject *module, PyObject *args)
|
builtin_delattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
PyObject *name;
|
PyObject *name;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "delattr",
|
if (!_PyArg_UnpackStack(args, nargs, "delattr",
|
||||||
2, 2,
|
2, 2,
|
||||||
&obj, &name)) {
|
&obj, &name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("delattr", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_delattr_impl(module, obj, name);
|
return_value = builtin_delattr_impl(module, obj, name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -504,24 +532,28 @@ PyDoc_STRVAR(builtin_pow__doc__,
|
||||||
"invoked using the three argument form.");
|
"invoked using the three argument form.");
|
||||||
|
|
||||||
#define BUILTIN_POW_METHODDEF \
|
#define BUILTIN_POW_METHODDEF \
|
||||||
{"pow", (PyCFunction)builtin_pow, METH_VARARGS, builtin_pow__doc__},
|
{"pow", (PyCFunction)builtin_pow, METH_FASTCALL, builtin_pow__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_pow_impl(PyObject *module, PyObject *x, PyObject *y, PyObject *z);
|
builtin_pow_impl(PyObject *module, PyObject *x, PyObject *y, PyObject *z);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_pow(PyObject *module, PyObject *args)
|
builtin_pow(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *x;
|
PyObject *x;
|
||||||
PyObject *y;
|
PyObject *y;
|
||||||
PyObject *z = Py_None;
|
PyObject *z = Py_None;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "pow",
|
if (!_PyArg_UnpackStack(args, nargs, "pow",
|
||||||
2, 3,
|
2, 3,
|
||||||
&x, &y, &z)) {
|
&x, &y, &z)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("pow", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_pow_impl(module, x, y, z);
|
return_value = builtin_pow_impl(module, x, y, z);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -541,22 +573,26 @@ PyDoc_STRVAR(builtin_input__doc__,
|
||||||
"On *nix systems, readline is used if available.");
|
"On *nix systems, readline is used if available.");
|
||||||
|
|
||||||
#define BUILTIN_INPUT_METHODDEF \
|
#define BUILTIN_INPUT_METHODDEF \
|
||||||
{"input", (PyCFunction)builtin_input, METH_VARARGS, builtin_input__doc__},
|
{"input", (PyCFunction)builtin_input, METH_FASTCALL, builtin_input__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_input_impl(PyObject *module, PyObject *prompt);
|
builtin_input_impl(PyObject *module, PyObject *prompt);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_input(PyObject *module, PyObject *args)
|
builtin_input(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *prompt = NULL;
|
PyObject *prompt = NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "input",
|
if (!_PyArg_UnpackStack(args, nargs, "input",
|
||||||
0, 1,
|
0, 1,
|
||||||
&prompt)) {
|
&prompt)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("input", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_input_impl(module, prompt);
|
return_value = builtin_input_impl(module, prompt);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -585,23 +621,27 @@ PyDoc_STRVAR(builtin_sum__doc__,
|
||||||
"reject non-numeric types.");
|
"reject non-numeric types.");
|
||||||
|
|
||||||
#define BUILTIN_SUM_METHODDEF \
|
#define BUILTIN_SUM_METHODDEF \
|
||||||
{"sum", (PyCFunction)builtin_sum, METH_VARARGS, builtin_sum__doc__},
|
{"sum", (PyCFunction)builtin_sum, METH_FASTCALL, builtin_sum__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start);
|
builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_sum(PyObject *module, PyObject *args)
|
builtin_sum(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *iterable;
|
PyObject *iterable;
|
||||||
PyObject *start = NULL;
|
PyObject *start = NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "sum",
|
if (!_PyArg_UnpackStack(args, nargs, "sum",
|
||||||
1, 2,
|
1, 2,
|
||||||
&iterable, &start)) {
|
&iterable, &start)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("sum", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_sum_impl(module, iterable, start);
|
return_value = builtin_sum_impl(module, iterable, start);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -619,24 +659,28 @@ PyDoc_STRVAR(builtin_isinstance__doc__,
|
||||||
"or ...`` etc.");
|
"or ...`` etc.");
|
||||||
|
|
||||||
#define BUILTIN_ISINSTANCE_METHODDEF \
|
#define BUILTIN_ISINSTANCE_METHODDEF \
|
||||||
{"isinstance", (PyCFunction)builtin_isinstance, METH_VARARGS, builtin_isinstance__doc__},
|
{"isinstance", (PyCFunction)builtin_isinstance, METH_FASTCALL, builtin_isinstance__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_isinstance_impl(PyObject *module, PyObject *obj,
|
builtin_isinstance_impl(PyObject *module, PyObject *obj,
|
||||||
PyObject *class_or_tuple);
|
PyObject *class_or_tuple);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_isinstance(PyObject *module, PyObject *args)
|
builtin_isinstance(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
PyObject *class_or_tuple;
|
PyObject *class_or_tuple;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "isinstance",
|
if (!_PyArg_UnpackStack(args, nargs, "isinstance",
|
||||||
2, 2,
|
2, 2,
|
||||||
&obj, &class_or_tuple)) {
|
&obj, &class_or_tuple)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("isinstance", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_isinstance_impl(module, obj, class_or_tuple);
|
return_value = builtin_isinstance_impl(module, obj, class_or_tuple);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -654,27 +698,31 @@ PyDoc_STRVAR(builtin_issubclass__doc__,
|
||||||
"or ...`` etc.");
|
"or ...`` etc.");
|
||||||
|
|
||||||
#define BUILTIN_ISSUBCLASS_METHODDEF \
|
#define BUILTIN_ISSUBCLASS_METHODDEF \
|
||||||
{"issubclass", (PyCFunction)builtin_issubclass, METH_VARARGS, builtin_issubclass__doc__},
|
{"issubclass", (PyCFunction)builtin_issubclass, METH_FASTCALL, builtin_issubclass__doc__},
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_issubclass_impl(PyObject *module, PyObject *cls,
|
builtin_issubclass_impl(PyObject *module, PyObject *cls,
|
||||||
PyObject *class_or_tuple);
|
PyObject *class_or_tuple);
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
builtin_issubclass(PyObject *module, PyObject *args)
|
builtin_issubclass(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *return_value = NULL;
|
PyObject *return_value = NULL;
|
||||||
PyObject *cls;
|
PyObject *cls;
|
||||||
PyObject *class_or_tuple;
|
PyObject *class_or_tuple;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "issubclass",
|
if (!_PyArg_UnpackStack(args, nargs, "issubclass",
|
||||||
2, 2,
|
2, 2,
|
||||||
&cls, &class_or_tuple)) {
|
&cls, &class_or_tuple)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("issubclass", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
return_value = builtin_issubclass_impl(module, cls, class_or_tuple);
|
return_value = builtin_issubclass_impl(module, cls, class_or_tuple);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=2ef82846acdfa0f5 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=17fedd2dec148677 input=a9049054013a1b77]*/
|
||||||
|
|
485
third_party/python/Python/clinic/import.inc
vendored
485
third_party/python/Python/clinic/import.inc
vendored
|
@ -1,348 +1,373 @@
|
||||||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
/* clang-format off */
|
||||||
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
|
||||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
||||||
│ Python 3 │
|
|
||||||
│ https://docs.python.org/3/license.html │
|
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
||||||
#include "third_party/python/Include/pymacro.h"
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
preserve
|
preserve
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_lock_held__doc__,
|
PyDoc_STRVAR(_imp_lock_held__doc__,
|
||||||
"lock_held($module, /)\n"
|
"lock_held($module, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Return True if the import lock is currently held, else False.\n"
|
"Return True if the import lock is currently held, else False.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"On platforms without threads, return False.");
|
"On platforms without threads, return False.");
|
||||||
|
|
||||||
#define _IMP_LOCK_HELD_METHODDEF \
|
#define _IMP_LOCK_HELD_METHODDEF \
|
||||||
{"lock_held", (PyCFunction)_imp_lock_held, METH_NOARGS, \
|
{"lock_held", (PyCFunction)_imp_lock_held, METH_NOARGS, _imp_lock_held__doc__},
|
||||||
_imp_lock_held__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp_lock_held_impl(PyObject *module);
|
static PyObject *
|
||||||
|
_imp_lock_held_impl(PyObject *module);
|
||||||
|
|
||||||
static PyObject *_imp_lock_held(PyObject *module,
|
static PyObject *
|
||||||
PyObject *Py_UNUSED(ignored)) {
|
_imp_lock_held(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
return _imp_lock_held_impl(module);
|
{
|
||||||
|
return _imp_lock_held_impl(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(_imp_acquire_lock__doc__,
|
||||||
_imp_acquire_lock__doc__,
|
"acquire_lock($module, /)\n"
|
||||||
"acquire_lock($module, /)\n"
|
"--\n"
|
||||||
"--\n"
|
"\n"
|
||||||
"\n"
|
"Acquires the interpreter\'s import lock for the current thread.\n"
|
||||||
"Acquires the interpreter\'s import lock for the current thread.\n"
|
"\n"
|
||||||
"\n"
|
"This lock should be used by import hooks to ensure thread-safety when importing\n"
|
||||||
"This lock should be used by import hooks to ensure thread-safety when "
|
"modules. On platforms without threads, this function does nothing.");
|
||||||
"importing\n"
|
|
||||||
"modules. On platforms without threads, this function does nothing.");
|
|
||||||
|
|
||||||
#define _IMP_ACQUIRE_LOCK_METHODDEF \
|
#define _IMP_ACQUIRE_LOCK_METHODDEF \
|
||||||
{"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, \
|
{"acquire_lock", (PyCFunction)_imp_acquire_lock, METH_NOARGS, _imp_acquire_lock__doc__},
|
||||||
_imp_acquire_lock__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp_acquire_lock_impl(PyObject *module);
|
static PyObject *
|
||||||
|
_imp_acquire_lock_impl(PyObject *module);
|
||||||
|
|
||||||
static PyObject *_imp_acquire_lock(PyObject *module,
|
static PyObject *
|
||||||
PyObject *Py_UNUSED(ignored)) {
|
_imp_acquire_lock(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
return _imp_acquire_lock_impl(module);
|
{
|
||||||
|
return _imp_acquire_lock_impl(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_release_lock__doc__,
|
PyDoc_STRVAR(_imp_release_lock__doc__,
|
||||||
"release_lock($module, /)\n"
|
"release_lock($module, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Release the interpreter\'s import lock.\n"
|
"Release the interpreter\'s import lock.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"On platforms without threads, this function does nothing.");
|
"On platforms without threads, this function does nothing.");
|
||||||
|
|
||||||
#define _IMP_RELEASE_LOCK_METHODDEF \
|
#define _IMP_RELEASE_LOCK_METHODDEF \
|
||||||
{"release_lock", (PyCFunction)_imp_release_lock, METH_NOARGS, \
|
{"release_lock", (PyCFunction)_imp_release_lock, METH_NOARGS, _imp_release_lock__doc__},
|
||||||
_imp_release_lock__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp_release_lock_impl(PyObject *module);
|
static PyObject *
|
||||||
|
_imp_release_lock_impl(PyObject *module);
|
||||||
|
|
||||||
static PyObject *_imp_release_lock(PyObject *module,
|
static PyObject *
|
||||||
PyObject *Py_UNUSED(ignored)) {
|
_imp_release_lock(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
return _imp_release_lock_impl(module);
|
{
|
||||||
|
return _imp_release_lock_impl(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp__fix_co_filename__doc__,
|
PyDoc_STRVAR(_imp__fix_co_filename__doc__,
|
||||||
"_fix_co_filename($module, code, path, /)\n"
|
"_fix_co_filename($module, code, path, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Changes code.co_filename to specify the passed-in file path.\n"
|
"Changes code.co_filename to specify the passed-in file path.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" code\n"
|
" code\n"
|
||||||
" Code object to change.\n"
|
" Code object to change.\n"
|
||||||
" path\n"
|
" path\n"
|
||||||
" File path to use.");
|
" File path to use.");
|
||||||
|
|
||||||
#define _IMP__FIX_CO_FILENAME_METHODDEF \
|
#define _IMP__FIX_CO_FILENAME_METHODDEF \
|
||||||
{"_fix_co_filename", (PyCFunction)_imp__fix_co_filename, METH_VARARGS, \
|
{"_fix_co_filename", (PyCFunction)_imp__fix_co_filename, METH_FASTCALL, _imp__fix_co_filename__doc__},
|
||||||
_imp__fix_co_filename__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp__fix_co_filename_impl(PyObject *module,
|
static PyObject *
|
||||||
PyCodeObject *code, PyObject *path);
|
_imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code,
|
||||||
|
PyObject *path);
|
||||||
|
|
||||||
static PyObject *_imp__fix_co_filename(PyObject *module, PyObject *args) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
PyCodeObject *code;
|
{
|
||||||
PyObject *path;
|
PyObject *return_value = NULL;
|
||||||
|
PyCodeObject *code;
|
||||||
|
PyObject *path;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O!U:_fix_co_filename", &PyCode_Type, &code,
|
if (!_PyArg_ParseStack(args, nargs, "O!U:_fix_co_filename",
|
||||||
&path)) {
|
&PyCode_Type, &code, &path)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = _imp__fix_co_filename_impl(module, code, path);
|
|
||||||
|
if (!_PyArg_NoStackKeywords("_fix_co_filename", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = _imp__fix_co_filename_impl(module, code, path);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_create_builtin__doc__, "create_builtin($module, spec, /)\n"
|
PyDoc_STRVAR(_imp_create_builtin__doc__,
|
||||||
"--\n"
|
"create_builtin($module, spec, /)\n"
|
||||||
"\n"
|
"--\n"
|
||||||
"Create an extension module.");
|
"\n"
|
||||||
|
"Create an extension module.");
|
||||||
|
|
||||||
#define _IMP_CREATE_BUILTIN_METHODDEF \
|
#define _IMP_CREATE_BUILTIN_METHODDEF \
|
||||||
{"create_builtin", (PyCFunction)_imp_create_builtin, METH_O, \
|
{"create_builtin", (PyCFunction)_imp_create_builtin, METH_O, _imp_create_builtin__doc__},
|
||||||
_imp_create_builtin__doc__},
|
|
||||||
|
|
||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(_imp_extension_suffixes__doc__,
|
||||||
_imp_extension_suffixes__doc__,
|
"extension_suffixes($module, /)\n"
|
||||||
"extension_suffixes($module, /)\n"
|
"--\n"
|
||||||
"--\n"
|
"\n"
|
||||||
"\n"
|
"Returns the list of file suffixes used to identify extension modules.");
|
||||||
"Returns the list of file suffixes used to identify extension modules.");
|
|
||||||
|
|
||||||
#define _IMP_EXTENSION_SUFFIXES_METHODDEF \
|
#define _IMP_EXTENSION_SUFFIXES_METHODDEF \
|
||||||
{"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, \
|
{"extension_suffixes", (PyCFunction)_imp_extension_suffixes, METH_NOARGS, _imp_extension_suffixes__doc__},
|
||||||
_imp_extension_suffixes__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp_extension_suffixes_impl(PyObject *module);
|
static PyObject *
|
||||||
|
_imp_extension_suffixes_impl(PyObject *module);
|
||||||
|
|
||||||
static PyObject *_imp_extension_suffixes(PyObject *module,
|
static PyObject *
|
||||||
PyObject *Py_UNUSED(ignored)) {
|
_imp_extension_suffixes(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
return _imp_extension_suffixes_impl(module);
|
{
|
||||||
|
return _imp_extension_suffixes_impl(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_init_frozen__doc__, "init_frozen($module, name, /)\n"
|
PyDoc_STRVAR(_imp_init_frozen__doc__,
|
||||||
"--\n"
|
"init_frozen($module, name, /)\n"
|
||||||
"\n"
|
"--\n"
|
||||||
"Initializes a frozen module.");
|
"\n"
|
||||||
|
"Initializes a frozen module.");
|
||||||
|
|
||||||
#define _IMP_INIT_FROZEN_METHODDEF \
|
#define _IMP_INIT_FROZEN_METHODDEF \
|
||||||
{"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, \
|
{"init_frozen", (PyCFunction)_imp_init_frozen, METH_O, _imp_init_frozen__doc__},
|
||||||
_imp_init_frozen__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp_init_frozen_impl(PyObject *module, PyObject *name);
|
static PyObject *
|
||||||
|
_imp_init_frozen_impl(PyObject *module, PyObject *name);
|
||||||
|
|
||||||
static PyObject *_imp_init_frozen(PyObject *module, PyObject *arg) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp_init_frozen(PyObject *module, PyObject *arg)
|
||||||
PyObject *name;
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *name;
|
||||||
|
|
||||||
if (!PyArg_Parse(arg, "U:init_frozen", &name)) {
|
if (!PyArg_Parse(arg, "U:init_frozen", &name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = _imp_init_frozen_impl(module, name);
|
return_value = _imp_init_frozen_impl(module, name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_get_frozen_object__doc__,
|
PyDoc_STRVAR(_imp_get_frozen_object__doc__,
|
||||||
"get_frozen_object($module, name, /)\n"
|
"get_frozen_object($module, name, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Create a code object for a frozen module.");
|
"Create a code object for a frozen module.");
|
||||||
|
|
||||||
#define _IMP_GET_FROZEN_OBJECT_METHODDEF \
|
#define _IMP_GET_FROZEN_OBJECT_METHODDEF \
|
||||||
{"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_O, \
|
{"get_frozen_object", (PyCFunction)_imp_get_frozen_object, METH_O, _imp_get_frozen_object__doc__},
|
||||||
_imp_get_frozen_object__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp_get_frozen_object_impl(PyObject *module, PyObject *name);
|
static PyObject *
|
||||||
|
_imp_get_frozen_object_impl(PyObject *module, PyObject *name);
|
||||||
|
|
||||||
static PyObject *_imp_get_frozen_object(PyObject *module, PyObject *arg) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp_get_frozen_object(PyObject *module, PyObject *arg)
|
||||||
PyObject *name;
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *name;
|
||||||
|
|
||||||
if (!PyArg_Parse(arg, "U:get_frozen_object", &name)) {
|
if (!PyArg_Parse(arg, "U:get_frozen_object", &name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = _imp_get_frozen_object_impl(module, name);
|
return_value = _imp_get_frozen_object_impl(module, name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_is_frozen_package__doc__,
|
PyDoc_STRVAR(_imp_is_frozen_package__doc__,
|
||||||
"is_frozen_package($module, name, /)\n"
|
"is_frozen_package($module, name, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Returns True if the module name is of a frozen package.");
|
"Returns True if the module name is of a frozen package.");
|
||||||
|
|
||||||
#define _IMP_IS_FROZEN_PACKAGE_METHODDEF \
|
#define _IMP_IS_FROZEN_PACKAGE_METHODDEF \
|
||||||
{"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, \
|
{"is_frozen_package", (PyCFunction)_imp_is_frozen_package, METH_O, _imp_is_frozen_package__doc__},
|
||||||
_imp_is_frozen_package__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp_is_frozen_package_impl(PyObject *module, PyObject *name);
|
static PyObject *
|
||||||
|
_imp_is_frozen_package_impl(PyObject *module, PyObject *name);
|
||||||
|
|
||||||
static PyObject *_imp_is_frozen_package(PyObject *module, PyObject *arg) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp_is_frozen_package(PyObject *module, PyObject *arg)
|
||||||
PyObject *name;
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *name;
|
||||||
|
|
||||||
if (!PyArg_Parse(arg, "U:is_frozen_package", &name)) {
|
if (!PyArg_Parse(arg, "U:is_frozen_package", &name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = _imp_is_frozen_package_impl(module, name);
|
return_value = _imp_is_frozen_package_impl(module, name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(_imp_is_builtin__doc__,
|
||||||
_imp_is_builtin__doc__,
|
"is_builtin($module, name, /)\n"
|
||||||
"is_builtin($module, name, /)\n"
|
"--\n"
|
||||||
"--\n"
|
"\n"
|
||||||
"\n"
|
"Returns True if the module name corresponds to a built-in module.");
|
||||||
"Returns True if the module name corresponds to a built-in module.");
|
|
||||||
|
|
||||||
#define _IMP_IS_BUILTIN_METHODDEF \
|
#define _IMP_IS_BUILTIN_METHODDEF \
|
||||||
{"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__},
|
{"is_builtin", (PyCFunction)_imp_is_builtin, METH_O, _imp_is_builtin__doc__},
|
||||||
|
|
||||||
static PyObject *_imp_is_builtin_impl(PyObject *module, PyObject *name);
|
static PyObject *
|
||||||
|
_imp_is_builtin_impl(PyObject *module, PyObject *name);
|
||||||
|
|
||||||
static PyObject *_imp_is_builtin(PyObject *module, PyObject *arg) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp_is_builtin(PyObject *module, PyObject *arg)
|
||||||
PyObject *name;
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *name;
|
||||||
|
|
||||||
if (!PyArg_Parse(arg, "U:is_builtin", &name)) {
|
if (!PyArg_Parse(arg, "U:is_builtin", &name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = _imp_is_builtin_impl(module, name);
|
return_value = _imp_is_builtin_impl(module, name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_is_frozen__doc__,
|
PyDoc_STRVAR(_imp_is_frozen__doc__,
|
||||||
"is_frozen($module, name, /)\n"
|
"is_frozen($module, name, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Returns True if the module name corresponds to a frozen module.");
|
"Returns True if the module name corresponds to a frozen module.");
|
||||||
|
|
||||||
#define _IMP_IS_FROZEN_METHODDEF \
|
#define _IMP_IS_FROZEN_METHODDEF \
|
||||||
{"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__},
|
{"is_frozen", (PyCFunction)_imp_is_frozen, METH_O, _imp_is_frozen__doc__},
|
||||||
|
|
||||||
static PyObject *_imp_is_frozen_impl(PyObject *module, PyObject *name);
|
static PyObject *
|
||||||
|
_imp_is_frozen_impl(PyObject *module, PyObject *name);
|
||||||
|
|
||||||
static PyObject *_imp_is_frozen(PyObject *module, PyObject *arg) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp_is_frozen(PyObject *module, PyObject *arg)
|
||||||
PyObject *name;
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *name;
|
||||||
|
|
||||||
if (!PyArg_Parse(arg, "U:is_frozen", &name)) {
|
if (!PyArg_Parse(arg, "U:is_frozen", &name)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = _imp_is_frozen_impl(module, name);
|
return_value = _imp_is_frozen_impl(module, name);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_DYNAMIC_LOADING)
|
#if defined(HAVE_DYNAMIC_LOADING)
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_create_dynamic__doc__,
|
PyDoc_STRVAR(_imp_create_dynamic__doc__,
|
||||||
"create_dynamic($module, spec, file=None, /)\n"
|
"create_dynamic($module, spec, file=None, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Create an extension module.");
|
"Create an extension module.");
|
||||||
|
|
||||||
#define _IMP_CREATE_DYNAMIC_METHODDEF \
|
#define _IMP_CREATE_DYNAMIC_METHODDEF \
|
||||||
{"create_dynamic", (PyCFunction)_imp_create_dynamic, METH_VARARGS, \
|
{"create_dynamic", (PyCFunction)_imp_create_dynamic, METH_FASTCALL, _imp_create_dynamic__doc__},
|
||||||
_imp_create_dynamic__doc__},
|
|
||||||
|
|
||||||
static PyObject *_imp_create_dynamic_impl(PyObject *module, PyObject *spec,
|
static PyObject *
|
||||||
PyObject *file);
|
_imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file);
|
||||||
|
|
||||||
static PyObject *_imp_create_dynamic(PyObject *module, PyObject *args) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
PyObject *spec;
|
{
|
||||||
PyObject *file = NULL;
|
PyObject *return_value = NULL;
|
||||||
|
PyObject *spec;
|
||||||
|
PyObject *file = NULL;
|
||||||
|
|
||||||
if (!PyArg_UnpackTuple(args, "create_dynamic", 1, 2, &spec, &file)) {
|
if (!_PyArg_UnpackStack(args, nargs, "create_dynamic",
|
||||||
goto exit;
|
1, 2,
|
||||||
}
|
&spec, &file)) {
|
||||||
return_value = _imp_create_dynamic_impl(module, spec, file);
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_PyArg_NoStackKeywords("create_dynamic", kwnames)) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
return_value = _imp_create_dynamic_impl(module, spec, file);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(HAVE_DYNAMIC_LOADING) */
|
#endif /* defined(HAVE_DYNAMIC_LOADING) */
|
||||||
|
|
||||||
#if defined(HAVE_DYNAMIC_LOADING)
|
#if defined(HAVE_DYNAMIC_LOADING)
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_exec_dynamic__doc__, "exec_dynamic($module, mod, /)\n"
|
PyDoc_STRVAR(_imp_exec_dynamic__doc__,
|
||||||
"--\n"
|
"exec_dynamic($module, mod, /)\n"
|
||||||
"\n"
|
"--\n"
|
||||||
"Initialize an extension module.");
|
"\n"
|
||||||
|
"Initialize an extension module.");
|
||||||
|
|
||||||
#define _IMP_EXEC_DYNAMIC_METHODDEF \
|
#define _IMP_EXEC_DYNAMIC_METHODDEF \
|
||||||
{"exec_dynamic", (PyCFunction)_imp_exec_dynamic, METH_O, \
|
{"exec_dynamic", (PyCFunction)_imp_exec_dynamic, METH_O, _imp_exec_dynamic__doc__},
|
||||||
_imp_exec_dynamic__doc__},
|
|
||||||
|
|
||||||
static int _imp_exec_dynamic_impl(PyObject *module, PyObject *mod);
|
static int
|
||||||
|
_imp_exec_dynamic_impl(PyObject *module, PyObject *mod);
|
||||||
|
|
||||||
static PyObject *_imp_exec_dynamic(PyObject *module, PyObject *mod) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp_exec_dynamic(PyObject *module, PyObject *mod)
|
||||||
int _return_value;
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
int _return_value;
|
||||||
|
|
||||||
_return_value = _imp_exec_dynamic_impl(module, mod);
|
_return_value = _imp_exec_dynamic_impl(module, mod);
|
||||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = PyLong_FromLong((long)_return_value);
|
return_value = PyLong_FromLong((long)_return_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(HAVE_DYNAMIC_LOADING) */
|
#endif /* defined(HAVE_DYNAMIC_LOADING) */
|
||||||
|
|
||||||
PyDoc_STRVAR(_imp_exec_builtin__doc__, "exec_builtin($module, mod, /)\n"
|
PyDoc_STRVAR(_imp_exec_builtin__doc__,
|
||||||
"--\n"
|
"exec_builtin($module, mod, /)\n"
|
||||||
"\n"
|
"--\n"
|
||||||
"Initialize a built-in module.");
|
"\n"
|
||||||
|
"Initialize a built-in module.");
|
||||||
|
|
||||||
#define _IMP_EXEC_BUILTIN_METHODDEF \
|
#define _IMP_EXEC_BUILTIN_METHODDEF \
|
||||||
{"exec_builtin", (PyCFunction)_imp_exec_builtin, METH_O, \
|
{"exec_builtin", (PyCFunction)_imp_exec_builtin, METH_O, _imp_exec_builtin__doc__},
|
||||||
_imp_exec_builtin__doc__},
|
|
||||||
|
|
||||||
static int _imp_exec_builtin_impl(PyObject *module, PyObject *mod);
|
static int
|
||||||
|
_imp_exec_builtin_impl(PyObject *module, PyObject *mod);
|
||||||
|
|
||||||
static PyObject *_imp_exec_builtin(PyObject *module, PyObject *mod) {
|
static PyObject *
|
||||||
PyObject *return_value = NULL;
|
_imp_exec_builtin(PyObject *module, PyObject *mod)
|
||||||
int _return_value;
|
{
|
||||||
|
PyObject *return_value = NULL;
|
||||||
|
int _return_value;
|
||||||
|
|
||||||
_return_value = _imp_exec_builtin_impl(module, mod);
|
_return_value = _imp_exec_builtin_impl(module, mod);
|
||||||
if ((_return_value == -1) && PyErr_Occurred()) {
|
if ((_return_value == -1) && PyErr_Occurred()) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
return_value = PyLong_FromLong((long)_return_value);
|
return_value = PyLong_FromLong((long)_return_value);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _IMP_CREATE_DYNAMIC_METHODDEF
|
#ifndef _IMP_CREATE_DYNAMIC_METHODDEF
|
||||||
#define _IMP_CREATE_DYNAMIC_METHODDEF
|
#define _IMP_CREATE_DYNAMIC_METHODDEF
|
||||||
#endif /* !defined(_IMP_CREATE_DYNAMIC_METHODDEF) */
|
#endif /* !defined(_IMP_CREATE_DYNAMIC_METHODDEF) */
|
||||||
|
|
||||||
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
|
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
|
||||||
#define _IMP_EXEC_DYNAMIC_METHODDEF
|
#define _IMP_EXEC_DYNAMIC_METHODDEF
|
||||||
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
|
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
|
||||||
/*[clinic end generated code: output=d24d7f73702a907f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=c1d0e65d04114958 input=a9049054013a1b77]*/
|
||||||
|
|
569
third_party/python/Python/getargs.c
vendored
569
third_party/python/Python/getargs.c
vendored
File diff suppressed because it is too large
Load diff
25
third_party/python/Python/marshal.c
vendored
25
third_party/python/Python/marshal.c
vendored
|
@ -1688,7 +1688,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
|
||||||
/* And an interface for Python programs... */
|
/* And an interface for Python programs... */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
marshal_dump(PyObject *self, PyObject *args)
|
marshal_dump(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
/* XXX Quick hack -- need to do this differently */
|
/* XXX Quick hack -- need to do this differently */
|
||||||
PyObject *x;
|
PyObject *x;
|
||||||
|
@ -1698,8 +1698,11 @@ marshal_dump(PyObject *self, PyObject *args)
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
_Py_IDENTIFIER(write);
|
_Py_IDENTIFIER(write);
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "OO|i:dump", &x, &f, &version))
|
if (!_PyArg_ParseStack(args, nargs, "OO|i:dump", &x, &f, &version))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (!_PyArg_NoStackKeywords("dump", kwnames))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
s = PyMarshal_WriteObjectToString(x, version);
|
s = PyMarshal_WriteObjectToString(x, version);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1775,11 +1778,13 @@ dump(), load() will substitute None for the unmarshallable type.");
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
marshal_dumps(PyObject *self, PyObject *args)
|
marshal_dumps(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
PyObject *x;
|
PyObject *x;
|
||||||
int version = Py_MARSHAL_VERSION;
|
int version = Py_MARSHAL_VERSION;
|
||||||
if (!PyArg_ParseTuple(args, "O|i:dumps", &x, &version))
|
if (!_PyArg_ParseStack(args, nargs, "O|i:dumps", &x, &version))
|
||||||
|
return NULL;
|
||||||
|
if(!_PyArg_NoStackKeywords("dumps", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
return PyMarshal_WriteObjectToString(x, version);
|
return PyMarshal_WriteObjectToString(x, version);
|
||||||
}
|
}
|
||||||
|
@ -1795,14 +1800,16 @@ The version argument indicates the data format that dumps should use.");
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
marshal_loads(PyObject *self, PyObject *args)
|
marshal_loads(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||||
{
|
{
|
||||||
RFILE rf;
|
RFILE rf;
|
||||||
Py_buffer p;
|
Py_buffer p;
|
||||||
char *s;
|
char *s;
|
||||||
Py_ssize_t n;
|
Py_ssize_t n;
|
||||||
PyObject* result;
|
PyObject* result;
|
||||||
if (!PyArg_ParseTuple(args, "y*:loads", &p))
|
if (!_PyArg_ParseStack(args, nargs, "y*:loads", &p))
|
||||||
|
return NULL;
|
||||||
|
if(!_PyArg_NoStackKeywords("loads", kwnames))
|
||||||
return NULL;
|
return NULL;
|
||||||
s = p.buf;
|
s = p.buf;
|
||||||
n = p.len;
|
n = p.len;
|
||||||
|
@ -1828,10 +1835,10 @@ raise EOFError, ValueError or TypeError. Extra bytes in the input are\n\
|
||||||
ignored.");
|
ignored.");
|
||||||
|
|
||||||
static PyMethodDef marshal_methods[] = {
|
static PyMethodDef marshal_methods[] = {
|
||||||
{"dump", marshal_dump, METH_VARARGS, dump_doc},
|
{"dump", (PyCFunction)marshal_dump, METH_FASTCALL, dump_doc},
|
||||||
{"load", marshal_load, METH_O, load_doc},
|
{"load", marshal_load, METH_O, load_doc},
|
||||||
{"dumps", marshal_dumps, METH_VARARGS, dumps_doc},
|
{"dumps", (PyCFunction)marshal_dumps, METH_FASTCALL, dumps_doc},
|
||||||
{"loads", marshal_loads, METH_VARARGS, loads_doc},
|
{"loads", (PyCFunction)marshal_loads, METH_FASTCALL, loads_doc},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue