Revert "Backport METH_FASTCALL from Python 3.7 (#328)"

This reverts commit cf73bbd678.
This commit is contained in:
Justine Tunney 2022-05-12 06:49:54 -07:00
parent e7611a8476
commit 2ea1dc405c
102 changed files with 3299 additions and 2894 deletions

View file

@ -44,8 +44,6 @@ PyObject *_PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args,
#define _PY_FASTCALL_SMALL_STACK 5
int _PyObject_HasFastCall(PyObject *callable);
PyObject *_PyObject_FastCall_Prepend(
PyObject *callable,
PyObject *obj,

View file

@ -91,8 +91,6 @@ PyObject * PyDescr_NewMember(PyTypeObject *,
PyObject * PyDescr_NewGetSet(PyTypeObject *,
struct PyGetSetDef *);
#ifndef Py_LIMITED_API
PyObject * _PyMethodDescr_FastCallKeywords(
PyObject *descrobj, PyObject *const *stack, Py_ssize_t nargs, PyObject *kwnames);
PyObject * PyDescr_NewWrapper(PyTypeObject *,
struct wrapperbase *, void *);
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)

View file

@ -15,16 +15,6 @@ PyObject * PyEval_EvalCodeEx(PyObject *co,
PyObject *kwdefs, PyObject *closure);
#ifndef Py_LIMITED_API
PyObject * _PyEval_EvalCodeWithName(
PyObject *co,
PyObject *globals, PyObject *locals,
PyObject **args, Py_ssize_t argcount,
PyObject **kwnames, PyObject **kwargs,
Py_ssize_t kwcount, int kwstep,
PyObject **defs, Py_ssize_t defcount,
PyObject *kwdefs, PyObject *closure,
PyObject *name, PyObject *qualname);
PyObject * _PyEval_CallTracing(PyObject *func, PyObject *args);
#endif

View file

@ -61,9 +61,6 @@ extern PyTypeObject PyFrame_Type;
PyFrameObject * PyFrame_New(PyThreadState *, PyCodeObject *,
PyObject *, PyObject *);
/* only internal use */
PyFrameObject* _PyFrame_New_NoTrack(PyThreadState *, PyCodeObject *,
PyObject *, PyObject *);
/* The rest of the interface is specific for frame objects */

View file

@ -14,12 +14,10 @@ extern PyTypeObject PyCFunction_Type;
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject **, Py_ssize_t);
typedef PyObject *(*_PyCFunctionFast) (PyObject *self, PyObject **args,
Py_ssize_t nargs, PyObject *kwnames);
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
PyObject *);
typedef PyObject *(*_PyCFunctionFastWithKeywords) (PyObject *,
PyObject **, Py_ssize_t,
PyObject *);
typedef PyObject *(*PyNoArgsFunction)(PyObject *);
PyCFunction PyCFunction_GetFunction(PyObject *);
@ -95,20 +93,12 @@ typedef struct {
PyObject *m_module; /* The __module__ attribute, can be anything */
PyObject *m_weakreflist; /* List of weak references */
} PyCFunctionObject;
PyObject * _PyMethodDef_RawFastCallDict(
PyMethodDef *method,
PyObject *self,
PyObject **args,
Py_ssize_t nargs,
PyObject *kwargs);
PyObject * _PyMethodDef_RawFastCallKeywords(
PyMethodDef *method,
PyObject *self,
PyObject **args,
Py_ssize_t nargs,
PyObject *kwnames);
#endif
int PyCFunction_ClearFreeList(void);

View file

@ -125,8 +125,6 @@ COSMOPOLITAN_C_START_
#define BUILD_CONST_KEY_MAP 156
#define BUILD_STRING 157
#define BUILD_TUPLE_UNPACK_WITH_CALL 158
#define LOAD_METHOD 160
#define CALL_METHOD 161
/* EXCEPT_HANDLER is a special, implicit block type which is created when
entering an except handler. It is not an opcode but we define it here

View file

@ -235,28 +235,6 @@ typedef int Py_ssize_clean_t;
#define Py_DEPRECATED(VERSION_UNUSED)
#endif
/* _Py_HOT_FUNCTION
* The hot attribute on a function is used to inform the compiler that the
* function is a hot spot of the compiled program. The function is optimized
* more aggressively and on many target it is placed into special subsection of
* the text section so all hot functions appears close together improving
* locality.
*
* Usage:
* int _Py_HOT_FUNCTION x(void) { return 3; }
*
* Issue #28618: This attribute must not be abused, otherwise it can have a
* negative effect on performance. Only the functions were Python spend most of
* its time must use it. Use a profiler when running performance benchmark
* suite to find these functions.
*/
#if !IsModeDbg() && defined(__GNUC__) \
&& ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
#define _Py_HOT_FUNCTION __attribute__((hot))
#else
#define _Py_HOT_FUNCTION
#endif
#define RTYPE RTYPE
#ifdef __cplusplus
#define PyMODINIT_FUNC extern "C" PyObject *

View file

@ -239,7 +239,6 @@ _code_type = type(_write_atomic.__code__)
# Python 3.6b1 3377 (set __class__ cell from type.__new__ #23722)
# Python 3.6b2 3378 (add BUILD_TUPLE_UNPACK_WITH_CALL #28257)
# Python 3.6rc1 3379 (more thorough __class__ validation #23722)
# Python 3.7a1 3390 (add LOAD_METHOD and CALL_METHOD opcodes #26110)
#
# MAGIC must change whenever the bytecode emitted by the compiler may no
# longer be understood by older implementations of the eval loop (usually
@ -248,7 +247,7 @@ _code_type = type(_write_atomic.__code__)
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.
MAGIC_NUMBER = (3390).to_bytes(2, 'little') + b'\r\n'
MAGIC_NUMBER = (3379).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
_PYCACHE = '__pycache__'

View file

@ -208,7 +208,4 @@ def_op('BUILD_CONST_KEY_MAP', 156)
def_op('BUILD_STRING', 157)
def_op('BUILD_TUPLE_UNPACK_WITH_CALL', 158)
name_op('LOAD_METHOD', 160)
def_op('CALL_METHOD', 161)
del def_op, name_op, jrel_op, jabs_op

View file

@ -1,5 +1,4 @@
import sys
import cosmo
import unittest
import io
import atexit
@ -103,10 +102,9 @@ class GeneralTest(unittest.TestCase):
self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs)
stderr = self.stream.getvalue()
self.assertEqual(stderr.count("ZeroDivisionError"), 3)
if "tiny" not in cosmo.MODE:
self.assertIn("# one", stderr)
self.assertIn("# two", stderr)
self.assertIn("# three", stderr)
self.assertIn("# one", stderr)
self.assertIn("# two", stderr)
self.assertIn("# three", stderr)
def test_stress(self):
a = [0]

View file

@ -57,8 +57,7 @@ class CmdLineTest(unittest.TestCase):
rc, out, err = assert_python_ok('-vv')
self.assertNotIn(b'stack overflow', err)
@unittest.skipIf(True, # TODO: figure out this error
#interpreter_requires_environment(),
@unittest.skipIf(interpreter_requires_environment(),
'Cannot run -E tests when PYTHON env vars are required.')
def test_xoptions(self):
def get_xoptions(*args):
@ -241,7 +240,6 @@ class CmdLineTest(unittest.TestCase):
self.assertEqual(rc, 0)
self.assertTrue(data.startswith(b'x'), data)
@unittest.skipIf(True, "APE doesn't check PYTHONPATH")
def test_large_PYTHONPATH(self):
path1 = "ABCDE" * 100
path2 = "FGHIJ" * 100
@ -364,9 +362,7 @@ class CmdLineTest(unittest.TestCase):
# Issue #7111: Python should work without standard streams
@unittest.skipIf(True, # TODO: sys, os need to be tested first
# os.name != 'posix',
"test needs POSIX semantics")
@unittest.skipIf(os.name != 'posix', "test needs POSIX semantics")
def _test_no_stdio(self, streams):
code = """if 1:
import os, sys

View file

@ -209,19 +209,15 @@ class CmdLineTest(unittest.TestCase):
self.assertIn(b'File "<stdin>"', stderr.readline())
self.assertIn(b'ZeroDivisionError', stderr.readline())
@unittest.skipIf(True, "TODO: find out why this freezes")
def test_repl_stdout_flush(self):
self.check_repl_stdout_flush()
@unittest.skipIf(True, "TODO: find out why this freezes")
def test_repl_stdout_flush_separate_stderr(self):
self.check_repl_stdout_flush(True)
@unittest.skipIf(True, "TODO: find out why this freezes")
def test_repl_stderr_flush(self):
self.check_repl_stderr_flush()
@unittest.skipIf(True, "TODO: find out why this freezes")
def test_repl_stderr_flush_separate_stderr(self):
self.check_repl_stderr_flush(True)
@ -426,7 +422,6 @@ class CmdLineTest(unittest.TestCase):
err = self.check_dash_m_failure('test_pkg.other', *example_args)
self.assertIn(b'ValueError', err)
@unittest.skipIf(True, "TODO: fix regex match for error message")
def test_dash_m_errors(self):
# Exercise error reporting for various invalid package executions
tests = (

View file

@ -3,7 +3,6 @@ import copy
import inspect
import pickle
import sys
import cosmo
import types
import unittest
import warnings
@ -884,7 +883,6 @@ class CoroutineTest(unittest.TestCase):
self.assertEqual(inspect.getcoroutinestate(coro_b), inspect.CORO_CLOSED)
self.assertIsNone(coro_b.cr_await)
@unittest.skipIf("tiny" in cosmo.MODE, "docstrings stripped in MODE=tiny")
def test_corotype_1(self):
ct = types.CoroutineType
self.assertIn('into coroutine', ct.send.__doc__)
@ -1199,7 +1197,6 @@ class CoroutineTest(unittest.TestCase):
with self.assertRaisesRegex(AttributeError, '__aexit__'):
run_async(foo())
@unittest.skipIf("tiny" in cosmo.MODE, "TODO: figure out error")
def test_with_5(self):
# While this test doesn't make a lot of sense,
# it's a regression test for an early bug with opcodes

View file

@ -5,7 +5,6 @@ from test.bytecode_helper import BytecodeTestCase
import difflib
import unittest
import sys
import cosmo
import dis
import io
import re
@ -345,15 +344,10 @@ class DisTests(unittest.TestCase):
return re.sub(r'\b0x[0-9A-Fa-f]+\b', '0x...', text)
def do_disassembly_test(self, func, expected):
t = self.maxDiff
self.maxDiff = None # to get full disassembly
got = self.get_disassembly(func)
if got != expected:
got = self.strip_addresses(got)
# filename issue because within zip store?
expected = expected.replace(".pyc", ".py")
self.assertEqual(got, expected)
self.maxDiff = t
def test_opmap(self):
self.assertEqual(dis.opmap["NOP"], 9)
@ -620,13 +614,11 @@ class CodeInfoTests(unittest.TestCase):
(async_def, code_info_async_def)
]
@unittest.skipIf("tiny" in cosmo.MODE, "docstrings not present")
def test_code_info(self):
self.maxDiff = 1000
for x, expected in self.test_pairs:
self.assertRegex(dis.code_info(x), expected)
@unittest.skipIf("tiny" in cosmo.MODE, "docstrings not present")
def test_show_code(self):
self.maxDiff = 1000
for x, expected in self.test_pairs:
@ -942,7 +934,6 @@ class BytecodeTests(unittest.TestCase):
actual = dis.Bytecode(simple, first_line=350).dis()[:3]
self.assertEqual(actual, "350")
@unittest.skipIf("tiny" in cosmo.MODE, "docstrings not present")
def test_info(self):
self.maxDiff = 1000
for x, expected in CodeInfoTests.test_pairs:

View file

@ -663,7 +663,7 @@ plain ol' Python and is guaranteed to be available.
True
>>> real_tests = [t for t in tests if len(t.examples) > 0]
>>> len(real_tests) # objects that actually have doctests
9
8
>>> for t in real_tests:
... print('{} {}'.format(len(t.examples), t.name))
...
@ -673,7 +673,6 @@ plain ol' Python and is guaranteed to be available.
2 builtins.float.hex
1 builtins.hex
1 builtins.int
2 builtins.int.bit_count
2 builtins.int.bit_length
1 builtins.oct
@ -2237,7 +2236,7 @@ def test_DocFileSuite():
'/' should be used as a path separator. It will be converted
to a native separator at run time:
>>> suite = doctest.DocFileSuite('test_doctest.txt') #TODO: path handling in APE ZIP store
>>> suite = doctest.DocFileSuite('../test/test_doctest.txt')
>>> suite.run(unittest.TestResult())
<unittest.result.TestResult run=1 errors=0 failures=1>
@ -2921,7 +2920,7 @@ Invalid file name:
>>> print(normalize(err)) # doctest: +ELLIPSIS
Traceback (most recent call last):
...
FileNotFoundError: [Errno 2] ENOENT/2/No such file or directory: 'nosuchfile'
FileNotFoundError: [Errno 2] ENOENT[2]: 'nosuchfile'
Invalid doctest option:
@ -2961,9 +2960,3 @@ if __name__ == '__main__':
test_coverage('/tmp/doctest.cover')
else:
test_main()
if __name__ == "PYOBJ.COM":
import test.sample_doctest
import test.sample_doctest_no_docstrings
import test.sample_doctest_no_doctests
import test.doctest_aliases

View file

@ -12,7 +12,6 @@ the example. It should be ignored:
"""
import sys
import cosmo
import unittest
from test import support
if sys.flags.optimize >= 2:
@ -109,8 +108,6 @@ class C(object):
return val
def test_main():
if cosmo.MODE == 'tiny':
return
from test import test_doctest2
EXPECTED = 19
f, t = support.run_doctest(test_doctest2)

View file

@ -4,7 +4,6 @@
import abc
import sys
import unittest
import cosmo
from types import DynamicClassAttribute
class PropertyBase(Exception):
@ -118,13 +117,13 @@ class PropertyTests(unittest.TestCase):
self.assertRaises(PropertySet, setattr, sub, "spam", None)
self.assertRaises(PropertyDel, delattr, sub, "spam")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_decorator_subclass_doc(self):
sub = SubClass()
self.assertEqual(sub.__class__.__dict__['spam'].__doc__, "SubClass.getter")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_decorator_baseclass_doc(self):
base = BaseClass()
@ -136,7 +135,7 @@ class PropertyTests(unittest.TestCase):
self.assertEqual(base.__class__.__dict__['spam'].__doc__, "spam spam spam")
self.assertEqual(sub.__class__.__dict__['spam'].__doc__, "spam spam spam")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_getter_doc_override(self):
newgettersub = PropertySubNewGetter()
@ -222,7 +221,7 @@ class PropertySubclassTests(unittest.TestCase):
else:
raise Exception("AttributeError not raised")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_docstring_copy(self):
class Foo(object):
@ -234,7 +233,7 @@ class PropertySubclassTests(unittest.TestCase):
Foo.__dict__['spam'].__doc__,
"spam wrapped in DynamicClassAttribute subclass")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_setter_copies_getter_docstring(self):
class Foo(object):
@ -268,7 +267,7 @@ class PropertySubclassTests(unittest.TestCase):
FooSub.__dict__['spam'].__doc__,
"spam wrapped in DynamicClassAttribute subclass")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_new_getter_new_docstring(self):

View file

@ -6,7 +6,6 @@ import re
import signal
import subprocess
import sys
import cosmo
from test import support
from test.support import script_helper, is_android, requires_android_level
import tempfile
@ -48,7 +47,6 @@ def requires_raise(test):
return (test if not is_android else
requires_android_level(24, 'raise() is buggy')(test))
@unittest.skipIf(cosmo.MODE in ('dbg', 'asan'), "regex can't match backtrace")
class FaultHandlerTests(unittest.TestCase):
def get_output(self, code, filename=None, fd=None):
"""

View file

@ -67,7 +67,6 @@ class FinalizationTest(unittest.TestCase):
del frame
support.gc_collect()
@unittest.skipIf(True, "TODO: find out why this fails")
def test_refcycle(self):
# A generator caught in a refcycle gets finalized anyway.
old_garbage = gc.garbage[:]
@ -334,7 +333,7 @@ class ExceptionTest(unittest.TestCase):
self.assertIsInstance(cm.exception.value, StopIteration)
self.assertEqual(cm.exception.value.value, 2)
@unittest.skipIf(True, "TODO: find out why this fails")
class YieldFromTests(unittest.TestCase):
def test_generator_gi_yieldfrom(self):
def a():

View file

@ -38,7 +38,6 @@ import re
import socket
import struct
import sys
import cosmo
import tempfile
from test.support.script_helper import assert_python_ok
from test import support
@ -3193,9 +3192,9 @@ class QueueHandlerTest(BaseTest):
self.assertEqual(data.name, self.que_logger.name)
self.assertEqual((data.msg, data.args), (msg, None))
@unittest.skipUnless(False and hasattr(logging.handlers, 'QueueListener'),
@unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'),
'logging.handlers.QueueListener required for this test')
def test_queue_listener(self): # TODO add QueueListener after threading
def test_queue_listener(self):
handler = support.TestHandler(support.Matcher())
listener = logging.handlers.QueueListener(self.queue, handler)
listener.start()
@ -3227,7 +3226,7 @@ class QueueHandlerTest(BaseTest):
self.assertFalse(handler.matches(levelno=logging.ERROR, message='5'))
self.assertTrue(handler.matches(levelno=logging.CRITICAL, message='6'))
if False and hasattr(logging.handlers, 'QueueListener'):
if hasattr(logging.handlers, 'QueueListener'):
import multiprocessing
from unittest.mock import patch
@ -3445,7 +3444,6 @@ class BufferingFormatterTest(unittest.TestCase):
self.assertEqual('[(2)<one><two>(2)]', f.format(self.records))
class ExceptionTest(BaseTest):
@unittest.skipIf(cosmo.MODE == "tiny", "fails only in MODE=tiny")
def test_formatting(self):
r = self.root_logger
h = RecordingHandler()
@ -4517,7 +4515,7 @@ def test_main():
UnixSocketHandlerTest, UnixDatagramHandlerTest, UnixSysLogHandlerTest,
MiscTestCase
]
if False and hasattr(logging.handlers, 'QueueListener'):
if hasattr(logging.handlers, 'QueueListener'):
tests.append(QueueListenerTest)
support.run_unittest(*tests)

View file

@ -1,5 +1,4 @@
# Test the module type
import cosmo
import unittest
import weakref
from test.support import gc_collect, requires_type_collecting
@ -29,8 +28,7 @@ class ModuleTests(unittest.TestCase):
self.fail("__name__ = %s" % repr(s))
except AttributeError:
pass
if cosmo.MODE != 'tiny':
self.assertEqual(foo.__doc__, ModuleType.__doc__)
self.assertEqual(foo.__doc__, ModuleType.__doc__)
def test_uninitialized_missing_getattr(self):
# Issue 8297
@ -211,13 +209,12 @@ a = A(destroyed)"""
def test_module_repr_source(self):
r = repr(unittest)
starts_with = "<module 'unittest' from '"
ends_with = "__init__.pyc'>"
ends_with = "__init__.py'>"
self.assertEqual(r[:len(starts_with)], starts_with,
'{!r} does not start with {!r}'.format(r, starts_with))
self.assertEqual(r[-len(ends_with):], ends_with,
'{!r} does not end with {!r}'.format(r, ends_with))
@unittest.skipIf(True, "TODO: find out why final_a import fails")
@requires_type_collecting
def test_module_finalization_at_shutdown(self):
# Module globals and builtins should still be available during shutdown

View file

@ -2,7 +2,6 @@
# more tests are in test_descr
import sys
import cosmo
import unittest
from test import support
@ -101,13 +100,13 @@ class PropertyTests(unittest.TestCase):
self.assertRaises(PropertySet, setattr, sub, "spam", None)
self.assertRaises(PropertyDel, delattr, sub, "spam")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_decorator_subclass_doc(self):
sub = SubClass()
self.assertEqual(sub.__class__.spam.__doc__, "SubClass.getter")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_decorator_baseclass_doc(self):
base = BaseClass()
@ -119,7 +118,7 @@ class PropertyTests(unittest.TestCase):
self.assertEqual(base.__class__.spam.__doc__, "spam spam spam")
self.assertEqual(sub.__class__.spam.__doc__, "spam spam spam")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_getter_doc_override(self):
newgettersub = PropertySubNewGetter()
@ -152,7 +151,7 @@ class PropertyTests(unittest.TestCase):
foo = property(foo)
C.foo.__isabstractmethod__
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_builtin_doc_writable(self):
p = property(doc='basic')
@ -160,7 +159,7 @@ class PropertyTests(unittest.TestCase):
p.__doc__ = 'extended'
self.assertEqual(p.__doc__, 'extended')
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_decorator_doc_writable(self):
class PropertyWritableDoc(object):
@ -207,7 +206,7 @@ class PropertySubclassTests(unittest.TestCase):
else:
raise Exception("AttributeError not raised")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_docstring_copy(self):
class Foo(object):
@ -219,7 +218,7 @@ class PropertySubclassTests(unittest.TestCase):
Foo.spam.__doc__,
"spam wrapped in property subclass")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_setter_copies_getter_docstring(self):
class Foo(object):
@ -252,7 +251,7 @@ class PropertySubclassTests(unittest.TestCase):
FooSub.spam.__doc__,
"spam wrapped in property subclass")
@unittest.skipIf(sys.flags.optimize >= 2 or cosmo.MODE == 'tiny',
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_new_getter_new_docstring(self):

View file

@ -758,7 +758,6 @@ class PydocImportTest(PydocBaseTest):
self.addCleanup(rmtree, TESTFN)
importlib.invalidate_caches()
@unittest.skipIf(True, "TODO: figure out this error")
def test_badimport(self):
# This tests the fix for issue 5230, where if pydoc found the module
# but the module had an internal import error pydoc would report no doc

View file

@ -17,7 +17,6 @@ class ResourceTest(unittest.TestCase):
self.assertRaises(TypeError, resource.setrlimit)
self.assertRaises(TypeError, resource.setrlimit, 42, 42, 42)
@unittest.skipIf(True, "RLIM_INFINITY is -1, expected positive value")
def test_fsize_ismax(self):
try:
(cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)

View file

@ -12,7 +12,6 @@ import socket
import statistics
import subprocess
import traceback
import cosmo
import sys, os, time, errno
from test.support.script_helper import assert_python_ok, spawn_python
try:
@ -72,7 +71,7 @@ class PosixTests(unittest.TestCase):
'on freebsd6')
def test_interprocess_signal(self):
dirname = os.path.dirname(__file__)
script = os.path.join(dirname, 'signalinterproctester.pyc')
script = os.path.join(dirname, 'signalinterproctester.py')
assert_python_ok(script)

View file

@ -97,7 +97,6 @@ class HelperFunctionsTests(unittest.TestCase):
"%s from sys.path not found in set returned "
"by _init_pathinfo(): %s" % (entry, dir_set))
@unittest.skipIf(True, "pth files modify import paths, nasty")
def pth_file_tests(self, pth_file):
"""Contain common code for testing results of reading a .pth file"""
self.assertIn(pth_file.imported, sys.modules,
@ -481,7 +480,6 @@ class ImportSideEffectTests(unittest.TestCase):
else:
self.fail("sitecustomize not imported automatically")
@unittest.skipIf(True, "internet not allowed")
@test.support.requires_resource('network')
@test.support.system_must_validate_cert
@unittest.skipUnless(sys.version_info[3] == 'final',

View file

@ -107,7 +107,7 @@ class TestLiterals(unittest.TestCase):
def test_eval_str_invalid_escape(self):
for b in range(1, 128):
if b in b"""\n\r"'01234567NU\\abefnrtuvx""":
if b in b"""\n\r"'01234567NU\\abfnrtuvx""":
continue
with self.assertWarns(DeprecationWarning):
self.assertEqual(eval(r"'\%c'" % b), '\\' + chr(b))
@ -156,7 +156,7 @@ class TestLiterals(unittest.TestCase):
def test_eval_bytes_invalid_escape(self):
for b in range(1, 128):
if b in b"""\n\r"'01234567\\abefnrtvx""":
if b in b"""\n\r"'01234567\\abfnrtvx""":
continue
with self.assertWarns(DeprecationWarning):
self.assertEqual(eval(r"b'\%c'" % b), b'\\' + bytes([b]))

View file

@ -203,30 +203,6 @@ three.
Traceback (most recent call last):
SyntaxError: more than 255 arguments
>>> class C:
... def meth(self, *args):
... return args
>>> obj = C()
>>> obj.meth(
... 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
... 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
... 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
... 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
... 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
... 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
... 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
... 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
... 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
... 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
... 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
... 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
... 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
... 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
... 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
... 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
... 248, 249, 250, 251, 252, 253, 254) # doctest: +ELLIPSIS
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..., 252, 253, 254)
>>> f(lambda x: x[0] = 3)
Traceback (most recent call last):
SyntaxError: lambda cannot contain assignment

View file

@ -38,6 +38,3 @@ class Test(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
if __name__ == "PYOBJ.COM":
import syslog

View file

@ -292,11 +292,11 @@ class UDPTimeoutTestCase(TimeoutTestCase):
def test_main():
# support.requires('network')
support.requires('network')
support.run_unittest(
CreationTestCase,
# TCPTimeoutTestCase, no internet test allowed
# UDPTimeoutTestCase,
TCPTimeoutTestCase,
UDPTimeoutTestCase,
)
if __name__ == "__main__":

View file

@ -1576,7 +1576,6 @@ class TestRoundtrip(TestCase):
# Two string literals on the same line
self.check_roundtrip("'' ''")
@unittest.skipIf(True, "TODO: check import validity")
def test_random_files(self):
# Test roundtrip on random python modules.
# pass the '-ucpu' option to process the full directory.

View file

@ -1,6 +1,5 @@
import os
import sys
import cosmo
from test.support import TESTFN, rmtree, unlink, captured_stdout
from test.support.script_helper import assert_python_ok, assert_python_failure
import textwrap
@ -293,7 +292,6 @@ class TestCallers(unittest.TestCase):
# Created separately for issue #3821
@unittest.skipIf(cosmo.MODE == "tiny", "fails only in MODE=tiny")
class TestCoverage(unittest.TestCase):
def setUp(self):
self.addCleanup(sys.settrace, sys.gettrace())
@ -386,7 +384,6 @@ class TestCoverageCommandLineOutput(unittest.TestCase):
unlink(self.codefile)
unlink(self.coverfile)
@unittest.skipIf(cosmo.MODE == "tiny", "docstrings skipped in MODE=tiny")
def test_cover_files_written_no_highlight(self):
argv = '-m trace --count'.split() + [self.codefile]
status, stdout, stderr = assert_python_ok(*argv)
@ -398,7 +395,6 @@ class TestCoverageCommandLineOutput(unittest.TestCase):
" print('unreachable')\n"
)
@unittest.skipIf(cosmo.MODE == "tiny", "fails only in MODE=tiny")
def test_cover_files_written_with_highlight(self):
argv = '-m trace --count --missing'.split() + [self.codefile]
status, stdout, stderr = assert_python_ok(*argv)

View file

@ -1660,7 +1660,6 @@ class MappingTestCase(TestBase):
dict = weakref.WeakKeyDictionary()
self.assertRegex(repr(dict), '<WeakKeyDictionary at 0x.*>')
@unittest.skipIf(True, "threading not yet implemented")
def test_threaded_weak_valued_setdefault(self):
d = weakref.WeakValueDictionary()
with collect_in_thread():
@ -1669,7 +1668,6 @@ class MappingTestCase(TestBase):
self.assertIsNot(x, None) # we never put None in there!
del x
@unittest.skipIf(True, "threading not yet implemented")
def test_threaded_weak_valued_pop(self):
d = weakref.WeakValueDictionary()
with collect_in_thread():
@ -1678,7 +1676,6 @@ class MappingTestCase(TestBase):
x = d.pop(10, 10)
self.assertIsNot(x, None) # we never put None in there!
@unittest.skipIf(True, "threading not yet implemented")
def test_threaded_weak_valued_consistency(self):
# Issue #28427: old keys should not remove new values from
# WeakValueDictionary when collecting from another thread.

View file

@ -936,10 +936,14 @@ done:
}
static PyObject *
deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
PyObject *kwnames)
{
Py_ssize_t n=1;
if (!_PyArg_NoStackKeywords("rotate", kwnames)) {
return NULL;
}
if (!_PyArg_ParseStack(args, nargs, "|n:rotate", &n)) {
return NULL;
}
@ -1072,7 +1076,8 @@ deque_len(dequeobject *deque)
}
static PyObject *
deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
PyObject *kwnames)
{
Py_ssize_t i, n, start=0, stop=Py_SIZE(deque);
PyObject *v, *item;
@ -1081,6 +1086,9 @@ deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
size_t start_state = deque->state;
int cmp;
if (!_PyArg_NoStackKeywords("index", kwnames)) {
return NULL;
}
if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index", &v,
_PyEval_SliceIndex, &start,
_PyEval_SliceIndex, &stop)) {
@ -1149,13 +1157,17 @@ PyDoc_STRVAR(index_doc,
*/
static PyObject *
deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs)
deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs,
PyObject *kwnames)
{
Py_ssize_t index;
Py_ssize_t n = Py_SIZE(deque);
PyObject *value;
PyObject *rv;
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
return NULL;
}
if (!_PyArg_ParseStack(args, nargs, "nO:insert", &index, &value)) {
return NULL;
}

View file

@ -2806,9 +2806,9 @@ typedef struct {
} XMLParserObject;
static PyObject *
static PyObject*
_elementtree_XMLParser_doctype(XMLParserObject* self, PyObject** args,
Py_ssize_t nargs);
Py_ssize_t nargs, PyObject* kwnames);
static PyObject *
_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
PyObject *pubid, PyObject *system);
@ -3811,7 +3811,7 @@ static PyMethodDef element_methods[] = {
_ELEMENTTREE_ELEMENT_ITERTEXT_METHODDEF
_ELEMENTTREE_ELEMENT_ITERFIND_METHODDEF
{"getiterator", (PyCFunction)_elementtree_Element_iter, METH_FASTCALL | METH_KEYWORDS, _elementtree_Element_iter__doc__},
{"getiterator", (PyCFunction)_elementtree_Element_iter, METH_FASTCALL, _elementtree_Element_iter__doc__},
_ELEMENTTREE_ELEMENT_GETCHILDREN_METHODDEF
_ELEMENTTREE_ELEMENT_ITEMS_METHODDEF

View file

@ -43,7 +43,6 @@ typedef struct {
PyObject *kw;
PyObject *dict;
PyObject *weakreflist; /* List of weak references */
int use_fastcall;
} partialobject;
static PyTypeObject partial_type;
@ -136,7 +135,6 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
return NULL;
}
pto->use_fastcall = _PyObject_HasFastCall(func);
return (PyObject *)pto;
}
@ -155,110 +153,66 @@ partial_dealloc(partialobject *pto)
}
static PyObject *
partial_fastcall(partialobject *pto, PyObject **args, Py_ssize_t nargs,
PyObject *kwargs)
partial_call(partialobject *pto, PyObject *args, PyObject *kw)
{
PyObject *small_stack[_PY_FASTCALL_SMALL_STACK];
PyObject *ret;
PyObject **stack, **stack_buf = NULL;
Py_ssize_t nargs2, pto_nargs;
pto_nargs = PyTuple_GET_SIZE(pto->args);
nargs2 = pto_nargs + nargs;
if (pto_nargs == 0) {
stack = args;
}
else if (nargs == 0) {
stack = &PyTuple_GET_ITEM(pto->args, 0);
}
else {
if (nargs2 <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) {
stack = small_stack;
}
else {
stack_buf = PyMem_Malloc(nargs2 * sizeof(PyObject *));
if (stack_buf == NULL) {
PyErr_NoMemory();
return NULL;
}
stack = stack_buf;
}
/* use borrowed references */
memcpy(stack,
&PyTuple_GET_ITEM(pto->args, 0),
pto_nargs * sizeof(PyObject*));
memcpy(&stack[pto_nargs],
args,
nargs * sizeof(PyObject*));
}
ret = _PyObject_FastCallDict(pto->fn, stack, nargs2, kwargs);
PyMem_Free(stack_buf);
return ret;
}
static PyObject *
partial_call_impl(partialobject *pto, PyObject *args, PyObject *kwargs)
{
PyObject *ret, *args2;
/* Note: tupleconcat() is optimized for empty tuples */
args2 = PySequence_Concat(pto->args, args);
if (args2 == NULL) {
return NULL;
}
assert(PyTuple_Check(args2));
ret = PyObject_Call(pto->fn, args2, kwargs);
Py_DECREF(args2);
return ret;
}
static PyObject *
partial_call(partialobject *pto, PyObject *args, PyObject *kwargs)
{
PyObject *kwargs2, *res;
PyObject *argappl, *kwappl;
PyObject **stack;
Py_ssize_t nargs;
assert (PyCallable_Check(pto->fn));
assert (PyTuple_Check(pto->args));
assert (PyDict_Check(pto->kw));
if (PyDict_GET_SIZE(pto->kw) == 0) {
/* kwargs can be NULL */
kwargs2 = kwargs;
Py_XINCREF(kwargs2);
if (PyTuple_GET_SIZE(pto->args) == 0) {
stack = &PyTuple_GET_ITEM(args, 0);
nargs = PyTuple_GET_SIZE(args);
argappl = NULL;
}
else if (PyTuple_GET_SIZE(args) == 0) {
stack = &PyTuple_GET_ITEM(pto->args, 0);
nargs = PyTuple_GET_SIZE(pto->args);
argappl = NULL;
}
else {
/* bpo-27840, bpo-29318: dictionary of keyword parameters must be
copied, because a function using "**kwargs" can modify the
dictionary. */
kwargs2 = PyDict_Copy(pto->kw);
if (kwargs2 == NULL) {
stack = NULL;
argappl = PySequence_Concat(pto->args, args);
if (argappl == NULL) {
return NULL;
}
if (kwargs != NULL) {
if (PyDict_Merge(kwargs2, kwargs, 1) != 0) {
Py_DECREF(kwargs2);
assert(PyTuple_Check(argappl));
}
if (PyDict_Size(pto->kw) == 0) {
kwappl = kw;
Py_XINCREF(kwappl);
}
else {
kwappl = PyDict_Copy(pto->kw);
if (kwappl == NULL) {
Py_XDECREF(argappl);
return NULL;
}
if (kw != NULL) {
if (PyDict_Merge(kwappl, kw, 1) != 0) {
Py_XDECREF(argappl);
Py_DECREF(kwappl);
return NULL;
}
}
}
if (pto->use_fastcall) {
res = partial_fastcall(pto,
&PyTuple_GET_ITEM(args, 0),
PyTuple_GET_SIZE(args),
kwargs2);
if (stack) {
ret = _PyObject_FastCallDict(pto->fn, stack, nargs, kwappl);
}
else {
res = partial_call_impl(pto, args, kwargs2);
ret = PyObject_Call(pto->fn, argappl, kwappl);
Py_DECREF(argappl);
}
Py_XDECREF(kwargs2);
return res;
Py_XDECREF(kwappl);
return ret;
}
static int
@ -387,13 +341,12 @@ partial_setstate(partialobject *pto, PyObject *state)
return NULL;
}
Py_INCREF(fn);
if (dict == Py_None)
dict = NULL;
else
Py_INCREF(dict);
Py_INCREF(fn);
pto->use_fastcall = _PyObject_HasFastCall(fn);
Py_SETREF(pto->fn, fn);
Py_SETREF(pto->args, fnargs);
Py_SETREF(pto->kw, kw);

View file

@ -128,7 +128,7 @@ PyDoc_STRVAR(_io_open__doc__,
"opened in a binary mode.");
#define _IO_OPEN_METHODDEF \
{"open", (PyCFunction)_io_open, METH_FASTCALL|METH_KEYWORDS, _io_open__doc__},
{"open", (PyCFunction)_io_open, METH_FASTCALL, _io_open__doc__},
static PyObject *
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
@ -159,4 +159,4 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
exit:
return return_value;
}
/*[clinic end generated code: output=a748395f9589de02 input=a9049054013a1b77]*/
/*[clinic end generated code: output=79fd04d9c9d8f28f input=a9049054013a1b77]*/

View file

@ -98,7 +98,7 @@ static PyObject *
_io__Buffered_peek_impl(buffered *self, Py_ssize_t size);
static PyObject *
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t size = 0;
@ -107,6 +107,10 @@ _io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs)
&size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("peek", kwnames)) {
goto exit;
}
return_value = _io__Buffered_peek_impl(self, size);
exit:
@ -125,7 +129,7 @@ static PyObject *
_io__Buffered_read_impl(buffered *self, Py_ssize_t n);
static PyObject *
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t n = -1;
@ -134,6 +138,10 @@ _io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs)
_PyIO_ConvertSsize_t, &n)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io__Buffered_read_impl(self, n);
exit:
@ -240,7 +248,7 @@ static PyObject *
_io__Buffered_readline_impl(buffered *self, Py_ssize_t size);
static PyObject *
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@ -249,6 +257,10 @@ _io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs)
_PyIO_ConvertSsize_t, &size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io__Buffered_readline_impl(self, size);
exit:
@ -267,7 +279,7 @@ static PyObject *
_io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);
static PyObject *
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *targetobj;
@ -277,6 +289,10 @@ _io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs)
&targetobj, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io__Buffered_seek_impl(self, targetobj, whence);
exit:
@ -295,7 +311,7 @@ static PyObject *
_io__Buffered_truncate_impl(buffered *self, PyObject *pos);
static PyObject *
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs)
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *pos = Py_None;
@ -305,6 +321,10 @@ _io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs)
&pos)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io__Buffered_truncate_impl(self, pos);
exit:
@ -476,4 +496,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=5239e4eaff6306f3 input=a9049054013a1b77]*/
/*[clinic end generated code: output=c526190c51a616c8 input=a9049054013a1b77]*/

View file

@ -165,7 +165,7 @@ static PyObject *
_io_BytesIO_read_impl(bytesio *self, PyObject *arg);
static PyObject *
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -175,6 +175,10 @@ _io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs)
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_read_impl(self, arg);
exit:
@ -210,7 +214,7 @@ static PyObject *
_io_BytesIO_readline_impl(bytesio *self, PyObject *arg);
static PyObject *
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -220,6 +224,10 @@ _io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs)
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_readline_impl(self, arg);
exit:
@ -243,7 +251,7 @@ static PyObject *
_io_BytesIO_readlines_impl(bytesio *self, PyObject *arg);
static PyObject *
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -253,6 +261,10 @@ _io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs)
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_readlines_impl(self, arg);
exit:
@ -310,7 +322,7 @@ static PyObject *
_io_BytesIO_truncate_impl(bytesio *self, PyObject *arg);
static PyObject *
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -320,6 +332,10 @@ _io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs)
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_truncate_impl(self, arg);
exit:
@ -345,7 +361,7 @@ static PyObject *
_io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence);
static PyObject *
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs)
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t pos;
@ -355,6 +371,10 @@ _io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs)
&pos, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_seek_impl(self, pos, whence);
exit:
@ -429,4 +449,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=c8184aac612e063e input=a9049054013a1b77]*/
/*[clinic end generated code: output=08139186b009ec47 input=a9049054013a1b77]*/

View file

@ -209,7 +209,7 @@ static PyObject *
_io_FileIO_read_impl(fileio *self, Py_ssize_t size);
static PyObject *
_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs)
_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@ -218,6 +218,10 @@ _io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs)
_PyIO_ConvertSsize_t, &size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io_FileIO_read_impl(self, size);
exit:
@ -281,7 +285,7 @@ static PyObject *
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence);
static PyObject *
_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs)
_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *pos;
@ -291,6 +295,10 @@ _io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs)
&pos, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io_FileIO_seek_impl(self, pos, whence);
exit:
@ -335,7 +343,7 @@ static PyObject *
_io_FileIO_truncate_impl(fileio *self, PyObject *posobj);
static PyObject *
_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs)
_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *posobj = NULL;
@ -345,6 +353,10 @@ _io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs)
&posobj)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io_FileIO_truncate_impl(self, posobj);
exit:
@ -374,4 +386,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _IO_FILEIO_TRUNCATE_METHODDEF
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
/*[clinic end generated code: output=9d282c5eb1399024 input=a9049054013a1b77]*/
/*[clinic end generated code: output=034d782a0daa82bd input=a9049054013a1b77]*/

View file

@ -181,7 +181,7 @@ static PyObject *
_io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit);
static PyObject *
_io__IOBase_readline(PyObject *self, PyObject **args, Py_ssize_t nargs)
_io__IOBase_readline(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t limit = -1;
@ -190,6 +190,10 @@ _io__IOBase_readline(PyObject *self, PyObject **args, Py_ssize_t nargs)
_PyIO_ConvertSsize_t, &limit)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io__IOBase_readline_impl(self, limit);
exit:
@ -213,7 +217,7 @@ static PyObject *
_io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint);
static PyObject *
_io__IOBase_readlines(PyObject *self, PyObject **args, Py_ssize_t nargs)
_io__IOBase_readlines(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t hint = -1;
@ -222,6 +226,10 @@ _io__IOBase_readlines(PyObject *self, PyObject **args, Py_ssize_t nargs)
_PyIO_ConvertSsize_t, &hint)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
goto exit;
}
return_value = _io__IOBase_readlines_impl(self, hint);
exit:
@ -248,7 +256,7 @@ static PyObject *
_io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n);
static PyObject *
_io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs)
_io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t n = -1;
@ -257,6 +265,10 @@ _io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs)
&n)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io__RawIOBase_read_impl(self, n);
exit:
@ -280,4 +292,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return _io__RawIOBase_readall_impl(self);
}
/*[clinic end generated code: output=ec8a2ef87208ce4c input=a9049054013a1b77]*/
/*[clinic end generated code: output=1bcece367fc7b0cd input=a9049054013a1b77]*/

View file

@ -55,7 +55,7 @@ static PyObject *
_io_StringIO_read_impl(stringio *self, PyObject *arg);
static PyObject *
_io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs)
_io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -65,6 +65,10 @@ _io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs)
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io_StringIO_read_impl(self, arg);
exit:
@ -86,7 +90,7 @@ static PyObject *
_io_StringIO_readline_impl(stringio *self, PyObject *arg);
static PyObject *
_io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs)
_io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -96,6 +100,10 @@ _io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs)
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io_StringIO_readline_impl(self, arg);
exit:
@ -119,7 +127,7 @@ static PyObject *
_io_StringIO_truncate_impl(stringio *self, PyObject *arg);
static PyObject *
_io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs)
_io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -129,6 +137,10 @@ _io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs)
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io_StringIO_truncate_impl(self, arg);
exit:
@ -154,7 +166,7 @@ static PyObject *
_io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence);
static PyObject *
_io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs)
_io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t pos;
@ -164,6 +176,10 @@ _io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs)
&pos, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io_StringIO_seek_impl(self, pos, whence);
exit:
@ -290,4 +306,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored))
{
return _io_StringIO_seekable_impl(self);
}
/*[clinic end generated code: output=d69e0df410070292 input=a9049054013a1b77]*/
/*[clinic end generated code: output=ce8018ec29def422 input=a9049054013a1b77]*/

View file

@ -47,7 +47,7 @@ PyDoc_STRVAR(_io_IncrementalNewlineDecoder_decode__doc__,
"\n");
#define _IO_INCREMENTALNEWLINEDECODER_DECODE_METHODDEF \
{"decode", (PyCFunction)_io_IncrementalNewlineDecoder_decode, METH_FASTCALL|METH_KEYWORDS, _io_IncrementalNewlineDecoder_decode__doc__},
{"decode", (PyCFunction)_io_IncrementalNewlineDecoder_decode, METH_FASTCALL, _io_IncrementalNewlineDecoder_decode__doc__},
static PyObject *
_io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self,
@ -232,7 +232,7 @@ static PyObject *
_io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n);
static PyObject *
_io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs)
_io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t n = -1;
@ -241,6 +241,10 @@ _io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs)
_PyIO_ConvertSsize_t, &n)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io_TextIOWrapper_read_impl(self, n);
exit:
@ -259,7 +263,7 @@ static PyObject *
_io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size);
static PyObject *
_io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs)
_io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@ -268,6 +272,10 @@ _io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs)
&size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io_TextIOWrapper_readline_impl(self, size);
exit:
@ -286,7 +294,7 @@ static PyObject *
_io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence);
static PyObject *
_io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs)
_io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *cookieObj;
@ -296,6 +304,10 @@ _io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs)
&cookieObj, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence);
exit:
@ -331,7 +343,7 @@ static PyObject *
_io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos);
static PyObject *
_io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs)
_io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *pos = Py_None;
@ -341,6 +353,10 @@ _io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs)
&pos)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io_TextIOWrapper_truncate_impl(self, pos);
exit:
@ -465,4 +481,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{
return _io_TextIOWrapper_close_impl(self);
}
/*[clinic end generated code: output=eee57db91b6b0550 input=a9049054013a1b77]*/
/*[clinic end generated code: output=67eba50449900a96 input=a9049054013a1b77]*/

View file

@ -186,7 +186,7 @@ static PyObject *
_io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size);
static PyObject *
_io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs)
_io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@ -195,6 +195,10 @@ _io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs
_PyIO_ConvertSsize_t, &size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io__WindowsConsoleIO_read_impl(self, size);
exit:
@ -253,4 +257,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
{
return _io__WindowsConsoleIO_isatty_impl(self);
}
/*[clinic end generated code: output=178c491c15ee794c input=a9049054013a1b77]*/
/*[clinic end generated code: output=b097ceeb54d6e15e input=a9049054013a1b77]*/

View file

@ -1870,7 +1870,7 @@ to the format string S.format. See help(struct) for more on format\n\
strings.");
static PyObject *
s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs)
s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyStructObject *soself;
PyObject *result;
@ -1885,6 +1885,9 @@ s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs)
"pack expected %zd items for packing (got %zd)", soself->s_len, nargs);
return NULL;
}
if (!_PyArg_NoStackKeywords("pack", kwnames)) {
return NULL;
}
/* Allocate a new string */
result = PyBytes_FromStringAndSize((char *)NULL, soself->s_size);
@ -1909,7 +1912,7 @@ offset. Note that the offset is a required argument. See\n\
help(struct) for more on format strings.");
static PyObject *
s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs)
s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyStructObject *soself;
Py_buffer buffer;
@ -1936,6 +1939,9 @@ s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs)
}
return NULL;
}
if (!_PyArg_NoStackKeywords("pack_into", kwnames)) {
return NULL;
}
/* Extract a writable memory buffer from the first argument */
if (!PyArg_Parse(args[0], "w*", &buffer))
@ -2156,7 +2162,7 @@ pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
if (s_object == NULL) {
return NULL;
}
result = s_pack((PyObject *)s_object, args + 1, nargs - 1);
result = s_pack((PyObject *)s_object, args + 1, nargs - 1, kwnames);
Py_DECREF(s_object);
return result;
}
@ -2185,7 +2191,7 @@ pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
if (s_object == NULL) {
return NULL;
}
result = s_pack_into((PyObject *)s_object, args + 1, nargs - 1);
result = s_pack_into((PyObject *)s_object, args + 1, nargs - 1, kwnames);
Py_DECREF(s_object);
return result;
}

View file

@ -15,7 +15,7 @@ PyDoc_STRVAR(_multibytecodec_MultibyteCodec_encode__doc__,
"registered with codecs.register_error that can handle UnicodeEncodeErrors.");
#define _MULTIBYTECODEC_MULTIBYTECODEC_ENCODE_METHODDEF \
{"encode", (PyCFunction)_multibytecodec_MultibyteCodec_encode, METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteCodec_encode__doc__},
{"encode", (PyCFunction)_multibytecodec_MultibyteCodec_encode, METH_FASTCALL, _multibytecodec_MultibyteCodec_encode__doc__},
static PyObject *
_multibytecodec_MultibyteCodec_encode_impl(MultibyteCodecObject *self,
@ -53,7 +53,7 @@ PyDoc_STRVAR(_multibytecodec_MultibyteCodec_decode__doc__,
"codecs.register_error that is able to handle UnicodeDecodeErrors.\"");
#define _MULTIBYTECODEC_MULTIBYTECODEC_DECODE_METHODDEF \
{"decode", (PyCFunction)_multibytecodec_MultibyteCodec_decode, METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteCodec_decode__doc__},
{"decode", (PyCFunction)_multibytecodec_MultibyteCodec_decode, METH_FASTCALL, _multibytecodec_MultibyteCodec_decode__doc__},
static PyObject *
_multibytecodec_MultibyteCodec_decode_impl(MultibyteCodecObject *self,
@ -90,7 +90,7 @@ PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_encode__doc__,
"\n");
#define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_ENCODE_METHODDEF \
{"encode", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_encode, METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteIncrementalEncoder_encode__doc__},
{"encode", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_encode, METH_FASTCALL, _multibytecodec_MultibyteIncrementalEncoder_encode__doc__},
static PyObject *
_multibytecodec_MultibyteIncrementalEncoder_encode_impl(MultibyteIncrementalEncoderObject *self,
@ -139,7 +139,7 @@ PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_decode__doc__,
"\n");
#define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_DECODE_METHODDEF \
{"decode", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_decode, METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteIncrementalDecoder_decode__doc__},
{"decode", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_decode, METH_FASTCALL, _multibytecodec_MultibyteIncrementalDecoder_decode__doc__},
static PyObject *
_multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDecoderObject *self,
@ -193,19 +193,19 @@ PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_read__doc__,
"\n");
#define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READ_METHODDEF \
{"read", (PyCFunction)_multibytecodec_MultibyteStreamReader_read, METH_FASTCALL, _multibytecodec_MultibyteStreamReader_read__doc__},
{"read", (PyCFunction)_multibytecodec_MultibyteStreamReader_read, METH_VARARGS, _multibytecodec_MultibyteStreamReader_read__doc__},
static PyObject *
_multibytecodec_MultibyteStreamReader_read_impl(MultibyteStreamReaderObject *self,
PyObject *sizeobj);
static PyObject *
_multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, PyObject **args, Py_ssize_t nargs)
_multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *sizeobj = Py_None;
if (!_PyArg_UnpackStack(args, nargs, "read",
if (!PyArg_UnpackTuple(args, "read",
0, 1,
&sizeobj)) {
goto exit;
@ -222,19 +222,19 @@ PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_readline__doc__,
"\n");
#define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READLINE_METHODDEF \
{"readline", (PyCFunction)_multibytecodec_MultibyteStreamReader_readline, METH_FASTCALL, _multibytecodec_MultibyteStreamReader_readline__doc__},
{"readline", (PyCFunction)_multibytecodec_MultibyteStreamReader_readline, METH_VARARGS, _multibytecodec_MultibyteStreamReader_readline__doc__},
static PyObject *
_multibytecodec_MultibyteStreamReader_readline_impl(MultibyteStreamReaderObject *self,
PyObject *sizeobj);
static PyObject *
_multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self, PyObject **args, Py_ssize_t nargs)
_multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *sizeobj = Py_None;
if (!_PyArg_UnpackStack(args, nargs, "readline",
if (!PyArg_UnpackTuple(args, "readline",
0, 1,
&sizeobj)) {
goto exit;
@ -251,19 +251,19 @@ PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_readlines__doc__,
"\n");
#define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READLINES_METHODDEF \
{"readlines", (PyCFunction)_multibytecodec_MultibyteStreamReader_readlines, METH_FASTCALL, _multibytecodec_MultibyteStreamReader_readlines__doc__},
{"readlines", (PyCFunction)_multibytecodec_MultibyteStreamReader_readlines, METH_VARARGS, _multibytecodec_MultibyteStreamReader_readlines__doc__},
static PyObject *
_multibytecodec_MultibyteStreamReader_readlines_impl(MultibyteStreamReaderObject *self,
PyObject *sizehintobj);
static PyObject *
_multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *self, PyObject **args, Py_ssize_t nargs)
_multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *sizehintobj = Py_None;
if (!_PyArg_UnpackStack(args, nargs, "readlines",
if (!PyArg_UnpackTuple(args, "readlines",
0, 1,
&sizehintobj)) {
goto exit;
@ -331,4 +331,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
/*[clinic end generated code: output=dc2352619de9d74f input=a9049054013a1b77]*/
/*[clinic end generated code: output=134b9e36cb985939 input=a9049054013a1b77]*/

View file

@ -268,7 +268,7 @@ PyDoc_STRVAR(_asyncio_Task_current_task__doc__,
"None is returned when called not in the context of a Task.");
#define _ASYNCIO_TASK_CURRENT_TASK_METHODDEF \
{"current_task", (PyCFunction)_asyncio_Task_current_task, METH_FASTCALL|METH_KEYWORDS|METH_CLASS, _asyncio_Task_current_task__doc__},
{"current_task", (PyCFunction)_asyncio_Task_current_task, METH_FASTCALL|METH_CLASS, _asyncio_Task_current_task__doc__},
static PyObject *
_asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop);
@ -300,7 +300,7 @@ PyDoc_STRVAR(_asyncio_Task_all_tasks__doc__,
"By default all tasks for the current event loop are returned.");
#define _ASYNCIO_TASK_ALL_TASKS_METHODDEF \
{"all_tasks", (PyCFunction)_asyncio_Task_all_tasks, METH_FASTCALL|METH_KEYWORDS|METH_CLASS, _asyncio_Task_all_tasks__doc__},
{"all_tasks", (PyCFunction)_asyncio_Task_all_tasks, METH_FASTCALL|METH_CLASS, _asyncio_Task_all_tasks__doc__},
static PyObject *
_asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop);
@ -400,7 +400,7 @@ PyDoc_STRVAR(_asyncio_Task_get_stack__doc__,
"returned for a suspended coroutine.");
#define _ASYNCIO_TASK_GET_STACK_METHODDEF \
{"get_stack", (PyCFunction)_asyncio_Task_get_stack, METH_FASTCALL|METH_KEYWORDS, _asyncio_Task_get_stack__doc__},
{"get_stack", (PyCFunction)_asyncio_Task_get_stack, METH_FASTCALL, _asyncio_Task_get_stack__doc__},
static PyObject *
_asyncio_Task_get_stack_impl(TaskObj *self, PyObject *limit);
@ -436,7 +436,7 @@ PyDoc_STRVAR(_asyncio_Task_print_stack__doc__,
"to sys.stderr.");
#define _ASYNCIO_TASK_PRINT_STACK_METHODDEF \
{"print_stack", (PyCFunction)_asyncio_Task_print_stack, METH_FASTCALL|METH_KEYWORDS, _asyncio_Task_print_stack__doc__},
{"print_stack", (PyCFunction)_asyncio_Task_print_stack, METH_FASTCALL, _asyncio_Task_print_stack__doc__},
static PyObject *
_asyncio_Task_print_stack_impl(TaskObj *self, PyObject *limit,
@ -467,7 +467,7 @@ PyDoc_STRVAR(_asyncio_Task__step__doc__,
"\n");
#define _ASYNCIO_TASK__STEP_METHODDEF \
{"_step", (PyCFunction)_asyncio_Task__step, METH_FASTCALL|METH_KEYWORDS, _asyncio_Task__step__doc__},
{"_step", (PyCFunction)_asyncio_Task__step, METH_FASTCALL, _asyncio_Task__step__doc__},
static PyObject *
_asyncio_Task__step_impl(TaskObj *self, PyObject *exc);
@ -496,7 +496,7 @@ PyDoc_STRVAR(_asyncio_Task__wakeup__doc__,
"\n");
#define _ASYNCIO_TASK__WAKEUP_METHODDEF \
{"_wakeup", (PyCFunction)_asyncio_Task__wakeup, METH_FASTCALL|METH_KEYWORDS, _asyncio_Task__wakeup__doc__},
{"_wakeup", (PyCFunction)_asyncio_Task__wakeup, METH_FASTCALL, _asyncio_Task__wakeup__doc__},
static PyObject *
_asyncio_Task__wakeup_impl(TaskObj *self, PyObject *fut);
@ -518,4 +518,4 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject
exit:
return return_value;
}
/*[clinic end generated code: output=b92f9cd2b9fb37ef input=a9049054013a1b77]*/
/*[clinic end generated code: output=1f2f5bbc35bc3c4e input=a9049054013a1b77]*/

View file

@ -116,7 +116,7 @@ PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__,
"the unused_data attribute.");
#define _BZ2_BZ2DECOMPRESSOR_DECOMPRESS_METHODDEF \
{"decompress", (PyCFunction)_bz2_BZ2Decompressor_decompress, METH_FASTCALL|METH_KEYWORDS, _bz2_BZ2Decompressor_decompress__doc__},
{"decompress", (PyCFunction)_bz2_BZ2Decompressor_decompress, METH_FASTCALL, _bz2_BZ2Decompressor_decompress__doc__},
static PyObject *
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
@ -175,4 +175,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=835673574cf12cc4 input=a9049054013a1b77]*/
/*[clinic end generated code: output=0e97a1d716b35a14 input=a9049054013a1b77]*/

View file

@ -56,7 +56,7 @@ PyDoc_STRVAR(_codecs_encode__doc__,
"codecs.register_error that can handle ValueErrors.");
#define _CODECS_ENCODE_METHODDEF \
{"encode", (PyCFunction)_codecs_encode, METH_FASTCALL|METH_KEYWORDS, _codecs_encode__doc__},
{"encode", (PyCFunction)_codecs_encode, METH_FASTCALL, _codecs_encode__doc__},
static PyObject *
_codecs_encode_impl(PyObject *module, PyObject *obj, const char *encoding,
@ -95,7 +95,7 @@ PyDoc_STRVAR(_codecs_decode__doc__,
"codecs.register_error that can handle ValueErrors.");
#define _CODECS_DECODE_METHODDEF \
{"decode", (PyCFunction)_codecs_decode, METH_FASTCALL|METH_KEYWORDS, _codecs_decode__doc__},
{"decode", (PyCFunction)_codecs_decode, METH_FASTCALL, _codecs_decode__doc__},
static PyObject *
_codecs_decode_impl(PyObject *module, PyObject *obj, const char *encoding,
@ -161,7 +161,7 @@ _codecs_escape_decode_impl(PyObject *module, Py_buffer *data,
const char *errors);
static PyObject *
_codecs_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -171,6 +171,10 @@ _codecs_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("escape_decode", kwnames)) {
goto exit;
}
return_value = _codecs_escape_decode_impl(module, &data, errors);
exit:
@ -195,7 +199,7 @@ _codecs_escape_encode_impl(PyObject *module, PyObject *data,
const char *errors);
static PyObject *
_codecs_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *data;
@ -205,6 +209,10 @@ _codecs_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&PyBytes_Type, &data, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("escape_encode", kwnames)) {
goto exit;
}
return_value = _codecs_escape_encode_impl(module, data, errors);
exit:
@ -224,7 +232,7 @@ _codecs_unicode_internal_decode_impl(PyObject *module, PyObject *obj,
const char *errors);
static PyObject *
_codecs_unicode_internal_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_unicode_internal_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *obj;
@ -234,6 +242,10 @@ _codecs_unicode_internal_decode(PyObject *module, PyObject **args, Py_ssize_t na
&obj, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("unicode_internal_decode", kwnames)) {
goto exit;
}
return_value = _codecs_unicode_internal_decode_impl(module, obj, errors);
exit:
@ -253,7 +265,7 @@ _codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_utf_7_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_7_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -264,6 +276,10 @@ _codecs_utf_7_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_7_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_7_decode_impl(module, &data, errors, final);
exit:
@ -288,7 +304,7 @@ _codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_utf_8_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_8_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -299,6 +315,10 @@ _codecs_utf_8_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_8_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_8_decode_impl(module, &data, errors, final);
exit:
@ -323,7 +343,7 @@ _codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_utf_16_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_16_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -334,6 +354,10 @@ _codecs_utf_16_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_16_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_16_decode_impl(module, &data, errors, final);
exit:
@ -358,7 +382,7 @@ _codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_utf_16_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_16_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -369,6 +393,10 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_16_le_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final);
exit:
@ -393,7 +421,7 @@ _codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_utf_16_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_16_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -404,6 +432,10 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_16_be_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final);
exit:
@ -429,7 +461,7 @@ _codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int byteorder, int final);
static PyObject *
_codecs_utf_16_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_16_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -441,6 +473,10 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &byteorder, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_16_ex_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_16_ex_decode_impl(module, &data, errors, byteorder, final);
exit:
@ -465,7 +501,7 @@ _codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_utf_32_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_32_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -476,6 +512,10 @@ _codecs_utf_32_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_32_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_32_decode_impl(module, &data, errors, final);
exit:
@ -500,7 +540,7 @@ _codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_utf_32_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_32_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -511,6 +551,10 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_32_le_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final);
exit:
@ -535,7 +579,7 @@ _codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_utf_32_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_32_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -546,6 +590,10 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_32_be_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final);
exit:
@ -571,7 +619,7 @@ _codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int byteorder, int final);
static PyObject *
_codecs_utf_32_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_32_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -583,6 +631,10 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &byteorder, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_32_ex_decode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_32_ex_decode_impl(module, &data, errors, byteorder, final);
exit:
@ -607,7 +659,7 @@ _codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
const char *errors);
static PyObject *
_codecs_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -617,6 +669,10 @@ _codecs_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t narg
&data, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("unicode_escape_decode", kwnames)) {
goto exit;
}
return_value = _codecs_unicode_escape_decode_impl(module, &data, errors);
exit:
@ -641,7 +697,7 @@ _codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
const char *errors);
static PyObject *
_codecs_raw_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_raw_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -651,6 +707,10 @@ _codecs_raw_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t
&data, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("raw_unicode_escape_decode", kwnames)) {
goto exit;
}
return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors);
exit:
@ -675,7 +735,7 @@ _codecs_latin_1_decode_impl(PyObject *module, Py_buffer *data,
const char *errors);
static PyObject *
_codecs_latin_1_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_latin_1_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -685,6 +745,10 @@ _codecs_latin_1_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("latin_1_decode", kwnames)) {
goto exit;
}
return_value = _codecs_latin_1_decode_impl(module, &data, errors);
exit:
@ -709,7 +773,7 @@ _codecs_ascii_decode_impl(PyObject *module, Py_buffer *data,
const char *errors);
static PyObject *
_codecs_ascii_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_ascii_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -719,6 +783,10 @@ _codecs_ascii_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("ascii_decode", kwnames)) {
goto exit;
}
return_value = _codecs_ascii_decode_impl(module, &data, errors);
exit:
@ -743,7 +811,7 @@ _codecs_charmap_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, PyObject *mapping);
static PyObject *
_codecs_charmap_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_charmap_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -754,6 +822,10 @@ _codecs_charmap_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &mapping)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("charmap_decode", kwnames)) {
goto exit;
}
return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping);
exit:
@ -780,7 +852,7 @@ _codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_mbcs_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_mbcs_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -791,6 +863,10 @@ _codecs_mbcs_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("mbcs_decode", kwnames)) {
goto exit;
}
return_value = _codecs_mbcs_decode_impl(module, &data, errors, final);
exit:
@ -819,7 +895,7 @@ _codecs_oem_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final);
static PyObject *
_codecs_oem_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_oem_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -830,6 +906,10 @@ _codecs_oem_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("oem_decode", kwnames)) {
goto exit;
}
return_value = _codecs_oem_decode_impl(module, &data, errors, final);
exit:
@ -858,7 +938,7 @@ _codecs_code_page_decode_impl(PyObject *module, int codepage,
Py_buffer *data, const char *errors, int final);
static PyObject *
_codecs_code_page_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_code_page_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int codepage;
@ -870,6 +950,10 @@ _codecs_code_page_decode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&codepage, &data, &errors, &final)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("code_page_decode", kwnames)) {
goto exit;
}
return_value = _codecs_code_page_decode_impl(module, codepage, &data, errors, final);
exit:
@ -896,7 +980,7 @@ _codecs_readbuffer_encode_impl(PyObject *module, Py_buffer *data,
const char *errors);
static PyObject *
_codecs_readbuffer_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_readbuffer_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -906,6 +990,10 @@ _codecs_readbuffer_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readbuffer_encode", kwnames)) {
goto exit;
}
return_value = _codecs_readbuffer_encode_impl(module, &data, errors);
exit:
@ -930,7 +1018,7 @@ _codecs_unicode_internal_encode_impl(PyObject *module, PyObject *obj,
const char *errors);
static PyObject *
_codecs_unicode_internal_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_unicode_internal_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *obj;
@ -940,6 +1028,10 @@ _codecs_unicode_internal_encode(PyObject *module, PyObject **args, Py_ssize_t na
&obj, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("unicode_internal_encode", kwnames)) {
goto exit;
}
return_value = _codecs_unicode_internal_encode_impl(module, obj, errors);
exit:
@ -959,7 +1051,7 @@ _codecs_utf_7_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_utf_7_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_7_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -969,6 +1061,10 @@ _codecs_utf_7_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_7_encode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_7_encode_impl(module, str, errors);
exit:
@ -988,7 +1084,7 @@ _codecs_utf_8_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_utf_8_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_8_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -998,6 +1094,10 @@ _codecs_utf_8_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_8_encode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_8_encode_impl(module, str, errors);
exit:
@ -1017,7 +1117,7 @@ _codecs_utf_16_encode_impl(PyObject *module, PyObject *str,
const char *errors, int byteorder);
static PyObject *
_codecs_utf_16_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_16_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1028,6 +1128,10 @@ _codecs_utf_16_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors, &byteorder)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_16_encode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder);
exit:
@ -1047,7 +1151,7 @@ _codecs_utf_16_le_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_utf_16_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_16_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1057,6 +1161,10 @@ _codecs_utf_16_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_16_le_encode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_16_le_encode_impl(module, str, errors);
exit:
@ -1076,7 +1184,7 @@ _codecs_utf_16_be_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_utf_16_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_16_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1086,6 +1194,10 @@ _codecs_utf_16_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_16_be_encode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_16_be_encode_impl(module, str, errors);
exit:
@ -1105,7 +1217,7 @@ _codecs_utf_32_encode_impl(PyObject *module, PyObject *str,
const char *errors, int byteorder);
static PyObject *
_codecs_utf_32_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_32_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1116,6 +1228,10 @@ _codecs_utf_32_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors, &byteorder)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_32_encode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder);
exit:
@ -1135,7 +1251,7 @@ _codecs_utf_32_le_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_utf_32_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_32_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1145,6 +1261,10 @@ _codecs_utf_32_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_32_le_encode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_32_le_encode_impl(module, str, errors);
exit:
@ -1164,7 +1284,7 @@ _codecs_utf_32_be_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_utf_32_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_utf_32_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1174,6 +1294,10 @@ _codecs_utf_32_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("utf_32_be_encode", kwnames)) {
goto exit;
}
return_value = _codecs_utf_32_be_encode_impl(module, str, errors);
exit:
@ -1193,7 +1317,7 @@ _codecs_unicode_escape_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1203,6 +1327,10 @@ _codecs_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t narg
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("unicode_escape_encode", kwnames)) {
goto exit;
}
return_value = _codecs_unicode_escape_encode_impl(module, str, errors);
exit:
@ -1222,7 +1350,7 @@ _codecs_raw_unicode_escape_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_raw_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_raw_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1232,6 +1360,10 @@ _codecs_raw_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("raw_unicode_escape_encode", kwnames)) {
goto exit;
}
return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors);
exit:
@ -1251,7 +1383,7 @@ _codecs_latin_1_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_latin_1_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_latin_1_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1261,6 +1393,10 @@ _codecs_latin_1_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("latin_1_encode", kwnames)) {
goto exit;
}
return_value = _codecs_latin_1_encode_impl(module, str, errors);
exit:
@ -1280,7 +1416,7 @@ _codecs_ascii_encode_impl(PyObject *module, PyObject *str,
const char *errors);
static PyObject *
_codecs_ascii_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_ascii_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1290,6 +1426,10 @@ _codecs_ascii_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("ascii_encode", kwnames)) {
goto exit;
}
return_value = _codecs_ascii_encode_impl(module, str, errors);
exit:
@ -1309,7 +1449,7 @@ _codecs_charmap_encode_impl(PyObject *module, PyObject *str,
const char *errors, PyObject *mapping);
static PyObject *
_codecs_charmap_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_charmap_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1320,6 +1460,10 @@ _codecs_charmap_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors, &mapping)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("charmap_encode", kwnames)) {
goto exit;
}
return_value = _codecs_charmap_encode_impl(module, str, errors, mapping);
exit:
@ -1366,7 +1510,7 @@ static PyObject *
_codecs_mbcs_encode_impl(PyObject *module, PyObject *str, const char *errors);
static PyObject *
_codecs_mbcs_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_mbcs_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1376,6 +1520,10 @@ _codecs_mbcs_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("mbcs_encode", kwnames)) {
goto exit;
}
return_value = _codecs_mbcs_encode_impl(module, str, errors);
exit:
@ -1398,7 +1546,7 @@ static PyObject *
_codecs_oem_encode_impl(PyObject *module, PyObject *str, const char *errors);
static PyObject *
_codecs_oem_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_oem_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *str;
@ -1408,6 +1556,10 @@ _codecs_oem_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("oem_encode", kwnames)) {
goto exit;
}
return_value = _codecs_oem_encode_impl(module, str, errors);
exit:
@ -1431,7 +1583,7 @@ _codecs_code_page_encode_impl(PyObject *module, int code_page, PyObject *str,
const char *errors);
static PyObject *
_codecs_code_page_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_code_page_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int code_page;
@ -1442,6 +1594,10 @@ _codecs_code_page_encode(PyObject *module, PyObject **args, Py_ssize_t nargs)
&code_page, &str, &errors)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("code_page_encode", kwnames)) {
goto exit;
}
return_value = _codecs_code_page_encode_impl(module, code_page, str, errors);
exit:
@ -1468,7 +1624,7 @@ _codecs_register_error_impl(PyObject *module, const char *errors,
PyObject *handler);
static PyObject *
_codecs_register_error(PyObject *module, PyObject **args, Py_ssize_t nargs)
_codecs_register_error(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
const char *errors;
@ -1478,6 +1634,10 @@ _codecs_register_error(PyObject *module, PyObject **args, Py_ssize_t nargs)
&errors, &handler)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("register_error", kwnames)) {
goto exit;
}
return_value = _codecs_register_error_impl(module, errors, handler);
exit:
@ -1537,4 +1697,4 @@ exit:
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF
#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
/*[clinic end generated code: output=894910ed4900eeae input=a9049054013a1b77]*/
/*[clinic end generated code: output=36fb42f450a3b4dc input=a9049054013a1b77]*/

View file

@ -21,7 +21,7 @@ static PyObject *
crypt_crypt_impl(PyObject *module, const char *word, const char *salt);
static PyObject *
crypt_crypt(PyObject *module, PyObject **args, Py_ssize_t nargs)
crypt_crypt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
const char *word;
@ -31,9 +31,13 @@ crypt_crypt(PyObject *module, PyObject **args, Py_ssize_t nargs)
&word, &salt)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("crypt", kwnames)) {
goto exit;
}
return_value = crypt_crypt_impl(module, word, salt);
exit:
return return_value;
}
/*[clinic end generated code: output=f5a6aff28d43154f input=a9049054013a1b77]*/
/*[clinic end generated code: output=3fd5d3625a6f32fe input=a9049054013a1b77]*/

View file

@ -15,7 +15,7 @@ PyDoc_STRVAR(datetime_datetime_now__doc__,
"If no tz is specified, uses local timezone.");
#define DATETIME_DATETIME_NOW_METHODDEF \
{"now", (PyCFunction)datetime_datetime_now, METH_FASTCALL|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
{"now", (PyCFunction)datetime_datetime_now, METH_FASTCALL|METH_CLASS, datetime_datetime_now__doc__},
static PyObject *
datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
@ -37,4 +37,4 @@ datetime_datetime_now(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyO
exit:
return return_value;
}
/*[clinic end generated code: output=93cb014e47dae4b3 input=a9049054013a1b77]*/
/*[clinic end generated code: output=ff78f2f51687e9a9 input=a9049054013a1b77]*/

View file

@ -53,7 +53,7 @@ _dbm_dbm_get_impl(dbmobject *self, const char *key,
Py_ssize_clean_t key_length, PyObject *default_value);
static PyObject *
_dbm_dbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs)
_dbm_dbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
const char *key;
@ -64,6 +64,10 @@ _dbm_dbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs)
&key, &key_length, &default_value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("get", kwnames)) {
goto exit;
}
return_value = _dbm_dbm_get_impl(self, key, key_length, default_value);
exit:
@ -87,7 +91,7 @@ _dbm_dbm_setdefault_impl(dbmobject *self, const char *key,
PyObject *default_value);
static PyObject *
_dbm_dbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs)
_dbm_dbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
const char *key;
@ -98,6 +102,10 @@ _dbm_dbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs)
&key, &key_length, &default_value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("setdefault", kwnames)) {
goto exit;
}
return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value);
exit:
@ -126,7 +134,7 @@ dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
int mode);
static PyObject *
dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs)
dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *filename;
@ -137,9 +145,13 @@ dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs)
&filename, &flags, &mode)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("open", kwnames)) {
goto exit;
}
return_value = dbmopen_impl(module, filename, flags, mode);
exit:
return return_value;
}
/*[clinic end generated code: output=fa1f129675b8e7e5 input=a9049054013a1b77]*/
/*[clinic end generated code: output=60482e924110a70a input=a9049054013a1b77]*/

View file

@ -137,7 +137,7 @@ PyDoc_STRVAR(_elementtree_Element_find__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_FIND_METHODDEF \
{"find", (PyCFunction)_elementtree_Element_find, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_find__doc__},
{"find", (PyCFunction)_elementtree_Element_find, METH_FASTCALL, _elementtree_Element_find__doc__},
static PyObject *
_elementtree_Element_find_impl(ElementObject *self, PyObject *path,
@ -168,7 +168,7 @@ PyDoc_STRVAR(_elementtree_Element_findtext__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_FINDTEXT_METHODDEF \
{"findtext", (PyCFunction)_elementtree_Element_findtext, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_findtext__doc__},
{"findtext", (PyCFunction)_elementtree_Element_findtext, METH_FASTCALL, _elementtree_Element_findtext__doc__},
static PyObject *
_elementtree_Element_findtext_impl(ElementObject *self, PyObject *path,
@ -201,7 +201,7 @@ PyDoc_STRVAR(_elementtree_Element_findall__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_FINDALL_METHODDEF \
{"findall", (PyCFunction)_elementtree_Element_findall, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_findall__doc__},
{"findall", (PyCFunction)_elementtree_Element_findall, METH_FASTCALL, _elementtree_Element_findall__doc__},
static PyObject *
_elementtree_Element_findall_impl(ElementObject *self, PyObject *path,
@ -232,7 +232,7 @@ PyDoc_STRVAR(_elementtree_Element_iterfind__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_ITERFIND_METHODDEF \
{"iterfind", (PyCFunction)_elementtree_Element_iterfind, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_iterfind__doc__},
{"iterfind", (PyCFunction)_elementtree_Element_iterfind, METH_FASTCALL, _elementtree_Element_iterfind__doc__},
static PyObject *
_elementtree_Element_iterfind_impl(ElementObject *self, PyObject *path,
@ -263,7 +263,7 @@ PyDoc_STRVAR(_elementtree_Element_get__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_GET_METHODDEF \
{"get", (PyCFunction)_elementtree_Element_get, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_get__doc__},
{"get", (PyCFunction)_elementtree_Element_get, METH_FASTCALL, _elementtree_Element_get__doc__},
static PyObject *
_elementtree_Element_get_impl(ElementObject *self, PyObject *key,
@ -311,7 +311,7 @@ PyDoc_STRVAR(_elementtree_Element_iter__doc__,
"\n");
#define _ELEMENTTREE_ELEMENT_ITER_METHODDEF \
{"iter", (PyCFunction)_elementtree_Element_iter, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_iter__doc__},
{"iter", (PyCFunction)_elementtree_Element_iter, METH_FASTCALL, _elementtree_Element_iter__doc__},
static PyObject *
_elementtree_Element_iter_impl(ElementObject *self, PyObject *tag);
@ -364,7 +364,7 @@ _elementtree_Element_insert_impl(ElementObject *self, Py_ssize_t index,
PyObject *subelement);
static PyObject *
_elementtree_Element_insert(ElementObject *self, PyObject **args, Py_ssize_t nargs)
_elementtree_Element_insert(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t index;
@ -374,6 +374,10 @@ _elementtree_Element_insert(ElementObject *self, PyObject **args, Py_ssize_t nar
&index, &Element_Type, &subelement)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
goto exit;
}
return_value = _elementtree_Element_insert_impl(self, index, subelement);
exit:
@ -427,7 +431,7 @@ _elementtree_Element_makeelement_impl(ElementObject *self, PyObject *tag,
PyObject *attrib);
static PyObject *
_elementtree_Element_makeelement(ElementObject *self, PyObject **args, Py_ssize_t nargs)
_elementtree_Element_makeelement(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *tag;
@ -438,6 +442,10 @@ _elementtree_Element_makeelement(ElementObject *self, PyObject **args, Py_ssize_
&tag, &attrib)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("makeelement", kwnames)) {
goto exit;
}
return_value = _elementtree_Element_makeelement_impl(self, tag, attrib);
exit:
@ -483,7 +491,7 @@ _elementtree_Element_set_impl(ElementObject *self, PyObject *key,
PyObject *value);
static PyObject *
_elementtree_Element_set(ElementObject *self, PyObject **args, Py_ssize_t nargs)
_elementtree_Element_set(ElementObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *key;
@ -494,6 +502,10 @@ _elementtree_Element_set(ElementObject *self, PyObject **args, Py_ssize_t nargs)
&key, &value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("set", kwnames)) {
goto exit;
}
return_value = _elementtree_Element_set_impl(self, key, value);
exit:
@ -568,7 +580,7 @@ _elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag,
PyObject *attrs);
static PyObject *
_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject **args, Py_ssize_t nargs)
_elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *tag;
@ -579,6 +591,10 @@ _elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject **args, Py_ssiz
&tag, &attrs)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("start", kwnames)) {
goto exit;
}
return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs);
exit:
@ -655,7 +671,7 @@ _elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name,
PyObject *pubid, PyObject *system);
static PyObject *
_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_t nargs)
_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *name;
@ -667,6 +683,10 @@ _elementtree_XMLParser_doctype(XMLParserObject *self, PyObject **args, Py_ssize_
&name, &pubid, &system)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("doctype", kwnames)) {
goto exit;
}
return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system);
exit:
@ -687,7 +707,7 @@ _elementtree_XMLParser__setevents_impl(XMLParserObject *self,
PyObject *events_to_report);
static PyObject *
_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject **args, Py_ssize_t nargs)
_elementtree_XMLParser__setevents(XMLParserObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *events_queue;
@ -698,9 +718,13 @@ _elementtree_XMLParser__setevents(XMLParserObject *self, PyObject **args, Py_ssi
&events_queue, &events_to_report)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("_setevents", kwnames)) {
goto exit;
}
return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report);
exit:
return return_value;
}
/*[clinic end generated code: output=834a6b1d4032cea2 input=a9049054013a1b77]*/
/*[clinic end generated code: output=b69fa98c40917f58 input=a9049054013a1b77]*/

View file

@ -16,7 +16,7 @@ static PyObject *
_gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value);
static PyObject *
_gdbm_gdbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs)
_gdbm_gdbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *key;
@ -27,6 +27,10 @@ _gdbm_gdbm_get(dbmobject *self, PyObject **args, Py_ssize_t nargs)
&key, &default_value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("get", kwnames)) {
goto exit;
}
return_value = _gdbm_gdbm_get_impl(self, key, default_value);
exit:
@ -47,7 +51,7 @@ _gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key,
PyObject *default_value);
static PyObject *
_gdbm_gdbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs)
_gdbm_gdbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *key;
@ -58,6 +62,10 @@ _gdbm_gdbm_setdefault(dbmobject *self, PyObject **args, Py_ssize_t nargs)
&key, &default_value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("setdefault", kwnames)) {
goto exit;
}
return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value);
exit:
@ -239,7 +247,7 @@ dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
int mode);
static PyObject *
dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs)
dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *filename;
@ -250,9 +258,13 @@ dbmopen(PyObject *module, PyObject **args, Py_ssize_t nargs)
&filename, &flags, &mode)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("open", kwnames)) {
goto exit;
}
return_value = dbmopen_impl(module, filename, flags, mode);
exit:
return return_value;
}
/*[clinic end generated code: output=275c7f70ce0a9d2f input=a9049054013a1b77]*/
/*[clinic end generated code: output=d12de247acddccc3 input=a9049054013a1b77]*/

View file

@ -82,7 +82,7 @@ PyDoc_STRVAR(_lzma_LZMADecompressor_decompress__doc__,
"the unused_data attribute.");
#define _LZMA_LZMADECOMPRESSOR_DECOMPRESS_METHODDEF \
{"decompress", (PyCFunction)_lzma_LZMADecompressor_decompress, METH_FASTCALL|METH_KEYWORDS, _lzma_LZMADecompressor_decompress__doc__},
{"decompress", (PyCFunction)_lzma_LZMADecompressor_decompress, METH_FASTCALL, _lzma_LZMADecompressor_decompress__doc__},
static PyObject *
_lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data,
@ -237,7 +237,7 @@ _lzma__decode_filter_properties_impl(PyObject *module, lzma_vli filter_id,
Py_buffer *encoded_props);
static PyObject *
_lzma__decode_filter_properties(PyObject *module, PyObject **args, Py_ssize_t nargs)
_lzma__decode_filter_properties(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
lzma_vli filter_id;
@ -247,6 +247,10 @@ _lzma__decode_filter_properties(PyObject *module, PyObject **args, Py_ssize_t na
lzma_vli_converter, &filter_id, &encoded_props)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("_decode_filter_properties", kwnames)) {
goto exit;
}
return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props);
exit:
@ -257,4 +261,4 @@ exit:
return return_value;
}
/*[clinic end generated code: output=d4e3802d0dea9af3 input=a9049054013a1b77]*/
/*[clinic end generated code: output=5f7a915fb7e41453 input=a9049054013a1b77]*/

View file

@ -16,7 +16,7 @@ static int
_opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg);
static PyObject *
_opcode_stack_effect(PyObject *module, PyObject **args, Py_ssize_t nargs)
_opcode_stack_effect(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int opcode;
@ -27,6 +27,10 @@ _opcode_stack_effect(PyObject *module, PyObject **args, Py_ssize_t nargs)
&opcode, &oparg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("stack_effect", kwnames)) {
goto exit;
}
_return_value = _opcode_stack_effect_impl(module, opcode, oparg);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -36,4 +40,4 @@ _opcode_stack_effect(PyObject *module, PyObject **args, Py_ssize_t nargs)
exit:
return return_value;
}
/*[clinic end generated code: output=616105b05b55eb45 input=a9049054013a1b77]*/
/*[clinic end generated code: output=62858005ac85baa9 input=a9049054013a1b77]*/

View file

@ -208,7 +208,7 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self,
PyObject *global_name);
static PyObject *
_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject **args, Py_ssize_t nargs)
_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *module_name;
@ -219,6 +219,10 @@ _pickle_Unpickler_find_class(UnpicklerObject *self, PyObject **args, Py_ssize_t
&module_name, &global_name)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("find_class", kwnames)) {
goto exit;
}
return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name);
exit:
@ -385,7 +389,7 @@ PyDoc_STRVAR(_pickle_dump__doc__,
"2, so that the pickle data stream is readable with Python 2.");
#define _PICKLE_DUMP_METHODDEF \
{"dump", (PyCFunction)_pickle_dump, METH_FASTCALL|METH_KEYWORDS, _pickle_dump__doc__},
{"dump", (PyCFunction)_pickle_dump, METH_FASTCALL, _pickle_dump__doc__},
static PyObject *
_pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
@ -431,7 +435,7 @@ PyDoc_STRVAR(_pickle_dumps__doc__,
"Python 2, so that the pickle data stream is readable with Python 2.");
#define _PICKLE_DUMPS_METHODDEF \
{"dumps", (PyCFunction)_pickle_dumps, METH_FASTCALL|METH_KEYWORDS, _pickle_dumps__doc__},
{"dumps", (PyCFunction)_pickle_dumps, METH_FASTCALL, _pickle_dumps__doc__},
static PyObject *
_pickle_dumps_impl(PyObject *module, PyObject *obj, PyObject *protocol,
@ -487,7 +491,7 @@ PyDoc_STRVAR(_pickle_load__doc__,
"string instances as bytes objects.");
#define _PICKLE_LOAD_METHODDEF \
{"load", (PyCFunction)_pickle_load, METH_FASTCALL|METH_KEYWORDS, _pickle_load__doc__},
{"load", (PyCFunction)_pickle_load, METH_FASTCALL, _pickle_load__doc__},
static PyObject *
_pickle_load_impl(PyObject *module, PyObject *file, int fix_imports,
@ -535,7 +539,7 @@ PyDoc_STRVAR(_pickle_loads__doc__,
"string instances as bytes objects.");
#define _PICKLE_LOADS_METHODDEF \
{"loads", (PyCFunction)_pickle_loads, METH_FASTCALL|METH_KEYWORDS, _pickle_loads__doc__},
{"loads", (PyCFunction)_pickle_loads, METH_FASTCALL, _pickle_loads__doc__},
static PyObject *
_pickle_loads_impl(PyObject *module, PyObject *data, int fix_imports,
@ -561,4 +565,4 @@ _pickle_loads(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
exit:
return return_value;
}
/*[clinic end generated code: output=a6243aaa6ea98732 input=a9049054013a1b77]*/
/*[clinic end generated code: output=b921d325b2f7a096 input=a9049054013a1b77]*/

View file

@ -42,7 +42,7 @@ static int
_sre_getlower_impl(PyObject *module, int character, int flags);
static PyObject *
_sre_getlower(PyObject *module, PyObject **args, Py_ssize_t nargs)
_sre_getlower(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int character;
@ -53,6 +53,10 @@ _sre_getlower(PyObject *module, PyObject **args, Py_ssize_t nargs)
&character, &flags)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("getlower", kwnames)) {
goto exit;
}
_return_value = _sre_getlower_impl(module, character, flags);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -70,7 +74,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_match__doc__,
"Matches zero or more characters at the beginning of the string.");
#define _SRE_SRE_PATTERN_MATCH_METHODDEF \
{"match", (PyCFunction)_sre_SRE_Pattern_match, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_match__doc__},
{"match", (PyCFunction)_sre_SRE_Pattern_match, METH_FASTCALL, _sre_SRE_Pattern_match__doc__},
static PyObject *
_sre_SRE_Pattern_match_impl(PatternObject *self, PyObject *string,
@ -106,7 +110,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_fullmatch__doc__,
"Matches against all of the string");
#define _SRE_SRE_PATTERN_FULLMATCH_METHODDEF \
{"fullmatch", (PyCFunction)_sre_SRE_Pattern_fullmatch, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_fullmatch__doc__},
{"fullmatch", (PyCFunction)_sre_SRE_Pattern_fullmatch, METH_FASTCALL, _sre_SRE_Pattern_fullmatch__doc__},
static PyObject *
_sre_SRE_Pattern_fullmatch_impl(PatternObject *self, PyObject *string,
@ -144,7 +148,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_search__doc__,
"Return None if no position in the string matches.");
#define _SRE_SRE_PATTERN_SEARCH_METHODDEF \
{"search", (PyCFunction)_sre_SRE_Pattern_search, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_search__doc__},
{"search", (PyCFunction)_sre_SRE_Pattern_search, METH_FASTCALL, _sre_SRE_Pattern_search__doc__},
static PyObject *
_sre_SRE_Pattern_search_impl(PatternObject *self, PyObject *string,
@ -180,7 +184,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_findall__doc__,
"Return a list of all non-overlapping matches of pattern in string.");
#define _SRE_SRE_PATTERN_FINDALL_METHODDEF \
{"findall", (PyCFunction)_sre_SRE_Pattern_findall, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_findall__doc__},
{"findall", (PyCFunction)_sre_SRE_Pattern_findall, METH_FASTCALL, _sre_SRE_Pattern_findall__doc__},
static PyObject *
_sre_SRE_Pattern_findall_impl(PatternObject *self, PyObject *string,
@ -217,7 +221,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_finditer__doc__,
"For each match, the iterator returns a match object.");
#define _SRE_SRE_PATTERN_FINDITER_METHODDEF \
{"finditer", (PyCFunction)_sre_SRE_Pattern_finditer, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_finditer__doc__},
{"finditer", (PyCFunction)_sre_SRE_Pattern_finditer, METH_FASTCALL, _sre_SRE_Pattern_finditer__doc__},
static PyObject *
_sre_SRE_Pattern_finditer_impl(PatternObject *self, PyObject *string,
@ -249,7 +253,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_scanner__doc__,
"\n");
#define _SRE_SRE_PATTERN_SCANNER_METHODDEF \
{"scanner", (PyCFunction)_sre_SRE_Pattern_scanner, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_scanner__doc__},
{"scanner", (PyCFunction)_sre_SRE_Pattern_scanner, METH_FASTCALL, _sre_SRE_Pattern_scanner__doc__},
static PyObject *
_sre_SRE_Pattern_scanner_impl(PatternObject *self, PyObject *string,
@ -282,7 +286,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_split__doc__,
"Split string by the occurrences of pattern.");
#define _SRE_SRE_PATTERN_SPLIT_METHODDEF \
{"split", (PyCFunction)_sre_SRE_Pattern_split, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_split__doc__},
{"split", (PyCFunction)_sre_SRE_Pattern_split, METH_FASTCALL, _sre_SRE_Pattern_split__doc__},
static PyObject *
_sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
@ -315,7 +319,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_sub__doc__,
"Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.");
#define _SRE_SRE_PATTERN_SUB_METHODDEF \
{"sub", (PyCFunction)_sre_SRE_Pattern_sub, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_sub__doc__},
{"sub", (PyCFunction)_sre_SRE_Pattern_sub, METH_FASTCALL, _sre_SRE_Pattern_sub__doc__},
static PyObject *
_sre_SRE_Pattern_sub_impl(PatternObject *self, PyObject *repl,
@ -348,7 +352,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern_subn__doc__,
"Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.");
#define _SRE_SRE_PATTERN_SUBN_METHODDEF \
{"subn", (PyCFunction)_sre_SRE_Pattern_subn, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern_subn__doc__},
{"subn", (PyCFunction)_sre_SRE_Pattern_subn, METH_FASTCALL, _sre_SRE_Pattern_subn__doc__},
static PyObject *
_sre_SRE_Pattern_subn_impl(PatternObject *self, PyObject *repl,
@ -397,7 +401,7 @@ PyDoc_STRVAR(_sre_SRE_Pattern___deepcopy____doc__,
"\n");
#define _SRE_SRE_PATTERN___DEEPCOPY___METHODDEF \
{"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Pattern___deepcopy____doc__},
{"__deepcopy__", (PyCFunction)_sre_SRE_Pattern___deepcopy__, METH_FASTCALL, _sre_SRE_Pattern___deepcopy____doc__},
static PyObject *
_sre_SRE_Pattern___deepcopy___impl(PatternObject *self, PyObject *memo);
@ -427,7 +431,7 @@ PyDoc_STRVAR(_sre_compile__doc__,
"\n");
#define _SRE_COMPILE_METHODDEF \
{"compile", (PyCFunction)_sre_compile, METH_FASTCALL|METH_KEYWORDS, _sre_compile__doc__},
{"compile", (PyCFunction)_sre_compile, METH_FASTCALL, _sre_compile__doc__},
static PyObject *
_sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
@ -464,7 +468,7 @@ PyDoc_STRVAR(_sre_SRE_Match_expand__doc__,
"Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.");
#define _SRE_SRE_MATCH_EXPAND_METHODDEF \
{"expand", (PyCFunction)_sre_SRE_Match_expand, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_expand__doc__},
{"expand", (PyCFunction)_sre_SRE_Match_expand, METH_FASTCALL, _sre_SRE_Match_expand__doc__},
static PyObject *
_sre_SRE_Match_expand_impl(MatchObject *self, PyObject *template);
@ -497,7 +501,7 @@ PyDoc_STRVAR(_sre_SRE_Match_groups__doc__,
" Is used for groups that did not participate in the match.");
#define _SRE_SRE_MATCH_GROUPS_METHODDEF \
{"groups", (PyCFunction)_sre_SRE_Match_groups, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groups__doc__},
{"groups", (PyCFunction)_sre_SRE_Match_groups, METH_FASTCALL, _sre_SRE_Match_groups__doc__},
static PyObject *
_sre_SRE_Match_groups_impl(MatchObject *self, PyObject *default_value);
@ -530,7 +534,7 @@ PyDoc_STRVAR(_sre_SRE_Match_groupdict__doc__,
" Is used for groups that did not participate in the match.");
#define _SRE_SRE_MATCH_GROUPDICT_METHODDEF \
{"groupdict", (PyCFunction)_sre_SRE_Match_groupdict, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match_groupdict__doc__},
{"groupdict", (PyCFunction)_sre_SRE_Match_groupdict, METH_FASTCALL, _sre_SRE_Match_groupdict__doc__},
static PyObject *
_sre_SRE_Match_groupdict_impl(MatchObject *self, PyObject *default_value);
@ -566,7 +570,7 @@ static Py_ssize_t
_sre_SRE_Match_start_impl(MatchObject *self, PyObject *group);
static PyObject *
_sre_SRE_Match_start(MatchObject *self, PyObject **args, Py_ssize_t nargs)
_sre_SRE_Match_start(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *group = NULL;
@ -577,6 +581,10 @@ _sre_SRE_Match_start(MatchObject *self, PyObject **args, Py_ssize_t nargs)
&group)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("start", kwnames)) {
goto exit;
}
_return_value = _sre_SRE_Match_start_impl(self, group);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -600,7 +608,7 @@ static Py_ssize_t
_sre_SRE_Match_end_impl(MatchObject *self, PyObject *group);
static PyObject *
_sre_SRE_Match_end(MatchObject *self, PyObject **args, Py_ssize_t nargs)
_sre_SRE_Match_end(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *group = NULL;
@ -611,6 +619,10 @@ _sre_SRE_Match_end(MatchObject *self, PyObject **args, Py_ssize_t nargs)
&group)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("end", kwnames)) {
goto exit;
}
_return_value = _sre_SRE_Match_end_impl(self, group);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -634,7 +646,7 @@ static PyObject *
_sre_SRE_Match_span_impl(MatchObject *self, PyObject *group);
static PyObject *
_sre_SRE_Match_span(MatchObject *self, PyObject **args, Py_ssize_t nargs)
_sre_SRE_Match_span(MatchObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *group = NULL;
@ -644,6 +656,10 @@ _sre_SRE_Match_span(MatchObject *self, PyObject **args, Py_ssize_t nargs)
&group)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("span", kwnames)) {
goto exit;
}
return_value = _sre_SRE_Match_span_impl(self, group);
exit:
@ -673,7 +689,7 @@ PyDoc_STRVAR(_sre_SRE_Match___deepcopy____doc__,
"\n");
#define _SRE_SRE_MATCH___DEEPCOPY___METHODDEF \
{"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_FASTCALL|METH_KEYWORDS, _sre_SRE_Match___deepcopy____doc__},
{"__deepcopy__", (PyCFunction)_sre_SRE_Match___deepcopy__, METH_FASTCALL, _sre_SRE_Match___deepcopy____doc__},
static PyObject *
_sre_SRE_Match___deepcopy___impl(MatchObject *self, PyObject *memo);
@ -729,4 +745,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
{
return _sre_SRE_Scanner_search_impl(self);
}
/*[clinic end generated code: output=af7684e3e708200f input=a9049054013a1b77]*/
/*[clinic end generated code: output=ddfd6158e7ca39a3 input=a9049054013a1b77]*/

View file

@ -85,7 +85,7 @@ PyDoc_STRVAR(Struct_unpack_from__doc__,
"See help(struct) for more on format strings.");
#define STRUCT_UNPACK_FROM_METHODDEF \
{"unpack_from", (PyCFunction)Struct_unpack_from, METH_FASTCALL|METH_KEYWORDS, Struct_unpack_from__doc__},
{"unpack_from", (PyCFunction)Struct_unpack_from, METH_FASTCALL, Struct_unpack_from__doc__},
static PyObject *
Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer,
@ -173,7 +173,7 @@ static PyObject *
unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr);
static PyObject *
unpack(PyObject *module, PyObject **args, Py_ssize_t nargs)
unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *format;
@ -184,6 +184,10 @@ unpack(PyObject *module, PyObject **args, Py_ssize_t nargs)
&format, &inputstr)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("unpack", kwnames)) {
goto exit;
}
return_value = unpack_impl(module, format, inputstr);
exit:
@ -201,7 +205,7 @@ PyDoc_STRVAR(unpack_from__doc__,
"See help(struct) for more on format strings.");
#define UNPACK_FROM_METHODDEF \
{"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL|METH_KEYWORDS, unpack_from__doc__},
{"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL, unpack_from__doc__},
static PyObject *
unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer,
@ -250,7 +254,7 @@ static PyObject *
iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer);
static PyObject *
iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs)
iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *format;
@ -261,9 +265,13 @@ iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs)
&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=c891fcba70dba650 input=a9049054013a1b77]*/
/*[clinic end generated code: output=db8152ad222fa3d0 input=a9049054013a1b77]*/

View file

@ -45,7 +45,7 @@ _weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct,
PyObject *key);
static PyObject *
_weakref__remove_dead_weakref(PyObject *module, PyObject **args, Py_ssize_t nargs)
_weakref__remove_dead_weakref(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *dct;
@ -55,9 +55,13 @@ _weakref__remove_dead_weakref(PyObject *module, PyObject **args, Py_ssize_t narg
&PyDict_Type, &dct, &key)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("_remove_dead_weakref", kwnames)) {
goto exit;
}
return_value = _weakref__remove_dead_weakref_impl(module, dct, key);
exit:
return return_value;
}
/*[clinic end generated code: output=87ddb70850080222 input=a9049054013a1b77]*/
/*[clinic end generated code: output=b686303486bdfefd input=a9049054013a1b77]*/

View file

@ -72,7 +72,7 @@ static PyObject *
array_array_pop_impl(arrayobject *self, Py_ssize_t i);
static PyObject *
array_array_pop(arrayobject *self, PyObject **args, Py_ssize_t nargs)
array_array_pop(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t i = -1;
@ -81,6 +81,10 @@ array_array_pop(arrayobject *self, PyObject **args, Py_ssize_t nargs)
&i)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("pop", kwnames)) {
goto exit;
}
return_value = array_array_pop_impl(self, i);
exit:
@ -109,7 +113,7 @@ static PyObject *
array_array_insert_impl(arrayobject *self, Py_ssize_t i, PyObject *v);
static PyObject *
array_array_insert(arrayobject *self, PyObject **args, Py_ssize_t nargs)
array_array_insert(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t i;
@ -119,6 +123,10 @@ array_array_insert(arrayobject *self, PyObject **args, Py_ssize_t nargs)
&i, &v)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
goto exit;
}
return_value = array_array_insert_impl(self, i, v);
exit:
@ -207,7 +215,7 @@ static PyObject *
array_array_fromfile_impl(arrayobject *self, PyObject *f, Py_ssize_t n);
static PyObject *
array_array_fromfile(arrayobject *self, PyObject **args, Py_ssize_t nargs)
array_array_fromfile(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *f;
@ -217,6 +225,10 @@ array_array_fromfile(arrayobject *self, PyObject **args, Py_ssize_t nargs)
&f, &n)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("fromfile", kwnames)) {
goto exit;
}
return_value = array_array_fromfile_impl(self, f, n);
exit:
@ -453,7 +465,7 @@ array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
PyObject *items);
static PyObject *
array__array_reconstructor(PyObject *module, PyObject **args, Py_ssize_t nargs)
array__array_reconstructor(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyTypeObject *arraytype;
@ -465,6 +477,10 @@ array__array_reconstructor(PyObject *module, PyObject **args, Py_ssize_t nargs)
&arraytype, &typecode, &mformat_code, &items)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("_array_reconstructor", kwnames)) {
goto exit;
}
return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items);
exit:
@ -506,4 +522,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
/*[clinic end generated code: output=c7dfe61312b236a9 input=a9049054013a1b77]*/
/*[clinic end generated code: output=d186a7553c1f1a41 input=a9049054013a1b77]*/

View file

@ -17,7 +17,7 @@ audioop_getsample_impl(PyObject *module, Py_buffer *fragment, int width,
Py_ssize_t index);
static PyObject *
audioop_getsample(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_getsample(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -28,6 +28,10 @@ audioop_getsample(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &index)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("getsample", kwnames)) {
goto exit;
}
return_value = audioop_getsample_impl(module, &fragment, width, index);
exit:
@ -52,7 +56,7 @@ static PyObject *
audioop_max_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_max(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_max(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -62,6 +66,10 @@ audioop_max(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("max", kwnames)) {
goto exit;
}
return_value = audioop_max_impl(module, &fragment, width);
exit:
@ -86,7 +94,7 @@ static PyObject *
audioop_minmax_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_minmax(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_minmax(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -96,6 +104,10 @@ audioop_minmax(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("minmax", kwnames)) {
goto exit;
}
return_value = audioop_minmax_impl(module, &fragment, width);
exit:
@ -120,7 +132,7 @@ static PyObject *
audioop_avg_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_avg(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_avg(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -130,6 +142,10 @@ audioop_avg(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("avg", kwnames)) {
goto exit;
}
return_value = audioop_avg_impl(module, &fragment, width);
exit:
@ -154,7 +170,7 @@ static PyObject *
audioop_rms_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_rms(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_rms(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -164,6 +180,10 @@ audioop_rms(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("rms", kwnames)) {
goto exit;
}
return_value = audioop_rms_impl(module, &fragment, width);
exit:
@ -189,7 +209,7 @@ audioop_findfit_impl(PyObject *module, Py_buffer *fragment,
Py_buffer *reference);
static PyObject *
audioop_findfit(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_findfit(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -199,6 +219,10 @@ audioop_findfit(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &reference)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("findfit", kwnames)) {
goto exit;
}
return_value = audioop_findfit_impl(module, &fragment, &reference);
exit:
@ -228,7 +252,7 @@ audioop_findfactor_impl(PyObject *module, Py_buffer *fragment,
Py_buffer *reference);
static PyObject *
audioop_findfactor(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_findfactor(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -238,6 +262,10 @@ audioop_findfactor(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &reference)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("findfactor", kwnames)) {
goto exit;
}
return_value = audioop_findfactor_impl(module, &fragment, &reference);
exit:
@ -267,7 +295,7 @@ audioop_findmax_impl(PyObject *module, Py_buffer *fragment,
Py_ssize_t length);
static PyObject *
audioop_findmax(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_findmax(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -277,6 +305,10 @@ audioop_findmax(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &length)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("findmax", kwnames)) {
goto exit;
}
return_value = audioop_findmax_impl(module, &fragment, length);
exit:
@ -301,7 +333,7 @@ static PyObject *
audioop_avgpp_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_avgpp(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_avgpp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -311,6 +343,10 @@ audioop_avgpp(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("avgpp", kwnames)) {
goto exit;
}
return_value = audioop_avgpp_impl(module, &fragment, width);
exit:
@ -335,7 +371,7 @@ static PyObject *
audioop_maxpp_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_maxpp(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_maxpp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -345,6 +381,10 @@ audioop_maxpp(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("maxpp", kwnames)) {
goto exit;
}
return_value = audioop_maxpp_impl(module, &fragment, width);
exit:
@ -369,7 +409,7 @@ static PyObject *
audioop_cross_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_cross(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_cross(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -379,6 +419,10 @@ audioop_cross(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("cross", kwnames)) {
goto exit;
}
return_value = audioop_cross_impl(module, &fragment, width);
exit:
@ -404,7 +448,7 @@ audioop_mul_impl(PyObject *module, Py_buffer *fragment, int width,
double factor);
static PyObject *
audioop_mul(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_mul(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -415,6 +459,10 @@ audioop_mul(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &factor)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("mul", kwnames)) {
goto exit;
}
return_value = audioop_mul_impl(module, &fragment, width, factor);
exit:
@ -440,7 +488,7 @@ audioop_tomono_impl(PyObject *module, Py_buffer *fragment, int width,
double lfactor, double rfactor);
static PyObject *
audioop_tomono(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_tomono(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -452,6 +500,10 @@ audioop_tomono(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &lfactor, &rfactor)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("tomono", kwnames)) {
goto exit;
}
return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor);
exit:
@ -477,7 +529,7 @@ audioop_tostereo_impl(PyObject *module, Py_buffer *fragment, int width,
double lfactor, double rfactor);
static PyObject *
audioop_tostereo(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_tostereo(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -489,6 +541,10 @@ audioop_tostereo(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &lfactor, &rfactor)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("tostereo", kwnames)) {
goto exit;
}
return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor);
exit:
@ -514,7 +570,7 @@ audioop_add_impl(PyObject *module, Py_buffer *fragment1,
Py_buffer *fragment2, int width);
static PyObject *
audioop_add(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_add(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment1 = {NULL, NULL};
@ -525,6 +581,10 @@ audioop_add(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment1, &fragment2, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("add", kwnames)) {
goto exit;
}
return_value = audioop_add_impl(module, &fragment1, &fragment2, width);
exit:
@ -553,7 +613,7 @@ static PyObject *
audioop_bias_impl(PyObject *module, Py_buffer *fragment, int width, int bias);
static PyObject *
audioop_bias(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_bias(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -564,6 +624,10 @@ audioop_bias(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &bias)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("bias", kwnames)) {
goto exit;
}
return_value = audioop_bias_impl(module, &fragment, width, bias);
exit:
@ -588,7 +652,7 @@ static PyObject *
audioop_reverse_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_reverse(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_reverse(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -598,6 +662,10 @@ audioop_reverse(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("reverse", kwnames)) {
goto exit;
}
return_value = audioop_reverse_impl(module, &fragment, width);
exit:
@ -622,7 +690,7 @@ static PyObject *
audioop_byteswap_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_byteswap(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_byteswap(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -632,6 +700,10 @@ audioop_byteswap(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("byteswap", kwnames)) {
goto exit;
}
return_value = audioop_byteswap_impl(module, &fragment, width);
exit:
@ -657,7 +729,7 @@ audioop_lin2lin_impl(PyObject *module, Py_buffer *fragment, int width,
int newwidth);
static PyObject *
audioop_lin2lin(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_lin2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -668,6 +740,10 @@ audioop_lin2lin(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &newwidth)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("lin2lin", kwnames)) {
goto exit;
}
return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth);
exit:
@ -695,7 +771,7 @@ audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width,
int weightA, int weightB);
static PyObject *
audioop_ratecv(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_ratecv(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -711,6 +787,10 @@ audioop_ratecv(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("ratecv", kwnames)) {
goto exit;
}
return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB);
exit:
@ -735,7 +815,7 @@ static PyObject *
audioop_lin2ulaw_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_lin2ulaw(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_lin2ulaw(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -745,6 +825,10 @@ audioop_lin2ulaw(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("lin2ulaw", kwnames)) {
goto exit;
}
return_value = audioop_lin2ulaw_impl(module, &fragment, width);
exit:
@ -769,7 +853,7 @@ static PyObject *
audioop_ulaw2lin_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_ulaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_ulaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -779,6 +863,10 @@ audioop_ulaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("ulaw2lin", kwnames)) {
goto exit;
}
return_value = audioop_ulaw2lin_impl(module, &fragment, width);
exit:
@ -803,7 +891,7 @@ static PyObject *
audioop_lin2alaw_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_lin2alaw(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_lin2alaw(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -813,6 +901,10 @@ audioop_lin2alaw(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("lin2alaw", kwnames)) {
goto exit;
}
return_value = audioop_lin2alaw_impl(module, &fragment, width);
exit:
@ -837,7 +929,7 @@ static PyObject *
audioop_alaw2lin_impl(PyObject *module, Py_buffer *fragment, int width);
static PyObject *
audioop_alaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_alaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -847,6 +939,10 @@ audioop_alaw2lin(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("alaw2lin", kwnames)) {
goto exit;
}
return_value = audioop_alaw2lin_impl(module, &fragment, width);
exit:
@ -872,7 +968,7 @@ audioop_lin2adpcm_impl(PyObject *module, Py_buffer *fragment, int width,
PyObject *state);
static PyObject *
audioop_lin2adpcm(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_lin2adpcm(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -883,6 +979,10 @@ audioop_lin2adpcm(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &state)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("lin2adpcm", kwnames)) {
goto exit;
}
return_value = audioop_lin2adpcm_impl(module, &fragment, width, state);
exit:
@ -908,7 +1008,7 @@ audioop_adpcm2lin_impl(PyObject *module, Py_buffer *fragment, int width,
PyObject *state);
static PyObject *
audioop_adpcm2lin(PyObject *module, PyObject **args, Py_ssize_t nargs)
audioop_adpcm2lin(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer fragment = {NULL, NULL};
@ -919,6 +1019,10 @@ audioop_adpcm2lin(PyObject *module, PyObject **args, Py_ssize_t nargs)
&fragment, &width, &state)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("adpcm2lin", kwnames)) {
goto exit;
}
return_value = audioop_adpcm2lin_impl(module, &fragment, width, state);
exit:
@ -929,4 +1033,4 @@ exit:
return return_value;
}
/*[clinic end generated code: output=e2076026235d7f0f input=a9049054013a1b77]*/
/*[clinic end generated code: output=ee7c63ec28a11b78 input=a9049054013a1b77]*/

View file

@ -104,7 +104,7 @@ PyDoc_STRVAR(binascii_b2a_base64__doc__,
"Base64-code line of data.");
#define BINASCII_B2A_BASE64_METHODDEF \
{"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_base64__doc__},
{"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_FASTCALL, binascii_b2a_base64__doc__},
static PyObject *
binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline);
@ -273,7 +273,7 @@ static unsigned int
binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc);
static PyObject *
binascii_crc_hqx(PyObject *module, PyObject **args, Py_ssize_t nargs)
binascii_crc_hqx(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -284,6 +284,10 @@ binascii_crc_hqx(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &crc)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("crc_hqx", kwnames)) {
goto exit;
}
_return_value = binascii_crc_hqx_impl(module, &data, crc);
if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
@ -312,7 +316,7 @@ static unsigned int
binascii_crc32_impl(PyObject *module, Py_buffer *data, unsigned int crc);
static PyObject *
binascii_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs)
binascii_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -323,6 +327,10 @@ binascii_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &crc)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("crc32", kwnames)) {
goto exit;
}
_return_value = binascii_crc32_impl(module, &data, crc);
if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
@ -481,7 +489,7 @@ PyDoc_STRVAR(binascii_a2b_qp__doc__,
"Decode a string of qp-encoded data.");
#define BINASCII_A2B_QP_METHODDEF \
{"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_FASTCALL|METH_KEYWORDS, binascii_a2b_qp__doc__},
{"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_FASTCALL, binascii_a2b_qp__doc__},
static PyObject *
binascii_a2b_qp_impl(PyObject *module, Py_buffer *data, int header);
@ -520,7 +528,7 @@ PyDoc_STRVAR(binascii_b2a_qp__doc__,
"are both encoded. When quotetabs is set, space and tabs are encoded.");
#define BINASCII_B2A_QP_METHODDEF \
{"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_qp__doc__},
{"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_FASTCALL, binascii_b2a_qp__doc__},
static PyObject *
binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
@ -551,4 +559,4 @@ exit:
return return_value;
}
/*[clinic end generated code: output=e7dfb211de8cc097 input=a9049054013a1b77]*/
/*[clinic end generated code: output=4a418f883ccc79fe input=a9049054013a1b77]*/

View file

@ -648,7 +648,7 @@ static PyObject *
cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj);
static PyObject *
cmath_log(PyObject *module, PyObject **args, Py_ssize_t nargs)
cmath_log(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_complex x;
@ -658,6 +658,10 @@ cmath_log(PyObject *module, PyObject **args, Py_ssize_t nargs)
&x, &y_obj)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("log", kwnames)) {
goto exit;
}
return_value = cmath_log_impl(module, x, y_obj);
exit:
@ -733,7 +737,7 @@ static PyObject *
cmath_rect_impl(PyObject *module, double r, double phi);
static PyObject *
cmath_rect(PyObject *module, PyObject **args, Py_ssize_t nargs)
cmath_rect(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
double r;
@ -743,6 +747,10 @@ cmath_rect(PyObject *module, PyObject **args, Py_ssize_t nargs)
&r, &phi)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("rect", kwnames)) {
goto exit;
}
return_value = cmath_rect_impl(module, r, phi);
exit:
@ -852,7 +860,7 @@ PyDoc_STRVAR(cmath_isclose__doc__,
"not close to anything, even itself. inf and -inf are only close to themselves.");
#define CMATH_ISCLOSE_METHODDEF \
{"isclose", (PyCFunction)cmath_isclose, METH_FASTCALL|METH_KEYWORDS, cmath_isclose__doc__},
{"isclose", (PyCFunction)cmath_isclose, METH_FASTCALL, cmath_isclose__doc__},
static int
cmath_isclose_impl(PyObject *module, Py_complex a, Py_complex b,
@ -883,4 +891,4 @@ cmath_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn
exit:
return return_value;
}
/*[clinic end generated code: output=51ba28d27d10264e input=a9049054013a1b77]*/
/*[clinic end generated code: output=93eff5d4c242ee57 input=a9049054013a1b77]*/

View file

@ -26,7 +26,7 @@ static PyObject *
fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg);
static PyObject *
fcntl_fcntl(PyObject *module, PyObject **args, Py_ssize_t nargs)
fcntl_fcntl(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int fd;
@ -37,6 +37,10 @@ fcntl_fcntl(PyObject *module, PyObject **args, Py_ssize_t nargs)
conv_descriptor, &fd, &code, &arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("fcntl", kwnames)) {
goto exit;
}
return_value = fcntl_fcntl_impl(module, fd, code, arg);
exit:
@ -84,7 +88,7 @@ fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
PyObject *ob_arg, int mutate_arg);
static PyObject *
fcntl_ioctl(PyObject *module, PyObject **args, Py_ssize_t nargs)
fcntl_ioctl(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int fd;
@ -96,6 +100,10 @@ fcntl_ioctl(PyObject *module, PyObject **args, Py_ssize_t nargs)
conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("ioctl", kwnames)) {
goto exit;
}
return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg);
exit:
@ -118,7 +126,7 @@ static PyObject *
fcntl_flock_impl(PyObject *module, int fd, int code);
static PyObject *
fcntl_flock(PyObject *module, PyObject **args, Py_ssize_t nargs)
fcntl_flock(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int fd;
@ -128,6 +136,10 @@ fcntl_flock(PyObject *module, PyObject **args, Py_ssize_t nargs)
conv_descriptor, &fd, &code)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("flock", kwnames)) {
goto exit;
}
return_value = fcntl_flock_impl(module, fd, code);
exit:
@ -169,7 +181,7 @@ fcntl_lockf_impl(PyObject *module, int fd, int code, PyObject *lenobj,
PyObject *startobj, int whence);
static PyObject *
fcntl_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs)
fcntl_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int fd;
@ -182,9 +194,13 @@ fcntl_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs)
conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("lockf", kwnames)) {
goto exit;
}
return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence);
exit:
return return_value;
}
/*[clinic end generated code: output=6105e3ada306f434 input=a9049054013a1b77]*/
/*[clinic end generated code: output=b67e9579722e6d4f input=a9049054013a1b77]*/

View file

@ -12,7 +12,7 @@ PyDoc_STRVAR(grp_getgrgid__doc__,
"If id is not valid, raise KeyError.");
#define GRP_GETGRGID_METHODDEF \
{"getgrgid", (PyCFunction)grp_getgrgid, METH_FASTCALL|METH_KEYWORDS, grp_getgrgid__doc__},
{"getgrgid", (PyCFunction)grp_getgrgid, METH_FASTCALL, grp_getgrgid__doc__},
static PyObject *
grp_getgrgid_impl(PyObject *module, PyObject *id);
@ -44,7 +44,7 @@ PyDoc_STRVAR(grp_getgrnam__doc__,
"If name is not valid, raise KeyError.");
#define GRP_GETGRNAM_METHODDEF \
{"getgrnam", (PyCFunction)grp_getgrnam, METH_FASTCALL|METH_KEYWORDS, grp_getgrnam__doc__},
{"getgrnam", (PyCFunction)grp_getgrnam, METH_FASTCALL, grp_getgrnam__doc__},
static PyObject *
grp_getgrnam_impl(PyObject *module, PyObject *name);
@ -87,4 +87,4 @@ grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return grp_getgrall_impl(module);
}
/*[clinic end generated code: output=e7ef2cbc437eedcb input=a9049054013a1b77]*/
/*[clinic end generated code: output=fb690db5e676d378 input=a9049054013a1b77]*/

File diff suppressed because it is too large Load diff

View file

@ -19,7 +19,7 @@ pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data,
int isfinal);
static PyObject *
pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject **args, Py_ssize_t nargs)
pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *data;
@ -29,6 +29,10 @@ pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject **args, Py_ssize_t nargs)
&data, &isfinal)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("Parse", kwnames)) {
goto exit;
}
return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal);
exit:
@ -125,7 +129,7 @@ pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
const char *encoding);
static PyObject *
pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject **args, Py_ssize_t nargs)
pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
const char *context;
@ -135,6 +139,10 @@ pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject **ar
&context, &encoding)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("ExternalEntityParserCreate", kwnames)) {
goto exit;
}
return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
exit:
@ -192,7 +200,7 @@ static PyObject *
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
static PyObject *
pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject **args, Py_ssize_t nargs)
pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int flag = 1;
@ -201,6 +209,10 @@ pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject **args, Py_ssize_
&flag)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("UseForeignDTD", kwnames)) {
goto exit;
}
return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
exit:
@ -234,7 +246,7 @@ PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
"Return a new XML parser object.");
#define PYEXPAT_PARSERCREATE_METHODDEF \
{"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_FASTCALL|METH_KEYWORDS, pyexpat_ParserCreate__doc__},
{"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_FASTCALL, pyexpat_ParserCreate__doc__},
static PyObject *
pyexpat_ParserCreate_impl(PyObject *module, const char *encoding,
@ -290,4 +302,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
/*[clinic end generated code: output=5d2e355f2b48e6c3 input=a9049054013a1b77]*/
/*[clinic end generated code: output=0548a6b12157e29b input=a9049054013a1b77]*/

View file

@ -81,7 +81,7 @@ static PyObject *
signal_signal_impl(PyObject *module, int signalnum, PyObject *handler);
static PyObject *
signal_signal(PyObject *module, PyObject **args, Py_ssize_t nargs)
signal_signal(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int signalnum;
@ -91,6 +91,10 @@ signal_signal(PyObject *module, PyObject **args, Py_ssize_t nargs)
&signalnum, &handler)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("signal", kwnames)) {
goto exit;
}
return_value = signal_signal_impl(module, signalnum, handler);
exit:
@ -148,7 +152,7 @@ static PyObject *
signal_siginterrupt_impl(PyObject *module, int signalnum, int flag);
static PyObject *
signal_siginterrupt(PyObject *module, PyObject **args, Py_ssize_t nargs)
signal_siginterrupt(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int signalnum;
@ -158,6 +162,10 @@ signal_siginterrupt(PyObject *module, PyObject **args, Py_ssize_t nargs)
&signalnum, &flag)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("siginterrupt", kwnames)) {
goto exit;
}
return_value = signal_siginterrupt_impl(module, signalnum, flag);
exit:
@ -187,7 +195,7 @@ signal_setitimer_impl(PyObject *module, int which, double seconds,
double interval);
static PyObject *
signal_setitimer(PyObject *module, PyObject **args, Py_ssize_t nargs)
signal_setitimer(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int which;
@ -198,6 +206,10 @@ signal_setitimer(PyObject *module, PyObject **args, Py_ssize_t nargs)
&which, &seconds, &interval)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("setitimer", kwnames)) {
goto exit;
}
return_value = signal_setitimer_impl(module, which, seconds, interval);
exit:
@ -252,7 +264,7 @@ static PyObject *
signal_pthread_sigmask_impl(PyObject *module, int how, PyObject *mask);
static PyObject *
signal_pthread_sigmask(PyObject *module, PyObject **args, Py_ssize_t nargs)
signal_pthread_sigmask(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int how;
@ -262,6 +274,10 @@ signal_pthread_sigmask(PyObject *module, PyObject **args, Py_ssize_t nargs)
&how, &mask)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("pthread_sigmask", kwnames)) {
goto exit;
}
return_value = signal_pthread_sigmask_impl(module, how, mask);
exit:
@ -345,7 +361,7 @@ signal_sigtimedwait_impl(PyObject *module, PyObject *sigset,
PyObject *timeout_obj);
static PyObject *
signal_sigtimedwait(PyObject *module, PyObject **args, Py_ssize_t nargs)
signal_sigtimedwait(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *sigset;
@ -356,6 +372,10 @@ signal_sigtimedwait(PyObject *module, PyObject **args, Py_ssize_t nargs)
&sigset, &timeout_obj)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("sigtimedwait", kwnames)) {
goto exit;
}
return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj);
exit:
@ -379,7 +399,7 @@ static PyObject *
signal_pthread_kill_impl(PyObject *module, long thread_id, int signalnum);
static PyObject *
signal_pthread_kill(PyObject *module, PyObject **args, Py_ssize_t nargs)
signal_pthread_kill(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
long thread_id;
@ -389,6 +409,10 @@ signal_pthread_kill(PyObject *module, PyObject **args, Py_ssize_t nargs)
&thread_id, &signalnum)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("pthread_kill", kwnames)) {
goto exit;
}
return_value = signal_pthread_kill_impl(module, thread_id, signalnum);
exit:
@ -440,4 +464,4 @@ exit:
#ifndef SIGNAL_PTHREAD_KILL_METHODDEF
#define SIGNAL_PTHREAD_KILL_METHODDEF
#endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
/*[clinic end generated code: output=99ed1ec3156528ba input=a9049054013a1b77]*/
/*[clinic end generated code: output=fab3dba32c058588 input=a9049054013a1b77]*/

View file

@ -21,7 +21,7 @@ unicodedata_UCD_decimal_impl(PyObject *self, int chr,
PyObject *default_value);
static PyObject *
unicodedata_UCD_decimal(PyObject *self, PyObject **args, Py_ssize_t nargs)
unicodedata_UCD_decimal(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int chr;
@ -31,6 +31,10 @@ unicodedata_UCD_decimal(PyObject *self, PyObject **args, Py_ssize_t nargs)
&chr, &default_value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("decimal", kwnames)) {
goto exit;
}
return_value = unicodedata_UCD_decimal_impl(self, chr, default_value);
exit:
@ -54,7 +58,7 @@ static PyObject *
unicodedata_UCD_digit_impl(PyObject *self, int chr, PyObject *default_value);
static PyObject *
unicodedata_UCD_digit(PyObject *self, PyObject **args, Py_ssize_t nargs)
unicodedata_UCD_digit(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int chr;
@ -64,6 +68,10 @@ unicodedata_UCD_digit(PyObject *self, PyObject **args, Py_ssize_t nargs)
&chr, &default_value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("digit", kwnames)) {
goto exit;
}
return_value = unicodedata_UCD_digit_impl(self, chr, default_value);
exit:
@ -88,7 +96,7 @@ unicodedata_UCD_numeric_impl(PyObject *self, int chr,
PyObject *default_value);
static PyObject *
unicodedata_UCD_numeric(PyObject *self, PyObject **args, Py_ssize_t nargs)
unicodedata_UCD_numeric(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int chr;
@ -98,6 +106,10 @@ unicodedata_UCD_numeric(PyObject *self, PyObject **args, Py_ssize_t nargs)
&chr, &default_value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("numeric", kwnames)) {
goto exit;
}
return_value = unicodedata_UCD_numeric_impl(self, chr, default_value);
exit:
@ -301,7 +313,7 @@ unicodedata_UCD_normalize_impl(PyObject *self, const char *form,
PyObject *input);
static PyObject *
unicodedata_UCD_normalize(PyObject *self, PyObject **args, Py_ssize_t nargs)
unicodedata_UCD_normalize(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
const char *form;
@ -311,6 +323,10 @@ unicodedata_UCD_normalize(PyObject *self, PyObject **args, Py_ssize_t nargs)
&form, &PyUnicode_Type, &input)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("normalize", kwnames)) {
goto exit;
}
return_value = unicodedata_UCD_normalize_impl(self, form, input);
exit:
@ -333,7 +349,7 @@ static PyObject *
unicodedata_UCD_name_impl(PyObject *self, int chr, PyObject *default_value);
static PyObject *
unicodedata_UCD_name(PyObject *self, PyObject **args, Py_ssize_t nargs)
unicodedata_UCD_name(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int chr;
@ -343,6 +359,10 @@ unicodedata_UCD_name(PyObject *self, PyObject **args, Py_ssize_t nargs)
&chr, &default_value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("name", kwnames)) {
goto exit;
}
return_value = unicodedata_UCD_name_impl(self, chr, default_value);
exit:
@ -380,4 +400,4 @@ unicodedata_UCD_lookup(PyObject *self, PyObject *arg)
exit:
return return_value;
}
/*[clinic end generated code: output=6778b61d41557af3 input=a9049054013a1b77]*/
/*[clinic end generated code: output=badeb811d1caec40 input=a9049054013a1b77]*/

View file

@ -15,7 +15,7 @@ PyDoc_STRVAR(zlib_compress__doc__,
" Compression level, in 0-9 or -1.");
#define ZLIB_COMPRESS_METHODDEF \
{"compress", (PyCFunction)zlib_compress, METH_FASTCALL|METH_KEYWORDS, zlib_compress__doc__},
{"compress", (PyCFunction)zlib_compress, METH_FASTCALL, zlib_compress__doc__},
static PyObject *
zlib_compress_impl(PyObject *module, Py_buffer *data, int level);
@ -58,7 +58,7 @@ PyDoc_STRVAR(zlib_decompress__doc__,
" The initial output buffer size.");
#define ZLIB_DECOMPRESS_METHODDEF \
{"decompress", (PyCFunction)zlib_decompress, METH_FASTCALL|METH_KEYWORDS, zlib_decompress__doc__},
{"decompress", (PyCFunction)zlib_decompress, METH_FASTCALL, zlib_decompress__doc__},
static PyObject *
zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits,
@ -121,7 +121,7 @@ PyDoc_STRVAR(zlib_compressobj__doc__,
" containing subsequences that are likely to occur in the input data.");
#define ZLIB_COMPRESSOBJ_METHODDEF \
{"compressobj", (PyCFunction)zlib_compressobj, METH_FASTCALL|METH_KEYWORDS, zlib_compressobj__doc__},
{"compressobj", (PyCFunction)zlib_compressobj, METH_FASTCALL, zlib_compressobj__doc__},
static PyObject *
zlib_compressobj_impl(PyObject *module, int level, int method, int wbits,
@ -168,7 +168,7 @@ PyDoc_STRVAR(zlib_decompressobj__doc__,
" dictionary as used by the compressor that produced the input data.");
#define ZLIB_DECOMPRESSOBJ_METHODDEF \
{"decompressobj", (PyCFunction)zlib_decompressobj, METH_FASTCALL|METH_KEYWORDS, zlib_decompressobj__doc__},
{"decompressobj", (PyCFunction)zlib_decompressobj, METH_FASTCALL, zlib_decompressobj__doc__},
static PyObject *
zlib_decompressobj_impl(PyObject *module, int wbits, PyObject *zdict);
@ -249,7 +249,7 @@ PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
"Call the flush() method to clear these buffers.");
#define ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF \
{"decompress", (PyCFunction)zlib_Decompress_decompress, METH_FASTCALL|METH_KEYWORDS, zlib_Decompress_decompress__doc__},
{"decompress", (PyCFunction)zlib_Decompress_decompress, METH_FASTCALL, zlib_Decompress_decompress__doc__},
static PyObject *
zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data,
@ -298,7 +298,7 @@ static PyObject *
zlib_Compress_flush_impl(compobject *self, int mode);
static PyObject *
zlib_Compress_flush(compobject *self, PyObject **args, Py_ssize_t nargs)
zlib_Compress_flush(compobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int mode = Z_FINISH;
@ -307,6 +307,10 @@ zlib_Compress_flush(compobject *self, PyObject **args, Py_ssize_t nargs)
&mode)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("flush", kwnames)) {
goto exit;
}
return_value = zlib_Compress_flush_impl(self, mode);
exit:
@ -373,7 +377,7 @@ static PyObject *
zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length);
static PyObject *
zlib_Decompress_flush(compobject *self, PyObject **args, Py_ssize_t nargs)
zlib_Decompress_flush(compobject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t length = DEF_BUF_SIZE;
@ -382,6 +386,10 @@ zlib_Decompress_flush(compobject *self, PyObject **args, Py_ssize_t nargs)
ssize_t_converter, &length)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("flush", kwnames)) {
goto exit;
}
return_value = zlib_Decompress_flush_impl(self, length);
exit:
@ -406,7 +414,7 @@ static PyObject *
zlib_adler32_impl(PyObject *module, Py_buffer *data, unsigned int value);
static PyObject *
zlib_adler32(PyObject *module, PyObject **args, Py_ssize_t nargs)
zlib_adler32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -416,6 +424,10 @@ zlib_adler32(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("adler32", kwnames)) {
goto exit;
}
return_value = zlib_adler32_impl(module, &data, value);
exit:
@ -445,7 +457,7 @@ static PyObject *
zlib_crc32_impl(PyObject *module, Py_buffer *data, unsigned int value);
static PyObject *
zlib_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs)
zlib_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
@ -455,6 +467,10 @@ zlib_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs)
&data, &value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("crc32", kwnames)) {
goto exit;
}
return_value = zlib_crc32_impl(module, &data, value);
exit:
@ -469,4 +485,4 @@ exit:
#ifndef ZLIB_COMPRESS_COPY_METHODDEF
#define ZLIB_COMPRESS_COPY_METHODDEF
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
/*[clinic end generated code: output=9fb104ee528088ee input=a9049054013a1b77]*/
/*[clinic end generated code: output=c6cb10ed66f226b2 input=a9049054013a1b77]*/

View file

@ -2190,6 +2190,727 @@ PyMapping_Values(PyObject *o)
return fast;
}
/* Operations on callable objects */
/* XXX PyCallable_Check() is in object.c */
PyObject *
PyObject_CallObject(PyObject *callable, PyObject *args)
{
return PyEval_CallObjectWithKeywords(callable, args, NULL);
}
PyObject*
(_Py_CheckFunctionResult)(PyObject *callable, PyObject *result, const char *where)
{
int err_occurred = (PyErr_Occurred() != NULL);
assert((callable != NULL) ^ (where != NULL));
if (result == NULL) {
if (!err_occurred) {
if (callable)
PyErr_Format(PyExc_SystemError,
"%R returned NULL without setting an error",
callable);
else
PyErr_Format(PyExc_SystemError,
"%s returned NULL without setting an error",
where);
#ifdef Py_DEBUG
/* Ensure that the bug is caught in debug mode */
Py_FatalError("a function returned NULL without setting an error");
#endif
return NULL;
}
}
else {
if (err_occurred) {
Py_DECREF(result);
if (callable) {
_PyErr_FormatFromCause(PyExc_SystemError,
"%R returned a result with an error set",
callable);
}
else {
_PyErr_FormatFromCause(PyExc_SystemError,
"%s returned a result with an error set",
where);
}
#ifdef Py_DEBUG
/* Ensure that the bug is caught in debug mode */
Py_FatalError("a function returned a result with an error set");
#endif
return NULL;
}
}
return result;
}
PyObject *
PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
{
ternaryfunc call;
PyObject *result;
/* PyObject_Call() 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(PyTuple_Check(args));
assert(kwargs == NULL || PyDict_Check(kwargs));
if (PyFunction_Check(callable)) {
return _PyFunction_FastCallDict(callable,
&PyTuple_GET_ITEM(args, 0),
PyTuple_GET_SIZE(args),
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"))
return NULL;
result = (*call)(callable, args, kwargs);
Py_LeaveRecursiveCall();
return _Py_CheckFunctionResult(callable, result, NULL);
}
}
/* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their
stack consumption, Disable inlining to optimize the stack consumption. */
PyObject* dontinline
_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs)
{
PyObject *args;
Py_ssize_t i;
args = PyTuple_New(nargs);
if (args == NULL) {
return NULL;
}
for (i=0; i < nargs; i++) {
PyObject *item = stack[i];
Py_INCREF(item);
PyTuple_SET_ITEM(args, i, item);
}
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_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
PyObject *kwargs)
{
/* _PyObject_FastCallDict() 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(callable != NULL);
assert(nargs >= 0);
assert(nargs == 0 || args != NULL);
assert(kwargs == NULL || PyDict_Check(kwargs));
if (PyFunction_Check(callable)) {
return _PyFunction_FastCallDict(callable, args, nargs, kwargs);
}
else if (PyCFunction_Check(callable)) {
return _PyCFunction_FastCallDict(callable, args, nargs, kwargs);
}
else {
PyObject *argstuple, *result;
ternaryfunc call;
/* Slow-path: build a temporary tuple */
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;
}
argstuple = _PyStack_AsTuple(args, nargs);
if (argstuple == NULL) {
return NULL;
}
if (Py_EnterRecursiveCall(" while calling a Python object")) {
return NULL;
}
result = (*call)(callable, argstuple, kwargs);
Py_LeaveRecursiveCall();
Py_DECREF(argstuple);
result = _Py_CheckFunctionResult(callable, result, NULL);
return result;
}
}
/* Positional arguments are obj followed by args:
call callable(obj, *args, **kwargs) */
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;
if (nargs > 1) {
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 *obj, PyObject *args, PyObject *kwargs)
{
PyObject *small_stack[_PY_FASTCALL_SMALL_STACK];
PyObject **stack;
Py_ssize_t argcount;
PyObject *result;
assert(PyTuple_Check(args));
argcount = PyTuple_GET_SIZE(args);
if (argcount + 1 <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) {
stack = small_stack;
}
else {
stack = PyMem_Malloc((argcount + 1) * sizeof(PyObject *));
if (stack == NULL) {
PyErr_NoMemory();
return NULL;
}
}
/* use borrowed references */
stack[0] = obj;
memcpy(&stack[1],
&PyTuple_GET_ITEM(args, 0),
argcount * sizeof(PyObject *));
result = _PyObject_FastCallDict(callable,
stack, argcount + 1,
kwargs);
if (stack != small_stack) {
PyMem_Free(stack);
}
return result;
}
PyObject *
_PyStack_AsDict(PyObject **values, PyObject *kwnames)
{
Py_ssize_t nkwargs;
PyObject *kwdict;
Py_ssize_t i;
assert(kwnames != NULL);
nkwargs = PyTuple_GET_SIZE(kwnames);
kwdict = _PyDict_NewPresized(nkwargs);
if (kwdict == NULL) {
return NULL;
}
for (i = 0; i < nkwargs; i++) {
PyObject *key = PyTuple_GET_ITEM(kwnames, i);
PyObject *value = *values++;
if (PyDict_SetItem(kwdict, key, value)) {
Py_DECREF(kwdict);
return NULL;
}
}
return kwdict;
}
int
_PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs,
PyObject ***p_stack, PyObject **p_kwnames)
{
PyObject **stack, **kwstack;
Py_ssize_t nkwargs;
Py_ssize_t pos, i;
PyObject *key, *value;
PyObject *kwnames;
assert(nargs >= 0);
assert(kwargs == NULL || PyDict_CheckExact(kwargs));
if (kwargs == NULL || (nkwargs = PyDict_GET_SIZE(kwargs)) == 0) {
*p_stack = args;
*p_kwnames = NULL;
return 0;
}
if ((size_t)nargs > PY_SSIZE_T_MAX / sizeof(stack[0]) - (size_t)nkwargs) {
PyErr_NoMemory();
return -1;
}
stack = PyMem_Malloc((nargs + nkwargs) * sizeof(stack[0]));
if (stack == NULL) {
PyErr_NoMemory();
return -1;
}
kwnames = PyTuple_New(nkwargs);
if (kwnames == NULL) {
PyMem_Free(stack);
return -1;
}
/* Copy position arguments (borrowed references) */
memcpy(stack, args, nargs * sizeof(stack[0]));
kwstack = stack + nargs;
pos = i = 0;
/* This loop doesn't support lookup function mutating the dictionary
to change its size. It's a deliberate choice for speed, this function is
called in the performance critical hot code. */
while (PyDict_Next(kwargs, &pos, &key, &value)) {
Py_INCREF(key);
PyTuple_SET_ITEM(kwnames, i, key);
/* The stack contains borrowed references */
kwstack[i] = value;
i++;
}
*p_stack = stack;
*p_kwnames = kwnames;
return 0;
}
PyObject *
_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs,
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(kwnames == NULL || PyTuple_CheckExact(kwnames));
/* kwnames must only contains str strings, no subclass, and all keys must
be unique: these checks are implemented in Python/ceval.c and
_PyArg_ParseStackAndKeywords(). */
if (PyFunction_Check(callable)) {
return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames);
}
if (PyCFunction_Check(callable)) {
return _PyCFunction_FastCallKeywords(callable, stack, nargs, kwnames);
}
else {
/* Slow-path: build a temporary tuple for positional arguments and a
temporary dictionary for keyword arguments (if any) */
ternaryfunc call;
PyObject *argstuple;
PyObject *kwdict, *result;
Py_ssize_t nkwargs;
nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
assert((nargs == 0 && nkwargs == 0) || stack != NULL);
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;
}
argstuple = _PyStack_AsTuple(stack, nargs);
if (argstuple == NULL) {
return NULL;
}
if (nkwargs > 0) {
kwdict = _PyStack_AsDict(stack + nargs, kwnames);
if (kwdict == NULL) {
Py_DECREF(argstuple);
return NULL;
}
}
else {
kwdict = NULL;
}
if (Py_EnterRecursiveCall(" while calling a Python object")) {
return NULL;
}
result = (*call)(callable, argstuple, kwdict);
Py_LeaveRecursiveCall();
Py_DECREF(argstuple);
Py_XDECREF(kwdict);
result = _Py_CheckFunctionResult(callable, result, NULL);
return result;
}
}
static PyObject *
_PyObject_CallFunctionVa(PyObject *callable, const char *format,
va_list va, int is_size_t)
{
PyObject* small_stack[5];
const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack);
PyObject **stack;
Py_ssize_t nargs, i;
PyObject *result;
if (callable == NULL) {
return null_error();
}
if (!format || !*format) {
return _PyObject_CallNoArg(callable);
}
if (is_size_t) {
stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, format, va, &nargs);
}
else {
stack = _Py_VaBuildStack(small_stack, small_stack_len, format, va, &nargs);
}
if (stack == NULL) {
return NULL;
}
if (nargs == 1 && PyTuple_Check(stack[0])) {
/* Special cases for backward compatibility:
- PyObject_CallFunction(func, "O", tuple) calls func(*tuple)
- PyObject_CallFunction(func, "(OOO)", arg1, arg2, arg3) calls
func(*(arg1, arg2, arg3)): func(arg1, arg2, arg3) */
PyObject *args = stack[0];
result = _PyObject_FastCall(callable,
&PyTuple_GET_ITEM(args, 0),
PyTuple_GET_SIZE(args));
}
else {
result = _PyObject_FastCall(callable, stack, nargs);
}
for (i = 0; i < nargs; ++i) {
Py_DECREF(stack[i]);
}
if (stack != small_stack) {
PyMem_Free(stack);
}
return result;
}
PyObject *
PyObject_CallFunction(PyObject *callable, const char *format, ...)
{
va_list va;
PyObject *result;
va_start(va, format);
result = _PyObject_CallFunctionVa(callable, format, va, 0);
va_end(va);
return result;
}
PyObject *
_PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...)
{
va_list va;
PyObject *result;
va_start(va, format);
result = _PyObject_CallFunctionVa(callable, format, va, 1);
va_end(va);
return result;
}
static PyObject*
callmethod(PyObject* callable, const char *format, va_list va, int is_size_t)
{
assert(callable != NULL);
if (!PyCallable_Check(callable)) {
type_error("attribute of type '%.200s' is not callable", callable);
return NULL;
}
return _PyObject_CallFunctionVa(callable, format, va, is_size_t);
}
PyObject *
PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)
{
va_list va;
PyObject *callable, *retval;
if (obj == NULL || name == NULL) {
return null_error();
}
callable = PyObject_GetAttrString(obj, name);
if (callable == NULL)
return NULL;
va_start(va, format);
retval = callmethod(callable, format, va, 0);
va_end(va);
Py_DECREF(callable);
return retval;
}
PyObject *
_PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name,
const char *format, ...)
{
va_list va;
PyObject *callable, *retval;
if (obj == NULL || name == NULL) {
return null_error();
}
callable = _PyObject_GetAttrId(obj, name);
if (callable == NULL)
return NULL;
va_start(va, format);
retval = callmethod(callable, format, va, 0);
va_end(va);
Py_DECREF(callable);
return retval;
}
PyObject *
_PyObject_CallMethod_SizeT(PyObject *obj, const char *name,
const char *format, ...)
{
va_list va;
PyObject *callable, *retval;
if (obj == NULL || name == NULL) {
return null_error();
}
callable = PyObject_GetAttrString(obj, name);
if (callable == NULL)
return NULL;
va_start(va, format);
retval = callmethod(callable, format, va, 1);
va_end(va);
Py_DECREF(callable);
return retval;
}
PyObject *
_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name,
const char *format, ...)
{
va_list va;
PyObject *callable, *retval;
if (obj == NULL || name == NULL) {
return null_error();
}
callable = _PyObject_GetAttrId(obj, name);
if (callable == NULL) {
return NULL;
}
va_start(va, format);
retval = callmethod(callable, format, va, 1);
va_end(va);
Py_DECREF(callable);
return retval;
}
static PyObject *
object_vacall(PyObject *callable, va_list vargs)
{
PyObject *small_stack[5];
PyObject **stack;
Py_ssize_t nargs;
PyObject *result;
Py_ssize_t i;
va_list countva;
if (callable == NULL) {
return null_error();
}
/* Count the number of arguments */
va_copy(countva, vargs);
nargs = 0;
while (1) {
PyObject *arg = va_arg(countva, PyObject *);
if (arg == NULL) {
break;
}
nargs++;
}
va_end(countva);
/* Copy arguments */
if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) {
stack = small_stack;
}
else {
stack = PyMem_Malloc(nargs * sizeof(stack[0]));
if (stack == NULL) {
PyErr_NoMemory();
return NULL;
}
}
for (i = 0; i < nargs; ++i) {
stack[i] = va_arg(vargs, PyObject *);
}
/* Call the function */
result = _PyObject_FastCall(callable, stack, nargs);
if (stack != small_stack) {
PyMem_Free(stack);
}
return result;
}
PyObject *
PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...)
{
va_list vargs;
PyObject *result;
if (callable == NULL || name == NULL) {
return null_error();
}
callable = PyObject_GetAttr(callable, name);
if (callable == NULL) {
return NULL;
}
va_start(vargs, name);
result = object_vacall(callable, vargs);
va_end(vargs);
Py_DECREF(callable);
return result;
}
PyObject *
_PyObject_CallMethodIdObjArgs(PyObject *obj,
struct _Py_Identifier *name, ...)
{
va_list vargs;
PyObject *callable, *result;
if (obj == NULL || name == NULL) {
return null_error();
}
callable = _PyObject_GetAttrId(obj, name);
if (callable == NULL) {
return NULL;
}
va_start(vargs, name);
result = object_vacall(callable, vargs);
va_end(vargs);
Py_DECREF(callable);
return result;
}
PyObject *
PyObject_CallFunctionObjArgs(PyObject *callable, ...)
{
va_list vargs;
PyObject *result;
va_start(vargs, callable);
result = object_vacall(callable, vargs);
va_end(vargs);
return result;
}
/* isinstance(), issubclass() */
/* abstract_get_bases() has logically 4 return states:

File diff suppressed because it is too large Load diff

View file

@ -52,7 +52,7 @@ PyDoc_STRVAR(bytearray_translate__doc__,
"The remaining characters are mapped through the given translation table.");
#define BYTEARRAY_TRANSLATE_METHODDEF \
{"translate", (PyCFunction)bytearray_translate, METH_FASTCALL|METH_KEYWORDS, bytearray_translate__doc__},
{"translate", (PyCFunction)bytearray_translate, METH_FASTCALL, bytearray_translate__doc__},
static PyObject *
bytearray_translate_impl(PyByteArrayObject *self, PyObject *table,
@ -95,7 +95,7 @@ static PyObject *
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to);
static PyObject *
bytearray_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
bytearray_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer frm = {NULL, NULL};
@ -105,6 +105,10 @@ bytearray_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
&frm, &to)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
goto exit;
}
return_value = bytearray_maketrans_impl(&frm, &to);
exit:
@ -141,7 +145,7 @@ bytearray_replace_impl(PyByteArrayObject *self, Py_buffer *old,
Py_buffer *new, Py_ssize_t count);
static PyObject *
bytearray_replace(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
bytearray_replace(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer old = {NULL, NULL};
@ -152,6 +156,10 @@ bytearray_replace(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
&old, &new, &count)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("replace", kwnames)) {
goto exit;
}
return_value = bytearray_replace_impl(self, &old, &new, count);
exit:
@ -182,7 +190,7 @@ PyDoc_STRVAR(bytearray_split__doc__,
" -1 (the default value) means no limit.");
#define BYTEARRAY_SPLIT_METHODDEF \
{"split", (PyCFunction)bytearray_split, METH_FASTCALL|METH_KEYWORDS, bytearray_split__doc__},
{"split", (PyCFunction)bytearray_split, METH_FASTCALL, bytearray_split__doc__},
static PyObject *
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep,
@ -257,7 +265,7 @@ PyDoc_STRVAR(bytearray_rsplit__doc__,
"Splitting is done starting at the end of the bytearray and working to the front.");
#define BYTEARRAY_RSPLIT_METHODDEF \
{"rsplit", (PyCFunction)bytearray_rsplit, METH_FASTCALL|METH_KEYWORDS, bytearray_rsplit__doc__},
{"rsplit", (PyCFunction)bytearray_rsplit, METH_FASTCALL, bytearray_rsplit__doc__},
static PyObject *
bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep,
@ -318,7 +326,7 @@ static PyObject *
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item);
static PyObject *
bytearray_insert(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
bytearray_insert(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t index;
@ -328,6 +336,10 @@ bytearray_insert(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
&index, _getbytevalue, &item)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("insert", kwnames)) {
goto exit;
}
return_value = bytearray_insert_impl(self, index, item);
exit:
@ -395,7 +407,7 @@ static PyObject *
bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index);
static PyObject *
bytearray_pop(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
bytearray_pop(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_ssize_t index = -1;
@ -404,6 +416,10 @@ bytearray_pop(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
&index)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("pop", kwnames)) {
goto exit;
}
return_value = bytearray_pop_impl(self, index);
exit:
@ -455,7 +471,7 @@ static PyObject *
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
@ -465,6 +481,10 @@ bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
&bytes)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("strip", kwnames)) {
goto exit;
}
return_value = bytearray_strip_impl(self, bytes);
exit:
@ -486,7 +506,7 @@ static PyObject *
bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
@ -496,6 +516,10 @@ bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
&bytes)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
goto exit;
}
return_value = bytearray_lstrip_impl(self, bytes);
exit:
@ -517,7 +541,7 @@ static PyObject *
bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
@ -527,6 +551,10 @@ bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
&bytes)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
goto exit;
}
return_value = bytearray_rstrip_impl(self, bytes);
exit:
@ -549,7 +577,7 @@ PyDoc_STRVAR(bytearray_decode__doc__,
" can handle UnicodeDecodeErrors.");
#define BYTEARRAY_DECODE_METHODDEF \
{"decode", (PyCFunction)bytearray_decode, METH_FASTCALL|METH_KEYWORDS, bytearray_decode__doc__},
{"decode", (PyCFunction)bytearray_decode, METH_FASTCALL, bytearray_decode__doc__},
static PyObject *
bytearray_decode_impl(PyByteArrayObject *self, const char *encoding,
@ -597,7 +625,7 @@ PyDoc_STRVAR(bytearray_splitlines__doc__,
"true.");
#define BYTEARRAY_SPLITLINES_METHODDEF \
{"splitlines", (PyCFunction)bytearray_splitlines, METH_FASTCALL|METH_KEYWORDS, bytearray_splitlines__doc__},
{"splitlines", (PyCFunction)bytearray_splitlines, METH_FASTCALL, bytearray_splitlines__doc__},
static PyObject *
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends);
@ -681,7 +709,7 @@ static PyObject *
bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto);
static PyObject *
bytearray_reduce_ex(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
bytearray_reduce_ex(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
int proto = 0;
@ -690,6 +718,10 @@ bytearray_reduce_ex(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs)
&proto)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("__reduce_ex__", kwnames)) {
goto exit;
}
return_value = bytearray_reduce_ex_impl(self, proto);
exit:
@ -713,4 +745,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_sizeof_impl(self);
}
/*[clinic end generated code: output=c2804d009182328c input=a9049054013a1b77]*/
/*[clinic end generated code: output=c1b1b83b0e19df74 input=a9049054013a1b77]*/

View file

@ -18,7 +18,7 @@ PyDoc_STRVAR(bytes_split__doc__,
" -1 (the default value) means no limit.");
#define BYTES_SPLIT_METHODDEF \
{"split", (PyCFunction)bytes_split, METH_FASTCALL|METH_KEYWORDS, bytes_split__doc__},
{"split", (PyCFunction)bytes_split, METH_FASTCALL, bytes_split__doc__},
static PyObject *
bytes_split_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit);
@ -137,7 +137,7 @@ PyDoc_STRVAR(bytes_rsplit__doc__,
"Splitting is done starting at the end of the bytes and working to the front.");
#define BYTES_RSPLIT_METHODDEF \
{"rsplit", (PyCFunction)bytes_rsplit, METH_FASTCALL|METH_KEYWORDS, bytes_rsplit__doc__},
{"rsplit", (PyCFunction)bytes_rsplit, METH_FASTCALL, bytes_rsplit__doc__},
static PyObject *
bytes_rsplit_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit);
@ -191,7 +191,7 @@ static PyObject *
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
@ -201,6 +201,10 @@ bytes_strip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
&bytes)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("strip", kwnames)) {
goto exit;
}
return_value = bytes_strip_impl(self, bytes);
exit:
@ -222,7 +226,7 @@ static PyObject *
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
@ -232,6 +236,10 @@ bytes_lstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
&bytes)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("lstrip", kwnames)) {
goto exit;
}
return_value = bytes_lstrip_impl(self, bytes);
exit:
@ -253,7 +261,7 @@ static PyObject *
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
@ -263,6 +271,10 @@ bytes_rstrip(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
&bytes)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("rstrip", kwnames)) {
goto exit;
}
return_value = bytes_rstrip_impl(self, bytes);
exit:
@ -282,7 +294,7 @@ PyDoc_STRVAR(bytes_translate__doc__,
"The remaining characters are mapped through the given translation table.");
#define BYTES_TRANSLATE_METHODDEF \
{"translate", (PyCFunction)bytes_translate, METH_FASTCALL|METH_KEYWORDS, bytes_translate__doc__},
{"translate", (PyCFunction)bytes_translate, METH_FASTCALL, bytes_translate__doc__},
static PyObject *
bytes_translate_impl(PyBytesObject *self, PyObject *table,
@ -325,7 +337,7 @@ static PyObject *
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to);
static PyObject *
bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer frm = {NULL, NULL};
@ -335,6 +347,10 @@ bytes_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
&frm, &to)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
goto exit;
}
return_value = bytes_maketrans_impl(&frm, &to);
exit:
@ -371,7 +387,7 @@ bytes_replace_impl(PyBytesObject *self, Py_buffer *old, Py_buffer *new,
Py_ssize_t count);
static PyObject *
bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
Py_buffer old = {NULL, NULL};
@ -382,6 +398,10 @@ bytes_replace(PyBytesObject *self, PyObject **args, Py_ssize_t nargs)
&old, &new, &count)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("replace", kwnames)) {
goto exit;
}
return_value = bytes_replace_impl(self, &old, &new, count);
exit:
@ -413,7 +433,7 @@ PyDoc_STRVAR(bytes_decode__doc__,
" can handle UnicodeDecodeErrors.");
#define BYTES_DECODE_METHODDEF \
{"decode", (PyCFunction)bytes_decode, METH_FASTCALL|METH_KEYWORDS, bytes_decode__doc__},
{"decode", (PyCFunction)bytes_decode, METH_FASTCALL, bytes_decode__doc__},
static PyObject *
bytes_decode_impl(PyBytesObject *self, const char *encoding,
@ -448,7 +468,7 @@ PyDoc_STRVAR(bytes_splitlines__doc__,
"true.");
#define BYTES_SPLITLINES_METHODDEF \
{"splitlines", (PyCFunction)bytes_splitlines, METH_FASTCALL|METH_KEYWORDS, bytes_splitlines__doc__},
{"splitlines", (PyCFunction)bytes_splitlines, METH_FASTCALL, bytes_splitlines__doc__},
static PyObject *
bytes_splitlines_impl(PyBytesObject *self, int keepends);
@ -500,4 +520,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
exit:
return return_value;
}
/*[clinic end generated code: output=fc9e02359cc56d36 input=a9049054013a1b77]*/
/*[clinic end generated code: output=debf785947e0eec2 input=a9049054013a1b77]*/

View file

@ -16,7 +16,7 @@ static PyObject *
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
static PyObject *
dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs)
dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *iterable;
@ -27,6 +27,10 @@ dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs)
&iterable, &value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("fromkeys", kwnames)) {
goto exit;
}
return_value = dict_fromkeys_impl(type, iterable, value);
exit:
@ -41,4 +45,4 @@ PyDoc_STRVAR(dict___contains____doc__,
#define DICT___CONTAINS___METHODDEF \
{"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
/*[clinic end generated code: output=d6997a57899cf28d input=a9049054013a1b77]*/
/*[clinic end generated code: output=69f3d767ed44e8ec input=a9049054013a1b77]*/

View 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]*/

View file

@ -24,7 +24,7 @@ static PyObject *
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
static PyObject *
unicode_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
unicode_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *x;
@ -35,9 +35,13 @@ unicode_maketrans(void *null, PyObject **args, Py_ssize_t nargs)
&x, &y, &z)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("maketrans", kwnames)) {
goto exit;
}
return_value = unicode_maketrans_impl(x, y, z);
exit:
return return_value;
}
/*[clinic end generated code: output=d1e48260a99031c2 input=a9049054013a1b77]*/
/*[clinic end generated code: output=af4804dbf21463b5 input=a9049054013a1b77]*/

View file

@ -264,44 +264,6 @@ methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwargs)
return result;
}
// same to methoddescr_call(), but use FASTCALL convention.
PyObject *
_PyMethodDescr_FastCallKeywords(PyObject *descrobj,
PyObject *const *args, Py_ssize_t nargs,
PyObject *kwnames)
{
assert(Py_TYPE(descrobj) == &PyMethodDescr_Type);
PyMethodDescrObject *descr = (PyMethodDescrObject *)descrobj;
PyObject *self, *result;
/* Make sure that the first argument is acceptable as 'self' */
if (nargs < 1) {
PyErr_Format(PyExc_TypeError,
"descriptor '%V' of '%.100s' "
"object needs an argument",
descr_name((PyDescrObject *)descr), "?",
PyDescr_TYPE(descr)->tp_name);
return NULL;
}
self = args[0];
if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self),
(PyObject *)PyDescr_TYPE(descr))) {
PyErr_Format(PyExc_TypeError,
"descriptor '%V' "
"requires a '%.100s' object "
"but received a '%.100s'",
descr_name((PyDescrObject *)descr), "?",
PyDescr_TYPE(descr)->tp_name,
self->ob_type->tp_name);
return NULL;
}
result = _PyMethodDef_RawFastCallKeywords(descr->d_method, self,
args+1, nargs-1, kwnames);
result = _Py_CheckFunctionResult((PyObject *)descr, result, NULL);
return result;
}
static PyObject *
classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
PyObject *kwds)

View file

@ -748,7 +748,7 @@ the <dummy> value.
For both, when the key isn't found a DKIX_EMPTY is returned. hashpos returns
where the key index should be inserted.
*/
static Py_ssize_t _Py_HOT_FUNCTION
static Py_ssize_t
lookdict(PyDictObject *mp, PyObject *key,
Py_hash_t hash, PyObject ***value_addr, Py_ssize_t *hashpos)
{
@ -862,7 +862,7 @@ top:
}
/* Specialized version for string-only keys */
static Py_ssize_t _Py_HOT_FUNCTION
static Py_ssize_t
lookdict_unicode(PyDictObject *mp, PyObject *key,
Py_hash_t hash, PyObject ***value_addr, Py_ssize_t *hashpos)
{
@ -936,7 +936,7 @@ lookdict_unicode(PyDictObject *mp, PyObject *key,
/* Faster version of lookdict_unicode when it is known that no <dummy> keys
* will be present. */
static Py_ssize_t _Py_HOT_FUNCTION
static Py_ssize_t
lookdict_unicode_nodummy(PyDictObject *restrict mp, PyObject *restrict key,
Py_hash_t hash, PyObject ***value_addr,
Py_ssize_t *hashpos)
@ -1003,7 +1003,7 @@ lookdict_unicode_nodummy(PyDictObject *restrict mp, PyObject *restrict key,
* Split tables only contain unicode keys and no dummy keys,
* so algorithm is the same as lookdict_unicode_nodummy.
*/
static Py_ssize_t _Py_HOT_FUNCTION
static Py_ssize_t
lookdict_split(PyDictObject *mp, PyObject *key,
Py_hash_t hash, PyObject ***value_addr, Py_ssize_t *hashpos)
{
@ -2911,7 +2911,7 @@ dict___contains__(PyDictObject *self, PyObject *key)
}
static PyObject *
dict_get(PyDictObject *mp, PyObject **args, Py_ssize_t nargs)
dict_get(PyDictObject *mp, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *key;
PyObject *failobj = Py_None;
@ -2923,6 +2923,9 @@ dict_get(PyDictObject *mp, PyObject **args, Py_ssize_t nargs)
if (!_PyArg_UnpackStack(args, nargs, "get", 1, 2, &key, &failobj))
return NULL;
if (!_PyArg_NoStackKeywords("get", kwnames))
return NULL;
if (!PyUnicode_CheckExact(key) ||
(hash = ((PyASCIIObject *) key)->hash) == -1) {
hash = PyObject_Hash(key);
@ -3029,7 +3032,7 @@ PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj)
}
static PyObject *
dict_setdefault(PyDictObject *mp, PyObject **args, Py_ssize_t nargs)
dict_setdefault(PyDictObject *mp, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *key, *val;
PyObject *defaultobj = Py_None;
@ -3037,6 +3040,9 @@ dict_setdefault(PyDictObject *mp, PyObject **args, Py_ssize_t nargs)
if (!_PyArg_UnpackStack(args, nargs, "setdefault", 1, 2, &key, &defaultobj))
return NULL;
if(!_PyArg_NoStackKeywords("pop", kwnames))
return NULL;
val = PyDict_SetDefault((PyObject *)mp, key, defaultobj);
Py_XINCREF(val);
return val;
@ -3050,13 +3056,16 @@ dict_clear(PyDictObject *mp)
}
static PyObject *
dict_pop(PyDictObject *mp, PyObject **args, Py_ssize_t nargs)
dict_pop(PyDictObject *mp, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *key, *deflt = NULL;
if(!_PyArg_UnpackStack(args, nargs, "pop", 1, 2, &key, &deflt))
return NULL;
if(!_PyArg_NoStackKeywords("pop", kwnames))
return NULL;
return _PyDict_Pop((PyObject*)mp, key, deflt);
}

View file

@ -364,7 +364,7 @@ PyFile_NewStdPrinter(int fd)
}
static PyObject *
stdprinter_write(PyStdPrinter_Object *self, PyObject **args, Py_ssize_t nargs)
stdprinter_write(PyStdPrinter_Object *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *unicode;
PyObject *bytes = NULL;
@ -383,6 +383,9 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject **args, Py_ssize_t nargs)
if (!_PyArg_UnpackStack(args, nargs, "write", 1, 1, &unicode))
return NULL;
if(!_PyArg_NoStackKeywords("write", kwnames))
return NULL;
/* encode Unicode to UTF-8 */
str = PyUnicode_AsUTF8AndSize(unicode, &n);
if (str == NULL) {

View file

@ -1038,7 +1038,7 @@ double_round(double x, int ndigits) {
/* round a Python float v to the closest multiple of 10**-ndigits */
static PyObject *
float_round(PyObject *v, PyObject **args, Py_ssize_t nargs)
float_round(PyObject *v, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
double x, rounded;
PyObject *o_ndigits = NULL;
@ -1048,6 +1048,9 @@ float_round(PyObject *v, PyObject **args, Py_ssize_t nargs)
if (!_PyArg_UnpackStack(args, nargs, "__round__", 0, 1, &o_ndigits))
return NULL;
if(!_PyArg_NoStackKeywords("__round__", kwnames))
return NULL;
if (o_ndigits == NULL || o_ndigits == Py_None) {
/* single-argument round or with None ndigits:
* round to nearest integer */
@ -1763,7 +1766,7 @@ float_getzero(PyObject *v, void *closure)
}
static PyObject *
float__format__(PyObject *self, PyObject **args, Py_ssize_t nargs)
float__format__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *format_spec;
_PyUnicodeWriter writer;
@ -1772,6 +1775,9 @@ float__format__(PyObject *self, PyObject **args, Py_ssize_t nargs)
if (!_PyArg_ParseStack(args, nargs, "U:__format__", &format_spec))
return NULL;
if(!_PyArg_NoStackKeywords("__format__", kwnames))
return NULL;
_PyUnicodeWriter_Init(&writer);
ret = _PyFloat_FormatAdvancedWriter(
&writer,

View file

@ -461,15 +461,13 @@ static int numfree;
static PyFrameObject *free_list;
#define PyFrame_MAXFREELIST 200
static void _Py_HOT_FUNCTION
static void
frame_dealloc(PyFrameObject *restrict f)
{
PyObject **p, **valuestack;
PyCodeObject *co;
if (_PyObject_GC_IS_TRACKED(f))
_PyObject_GC_UNTRACK(f);
PyObject_GC_UnTrack(f);
Py_TRASHCAN_SAFE_BEGIN(f)
/* Kill all local variables */
valuestack = f->f_valuestack;
@ -660,9 +658,9 @@ int _PyFrame_Init()
return 1;
}
PyFrameObject* _Py_HOT_FUNCTION
_PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code,
PyObject *globals, PyObject *locals)
PyFrameObject *
PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
PyObject *locals)
{
PyFrameObject *back = tstate->frame;
PyFrameObject *f;
@ -717,8 +715,7 @@ _PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code,
extras = code->co_stacksize + code->co_nlocals + ncells +
nfrees;
if (free_list == NULL) {
f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type,
extras);
f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, extras);
if (f == NULL) {
Py_DECREF(builtins);
return NULL;
@ -782,16 +779,7 @@ _PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code,
f->f_executing = 0;
f->f_gen = NULL;
return f;
}
PyFrameObject*
PyFrame_New(PyThreadState *tstate, PyCodeObject *code,
PyObject *globals, PyObject *locals)
{
PyFrameObject *f = _PyFrame_New_NoTrack(tstate, code, globals, locals);
if (f)
_PyObject_GC_TRACK(f);
_PyObject_GC_TRACK(f);
return f;
}

View file

@ -755,11 +755,12 @@ list_ass_item(PyListObject *a, Py_ssize_t i, PyObject *v)
}
static PyObject *
listinsert(PyListObject *self, PyObject **args, Py_ssize_t nargs)
listinsert(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
Py_ssize_t i;
PyObject *v;
if (!_PyArg_ParseStack(args, nargs, "nO:insert", &i, &v))
if (!_PyArg_ParseStack(args, nargs, "nO:insert", &i, &v)
|| !_PyArg_NoStackKeywords("insert", kwnames))
return NULL;
if (ins1(self, i, v) == 0)
Py_RETURN_NONE;
@ -920,13 +921,14 @@ list_inplace_concat(PyListObject *self, PyObject *other)
}
static PyObject *
listpop(PyListObject *self, PyObject **args, Py_ssize_t nargs)
listpop(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
Py_ssize_t i = -1;
PyObject *v;
int status;
if (!_PyArg_ParseStack(args, nargs, "|n:pop", &i))
if (!_PyArg_ParseStack(args, nargs, "|n:pop", &i)
|| !_PyArg_NoStackKeywords("pop", kwnames))
return NULL;
if (Py_SIZE(self) == 0) {

View file

@ -4907,7 +4907,7 @@ long_get1(PyLongObject *v, void *context) {
}
static PyObject *
long__format__(PyObject *self, PyObject **args, Py_ssize_t nargs)
long__format__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *format_spec;
_PyUnicodeWriter writer;
@ -5026,7 +5026,7 @@ _PyLong_DivmodNear(PyObject *a, PyObject *b)
}
static PyObject *
long_round(PyObject *self, PyObject **args, Py_ssize_t nargs)
long_round(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *o_ndigits=NULL, *temp, *result, *ndigits;

View file

@ -90,6 +90,331 @@ PyCFunction_GetFlags(PyObject *op)
return PyCFunction_GET_FLAGS(op);
}
static PyObject *
cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs)
{
assert(!PyErr_Occurred());
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
PyObject *self = PyCFunction_GET_SELF(func);
PyObject *result;
if (PyCFunction_GET_FLAGS(func) & METH_KEYWORDS) {
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
caller loses its exception */
assert(!PyErr_Occurred());
assert(method != NULL);
assert(nargs >= 0);
assert(nargs == 0 || args != NULL);
assert(kwargs == NULL || PyDict_Check(kwargs));
PyCFunction meth = method->ml_meth;
int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
PyObject *result = NULL;
if (Py_EnterRecursiveCall(" while calling a Python object")) {
return NULL;
}
switch (flags)
{
case METH_NOARGS:
if (nargs != 0) {
PyErr_Format(PyExc_TypeError,
"%.200s() takes no arguments (%zd given)",
method->ml_name, nargs);
goto exit;
}
if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
goto no_keyword_error;
}
result = (*meth) (self, NULL);
break;
case METH_O:
if (nargs != 1) {
PyErr_Format(PyExc_TypeError,
"%.200s() takes exactly one argument (%zd given)",
method->ml_name, nargs);
goto exit;
}
if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
goto no_keyword_error;
}
result = (*meth) (self, args[0]);
break;
case METH_VARARGS:
if (!(flags & METH_KEYWORDS)
&& kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) {
goto no_keyword_error;
}
/* fall through next case */
case METH_VARARGS | METH_KEYWORDS:
{
/* Slow-path: create a temporary tuple for positional arguments */
PyObject *argstuple = _PyStack_AsTuple(args, nargs);
if (argstuple == NULL) {
goto exit;
}
if (flags & METH_KEYWORDS) {
result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs);
}
else {
result = (*meth) (self, argstuple);
}
Py_DECREF(argstuple);
break;
}
case METH_FASTCALL:
{
PyObject **stack;
PyObject *kwnames;
_PyCFunctionFast fastmeth = (_PyCFunctionFast)meth;
if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) {
goto exit;
}
result = (*fastmeth) (self, stack, nargs, kwnames);
if (stack != args) {
PyMem_Free(stack);
}
Py_XDECREF(kwnames);
break;
}
default:
PyErr_SetString(PyExc_SystemError,
"Bad call flags in _PyMethodDef_RawFastCallDict. "
"METH_OLDARGS is no longer supported!");
goto exit;
}
goto exit;
no_keyword_error:
PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
method->ml_name, nargs);
exit:
Py_LeaveRecursiveCall();
return result;
}
PyObject *
_PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
PyObject *kwargs)
{
PyObject *result;
assert(func != NULL);
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(kwnames == NULL || PyTuple_CheckExact(kwnames));
/* kwnames must only contains str strings, no subclass, and all keys must
be unique */
PyCFunction meth = method->ml_meth;
int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
Py_ssize_t nkwargs = kwnames == NULL ? 0 : PyTuple_Size(kwnames);
PyObject *result = NULL;
if (Py_EnterRecursiveCall(" while calling a Python object")) {
return NULL;
}
switch (flags)
{
case METH_NOARGS:
if (nargs != 0) {
PyErr_Format(PyExc_TypeError,
"%.200s() takes no arguments (%zd given)",
method->ml_name, nargs);
goto exit;
}
if (nkwargs) {
goto no_keyword_error;
}
result = (*meth) (self, NULL);
break;
case METH_O:
if (nargs != 1) {
PyErr_Format(PyExc_TypeError,
"%.200s() takes exactly one argument (%zd given)",
method->ml_name, nargs);
goto exit;
}
if (nkwargs) {
goto no_keyword_error;
}
result = (*meth) (self, args[0]);
break;
case METH_FASTCALL:
/* Fast-path: avoid temporary dict to pass keyword arguments */
result = ((_PyCFunctionFast)meth) (self, args, nargs, kwnames);
break;
case METH_VARARGS:
case METH_VARARGS | METH_KEYWORDS:
{
/* Slow-path: create a temporary tuple for positional arguments
and a temporary dict for keyword arguments */
PyObject *argtuple;
if (!(flags & METH_KEYWORDS) && nkwargs) {
goto no_keyword_error;
}
argtuple = _PyStack_AsTuple(args, nargs);
if (argtuple == NULL) {
goto exit;
}
if (flags & METH_KEYWORDS) {
PyObject *kwdict;
if (nkwargs > 0) {
kwdict = _PyStack_AsDict(args + nargs, kwnames);
if (kwdict == NULL) {
Py_DECREF(argtuple);
goto exit;
}
}
else {
kwdict = NULL;
}
result = (*(PyCFunctionWithKeywords)meth) (self, argtuple, kwdict);
Py_XDECREF(kwdict);
}
else {
result = (*meth) (self, argtuple);
}
Py_DECREF(argtuple);
break;
}
default:
PyErr_SetString(PyExc_SystemError,
"Bad call flags in _PyCFunction_FastCallKeywords. "
"METH_OLDARGS is no longer supported!");
goto exit;
}
goto exit;
no_keyword_error:
PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
method->ml_name);
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) */
static void

View file

@ -1091,89 +1091,6 @@ _PyObject_NextNotImplemented(PyObject *self)
return NULL;
}
/* Specialized version of _PyObject_GenericGetAttrWithDict
specifically for the LOAD_METHOD opcode.
Return 1 if a method is found, 0 if it's a regular attribute
from __dict__ or something returned by using a descriptor
protocol.
`method` will point to the resolved attribute or NULL. In the
latter case, an error will be set.
*/
int
_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method)
{
PyTypeObject *tp = Py_TYPE(obj);
PyObject *descr;
descrgetfunc f = NULL;
PyObject **dictptr, *dict;
PyObject *attr;
int meth_found = 0;
assert(*method == NULL);
if (Py_TYPE(obj)->tp_getattro != PyObject_GenericGetAttr
|| !PyUnicode_Check(name)) {
*method = PyObject_GetAttr(obj, name);
return 0;
}
if (tp->tp_dict == NULL && PyType_Ready(tp) < 0)
return 0;
descr = _PyType_Lookup(tp, name);
if (descr != NULL) {
Py_INCREF(descr);
if (PyFunction_Check(descr) ||
(Py_TYPE(descr) == &PyMethodDescr_Type)) {
meth_found = 1;
} else {
f = descr->ob_type->tp_descr_get;
if (f != NULL && PyDescr_IsData(descr)) {
*method = f(descr, obj, (PyObject *)obj->ob_type);
Py_DECREF(descr);
return 0;
}
}
}
dictptr = _PyObject_GetDictPtr(obj);
if (dictptr != NULL && (dict = *dictptr) != NULL) {
Py_INCREF(dict);
attr = PyDict_GetItem(dict, name);
if (attr != NULL) {
Py_INCREF(attr);
*method = attr;
Py_DECREF(dict);
Py_XDECREF(descr);
return 0;
}
Py_DECREF(dict);
}
if (meth_found) {
*method = descr;
return 1;
}
if (f != NULL) {
*method = f(descr, obj, (PyObject *)Py_TYPE(obj));
Py_DECREF(descr);
return 0;
}
if (descr != NULL) {
*method = descr;
return 0;
}
PyErr_Format(PyExc_AttributeError,
"'%.50s' object has no attribute '%U'",
tp->tp_name, name);
return 0;
}
/* Generic GetAttr functions - put these in your tp_[gs]etattro slot */
PyObject *

View file

@ -90,7 +90,7 @@ Linked-List API
As noted, the linked-list implemented here does not have all the bells and
whistles. However, we recognize that the implementation may need 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:
Node info:
@ -124,6 +124,10 @@ Others:
* _odict_find_node(od, key)
* _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:
============ === === ==== ==== ==== === ==== ===== ==== ==== === ==== === ===
@ -397,6 +401,7 @@ tp_iter odict_iter
tp_dictoffset (offset)
tp_init odict_init
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.
- Add _odict_EXISTS()?
- 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.
* Use a more stream-lined implementation of update() and, likely indirectly,
__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;
/* PyODictObject */
@ -534,15 +547,24 @@ struct _odictnode {
#define _odict_FOREACH(od, 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. */
static Py_ssize_t
_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;
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) {
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. */
static int
_odict_resize(PyODictObject *od)
{
_odict_resize(PyODictObject *od) {
Py_ssize_t size, i;
_ODictNode **fast_nodes, *node;
@ -581,7 +602,7 @@ _odict_resize(PyODictObject *od)
}
/* 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_size = size;
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);
if (index < 0)
return NULL;
assert(od->od_fast_nodes != NULL);
return od->od_fast_nodes[index];
}
@ -637,7 +657,6 @@ _odict_find_node(PyODictObject *od, PyObject *key)
index = _odict_get_index(od, key, hash);
if (index < 0)
return NULL;
assert(od->od_fast_nodes != NULL);
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);
return -1;
}
assert(od->od_fast_nodes != NULL);
if (od->od_fast_nodes[i] != NULL) {
else if (od->od_fast_nodes[i] != NULL) {
/* We already have a node for the key so there's no need to add one. */
Py_DECREF(key);
return 0;
@ -762,7 +780,6 @@ _odict_clear_node(PyODictObject *od, _ODictNode *node, PyObject *key,
if (i < 0)
return PyErr_Occurred() ? -1 : 0;
assert(od->od_fast_nodes != NULL);
if (node == NULL)
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;
PyMem_FREE(od->od_fast_nodes);
_odict_free_fast_nodes(od);
od->od_fast_nodes = NULL;
od->od_fast_nodes_size = 0;
od->od_resize_sentinel = NULL;
node = _odict_FIRST(od);
_odict_FIRST(od) = NULL;
@ -885,7 +900,8 @@ odict_eq(PyObject *a, PyObject *b)
PyDoc_STRVAR(odict_init__doc__,
"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\
");
@ -921,25 +937,23 @@ PyDoc_STRVAR(odict_setitem__doc__, "od.__setitem__(i, y) <==> od[i]=y");
/* fromkeys() */
PyDoc_STRVAR(odict_fromkeys__doc__,
"OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.\n\
If not specified, the value defaults to None.\n\
\n\
");
/*[clinic input]
@classmethod
OrderedDict.fromkeys
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 *
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};
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);
return _PyDict_FromKeys((PyObject *)type, seq, value);
}
/* __sizeof__() */
@ -951,7 +965,7 @@ static PyObject *
odict_sizeof(PyODictObject *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)) {
res += sizeof(_ODictNode) * PyODict_SIZE(od); /* linked-list */
}
@ -1009,32 +1023,32 @@ Done:
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 *
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 *key, *result = NULL;
PyObject *failobj = Py_None;
PyObject *result = NULL;
/* both borrowed */
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:setdefault", kwlist,
&key, &failobj)) {
return NULL;
}
if (PyODict_CheckExact(od)) {
result = PyODict_GetItemWithError(od, key); /* borrowed */
if (PyODict_CheckExact(self)) {
result = PyODict_GetItemWithError(self, key); /* borrowed */
if (result == NULL) {
if (PyErr_Occurred())
return NULL;
assert(_odict_find_node(od, key) == NULL);
if (PyODict_SetItem((PyObject *)od, key, failobj) >= 0) {
assert(_odict_find_node(self, key) == NULL);
if (PyODict_SetItem((PyObject *)self, key, failobj) >= 0) {
result = failobj;
Py_INCREF(failobj);
}
@ -1044,14 +1058,14 @@ odict_setdefault(register PyODictObject *od, PyObject *args, PyObject *kwargs)
}
}
else {
int exists = PySequence_Contains((PyObject *)od, key);
int exists = PySequence_Contains((PyObject *)self, key);
if (exists < 0) {
return NULL;
}
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;
Py_INCREF(failobj);
}
@ -1161,41 +1175,37 @@ _odict_popkey(PyObject *od, PyObject *key, PyObject *failobj)
return _odict_popkey_hash(od, key, failobj, hash);
}
/* popitem() */
PyDoc_STRVAR(odict_popitem__doc__,
"popitem($self, /, last=True)\n"
"--\n"
"\n"
"Remove and return a (key, value) pair from the dictionary.\n"
"\n"
"Pairs are returned in LIFO order if last is true or FIFO order if false.");
/*[clinic input]
OrderedDict.popitem
last: bool = True
Return (k, v) and remove a (key, value) pair.
Pairs are returned in LIFO order if last is true or FIFO order if false.
[clinic start generated code]*/
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;
_ODictNode *node;
int last = 1;
/* pull the item */
/* borrowed */
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p:popitem", kwlist,
&last)) {
return NULL;
}
if (_odict_EMPTY(od)) {
if (_odict_EMPTY(self)) {
PyErr_SetString(PyExc_KeyError, "dictionary is empty");
return NULL;
}
node = last ? _odict_LAST(od) : _odict_FIRST(od);
node = last ? _odict_LAST(self) : _odict_FIRST(self);
key = _odictnode_KEY(node);
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)
return NULL;
item = PyTuple_Pack(2, key, value);
@ -1241,10 +1251,12 @@ PyDoc_STRVAR(odict_clear__doc__,
"od.clear() -> None. Remove all items from od.");
static PyObject *
odict_clear(register PyODictObject *od, PyObject *Py_UNUSED(ignored))
odict_clear(register PyODictObject *od)
{
PyDict_Clear((PyObject *)od);
_odict_clear_nodes(od);
if (_odict_resize(od) < 0)
return NULL;
Py_RETURN_NONE;
}
@ -1265,7 +1277,7 @@ odict_copy(register PyODictObject *od)
if (PyODict_CheckExact(od))
od_copy = PyODict_New();
else
od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL);
od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od));
if (od_copy == NULL)
return NULL;
@ -1321,36 +1333,34 @@ odict_reversed(PyODictObject *od)
return odictiter_new(od, _odict_ITER_KEYS|_odict_ITER_REVERSED);
}
/* move_to_end() */
PyDoc_STRVAR(odict_move_to_end__doc__,
"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).\n\
\n\
");
/*[clinic input]
OrderedDict.move_to_end
key: object
last: bool = True
"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 *
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;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|p:move_to_end", kwlist,
&key, &last)) {
return NULL;
}
if (_odict_EMPTY(od)) {
if (_odict_EMPTY(self)) {
PyErr_SetObject(PyExc_KeyError, key);
return NULL;
}
node = last ? _odict_LAST(od) : _odict_FIRST(od);
node = last ? _odict_LAST(self) : _odict_FIRST(self);
if (key != _odictnode_KEY(node)) {
node = _odict_find_node(od, key);
node = _odict_find_node(self, key);
if (node == NULL) {
if (!PyErr_Occurred())
PyErr_SetObject(PyExc_KeyError, key);
@ -1358,16 +1368,16 @@ odict_move_to_end(PyODictObject *od, PyObject *args, PyObject *kwargs)
}
if (last) {
/* Only move if not already the last one. */
if (node != _odict_LAST(od)) {
_odict_remove_node(od, node);
_odict_add_tail(od, node);
if (node != _odict_LAST(self)) {
_odict_remove_node(self, node);
_odict_add_tail(self, node);
}
}
else {
/* Only move if not already the first one. */
if (node != _odict_FIRST(od)) {
_odict_remove_node(od, node);
_odict_add_head(od, node);
if (node != _odict_FIRST(self)) {
_odict_remove_node(self, node);
_odict_add_head(self, node);
}
}
}
@ -1395,20 +1405,17 @@ static PyMethodDef odict_methods[] = {
odict_repr__doc__},
{"__setitem__", (PyCFunction)odict_mp_ass_sub, METH_NOARGS,
odict_setitem__doc__},
{"fromkeys", (PyCFunction)odict_fromkeys,
METH_VARARGS | METH_KEYWORDS | METH_CLASS, odict_fromkeys__doc__},
ORDEREDDICT_FROMKEYS_METHODDEF
/* overridden dict methods */
{"__sizeof__", (PyCFunction)odict_sizeof, METH_NOARGS,
odict_sizeof__doc__},
{"__reduce__", (PyCFunction)odict_reduce, METH_NOARGS,
odict_reduce__doc__},
{"setdefault", (PyCFunction)odict_setdefault,
METH_VARARGS | METH_KEYWORDS, odict_setdefault__doc__},
ORDEREDDICT_SETDEFAULT_METHODDEF
{"pop", (PyCFunction)odict_pop,
METH_VARARGS | METH_KEYWORDS, odict_pop__doc__},
{"popitem", (PyCFunction)odict_popitem,
METH_VARARGS | METH_KEYWORDS, odict_popitem__doc__},
ORDEREDDICT_POPITEM_METHODDEF
{"keys", (PyCFunction)odictkeys_new, METH_NOARGS,
odict_keys__doc__},
{"values", (PyCFunction)odictvalues_new, METH_NOARGS,
@ -1425,8 +1432,7 @@ static PyMethodDef odict_methods[] = {
/* new methods */
{"__reversed__", (PyCFunction)odict_reversed, METH_NOARGS,
odict_reversed__doc__},
{"move_to_end", (PyCFunction)odict_move_to_end,
METH_VARARGS | METH_KEYWORDS, odict_move_to_end__doc__},
ORDEREDDICT_MOVE_TO_END_METHODDEF
{NULL, NULL} /* sentinel */
};
@ -1578,10 +1584,13 @@ odict_traverse(PyODictObject *od, visitproc visit, void *arg)
static int
odict_tp_clear(PyODictObject *od)
{
PyObject *res;
Py_CLEAR(od->od_inst_dict);
Py_CLEAR(od->od_weakreflist);
PyDict_Clear((PyObject *)od);
_odict_clear_nodes(od);
res = odict_clear(od);
if (res == NULL)
return -1;
Py_DECREF(res);
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 */
PyTypeObject PyODict_Type = {
@ -1696,7 +1726,7 @@ PyTypeObject PyODict_Type = {
offsetof(PyODictObject, od_inst_dict), /* tp_dictoffset */
(initproc)odict_init, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
0, /* tp_new */
(newfunc)odict_new, /* tp_new */
0, /* tp_free */
};
@ -1706,9 +1736,8 @@ PyTypeObject PyODict_Type = {
*/
PyObject *
PyODict_New(void)
{
return PyDict_Type.tp_new(&PyODict_Type, NULL, NULL);
PyODict_New(void) {
return odict_new(&PyODict_Type, NULL, NULL);
}
static int
@ -1906,21 +1935,40 @@ done:
PyDoc_STRVAR(reduce_doc, "Return state information for pickling");
static PyObject *
odictiter_reduce(odictiterobject *di, PyObject *Py_UNUSED(ignored))
odictiter_reduce(odictiterobject *di)
{
/* copy the iterator state */
odictiterobject tmp = *di;
Py_XINCREF(tmp.di_odict);
Py_XINCREF(tmp.di_current);
PyObject *list, *iter;
list = PyList_New(0);
if (!list)
return NULL;
/* iterate the temporary into a list */
PyObject *list = PySequence_List((PyObject*)&tmp);
Py_XDECREF(tmp.di_odict);
Py_XDECREF(tmp.di_current);
if (list == NULL) {
for(;;) {
PyObject *element = odictiter_iternext(di);
if (element) {
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 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[] = {
@ -2390,8 +2438,7 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
/* now handle kwargs */
assert(kwargs == NULL || PyDict_Check(kwargs));
len = (kwargs != NULL) ? PyDict_Size(kwargs) : 0;
if (len > 0) {
if (kwargs != NULL && PyDict_GET_SIZE(kwargs)) {
PyObject *items = PyDict_Items(kwargs);
if (items == NULL)
return NULL;

View file

@ -3345,7 +3345,7 @@ static PyMethodDef type_methods[] = {
{"__subclasses__", (PyCFunction)type_subclasses, METH_NOARGS,
PyDoc_STR("__subclasses__() -> list of immediate subclasses")},
{"__prepare__", (PyCFunction)type_prepare,
METH_FASTCALL | METH_KEYWORDS | METH_CLASS,
METH_FASTCALL | METH_CLASS,
PyDoc_STR("__prepare__() -> dict\n"
"used to create the namespace for the class statement")},
{"__instancecheck__", type___instancecheck__, METH_O,

View file

@ -1095,7 +1095,6 @@ static PYC_MAGIC magic_values[] = {
{ 3250, 3310, L"3.4" },
{ 3320, 3351, L"3.5" },
{ 3360, 3379, L"3.6" },
{ 3390, 3399, L"3.7" },
{ 0 }
};

View file

@ -239,7 +239,8 @@ _Py_IDENTIFIER(stderr);
/* AC: cannot convert yet, waiting for *args support */
static PyObject *
builtin___build_class__(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
builtin___build_class__(PyObject *self, PyObject **args, Py_ssize_t nargs,
PyObject *kwnames)
{
PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns;
PyObject *cls = NULL, *cell = NULL;
@ -973,12 +974,14 @@ finally:
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject *
builtin_dir(PyObject *self, PyObject **args, Py_ssize_t nargs)
builtin_dir(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *arg = NULL;
if (!_PyArg_UnpackStack(args, nargs, "dir", 0, 1, &arg))
return NULL;
if (!_PyArg_NoStackKeywords("dir", kwnames))
return NULL;
return PyObject_Dir(arg);
}
@ -1189,7 +1192,8 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject *
builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs)
builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs,
PyObject *kwnames)
{
PyObject *v, *result, *dflt = NULL;
PyObject *name;
@ -1197,6 +1201,10 @@ builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs)
if (!_PyArg_UnpackStack(args, nargs, "getattr", 2, 3, &v, &name, &dflt))
return NULL;
if (!_PyArg_NoStackKeywords("getattr", kwnames)) {
return NULL;
}
if (!PyUnicode_Check(name)) {
PyErr_SetString(PyExc_TypeError,
"getattr(): attribute name must be string");
@ -1494,7 +1502,8 @@ PyTypeObject PyMap_Type = {
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject *
builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs)
builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs,
PyObject *kwnames)
{
PyObject *it, *res;
PyObject *def = NULL;
@ -1502,6 +1511,10 @@ builtin_next(PyObject *self, PyObject **args, Py_ssize_t nargs)
if (!_PyArg_UnpackStack(args, nargs, "next", 1, 2, &it, &def))
return NULL;
if (!_PyArg_NoStackKeywords("next", kwnames)) {
return NULL;
}
if (!PyIter_Check(it)) {
PyErr_Format(PyExc_TypeError,
"'%.200s' object is not an iterator",
@ -1630,12 +1643,14 @@ builtin_hex(PyObject *module, PyObject *number)
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject *
builtin_iter(PyObject *self, PyObject **args, Py_ssize_t nargs)
builtin_iter(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *v, *w = NULL;
if (!_PyArg_UnpackStack(args, nargs, "iter", 1, 2, &v, &w))
return NULL;
if(!_PyArg_NoStackKeywords("iter", kwnames))
return NULL;
if (w == NULL)
return PyObject_GetIter(v);
if (!PyCallable_Check(v)) {
@ -2318,7 +2333,7 @@ PyDoc_STRVAR(builtin_sorted__doc__,
"reverse flag can be set to request the result in descending order.");
#define BUILTIN_SORTED_METHODDEF \
{"sorted", (PyCFunction)builtin_sorted, METH_FASTCALL | METH_KEYWORDS, builtin_sorted__doc__},
{"sorted", (PyCFunction)builtin_sorted, METH_FASTCALL, builtin_sorted__doc__},
static PyObject *
builtin_sorted(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
@ -2357,13 +2372,15 @@ builtin_sorted(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwna
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject *
builtin_vars(PyObject *self, PyObject **args, Py_ssize_t nargs)
builtin_vars(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *v = NULL;
PyObject *d;
if (!_PyArg_UnpackStack(args, nargs, "vars", 0, 1, &v))
return NULL;
if(!_PyArg_NoStackKeywords("vars", kwnames))
return NULL;
if (v == NULL) {
d = PyEval_GetLocals();
if (d == NULL)
@ -2817,8 +2834,8 @@ PyTypeObject PyZip_Type = {
static PyMethodDef builtin_methods[] = {
{"__build_class__", (PyCFunction)builtin___build_class__,
METH_FASTCALL | METH_KEYWORDS, build_class_doc},
{"__import__", (PyCFunction)builtin___import__, METH_FASTCALL | METH_KEYWORDS, import_doc},
METH_FASTCALL, build_class_doc},
{"__import__", (PyCFunction)builtin___import__, METH_FASTCALL, import_doc},
BUILTIN_ABS_METHODDEF
BUILTIN_ALL_METHODDEF
BUILTIN_ANY_METHODDEF
@ -2851,7 +2868,7 @@ static PyMethodDef builtin_methods[] = {
BUILTIN_OCT_METHODDEF
BUILTIN_ORD_METHODDEF
BUILTIN_POW_METHODDEF
{"print", (PyCFunction)builtin_print, METH_FASTCALL | METH_KEYWORDS, print_doc},
{"print", (PyCFunction)builtin_print, METH_FASTCALL, print_doc},
BUILTIN_REPR_METHODDEF
{"round", (PyCFunction)builtin_round, METH_VARARGS | METH_KEYWORDS, round_doc},
BUILTIN_SETATTR_METHODDEF

View file

@ -13,7 +13,6 @@
#include "third_party/python/Include/ceval.h"
#include "third_party/python/Include/classobject.h"
#include "third_party/python/Include/code.h"
#include "third_party/python/Include/descrobject.h"
#include "third_party/python/Include/dictobject.h"
#include "third_party/python/Include/eval.h"
#include "third_party/python/Include/frameobject.h"
@ -22,7 +21,6 @@
#include "third_party/python/Include/import.h"
#include "third_party/python/Include/longobject.h"
#include "third_party/python/Include/object.h"
#include "third_party/python/Include/objimpl.h"
#include "third_party/python/Include/opcode.h"
#include "third_party/python/Include/pydtrace.h"
#include "third_party/python/Include/pyerrors.h"
@ -52,7 +50,6 @@
#define CHECKEXC 1 /* Double-check exception checking */
#endif
extern int _PyObject_GetMethod(PyObject *, PyObject *, PyObject **);
typedef PyObject *(*callproc)(PyObject *, PyObject *, PyObject *);
#ifdef LLTRACE
@ -63,6 +60,7 @@ static int prtrace(PyObject *, const char *);
static PyObject *call_function(PyObject ***, Py_ssize_t, PyObject *);
static PyObject *cmp_outcome(int, PyObject *, PyObject *);
static PyObject *do_call_core(PyObject *, PyObject *, PyObject *);
static PyObject *fast_function(PyObject *, PyObject **, Py_ssize_t, PyObject *);
static PyObject *import_from(PyObject *, PyObject *);
static PyObject *import_name(PyFrameObject *, PyObject *, PyObject *, PyObject *);
static PyObject *special_lookup(PyObject *, _Py_Identifier *);
@ -732,7 +730,7 @@ PyObject *
return tstate->interp->eval_frame(f, throwflag);
}
PyObject * _Py_HOT_FUNCTION
PyObject *
_PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
{
#ifdef DXPAIRS
@ -3314,92 +3312,6 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
DISPATCH();
}
TARGET(LOAD_METHOD) {
/* Designed to work in tamdem with CALL_METHOD. */
PyObject *name = GETITEM(names, oparg);
PyObject *obj = TOP();
PyObject *meth = NULL;
int meth_found = _PyObject_GetMethod(obj, name, &meth);
if (meth == NULL) {
/* Most likely attribute wasn't found. */
goto error;
}
if (meth_found) {
/* We can bypass temporary bound method object.
meth is unbound method and obj is self.
meth | self | arg1 | ... | argN
*/
SET_TOP(meth);
PUSH(obj); // self
}
else {
/* meth is not an unbound method (but a regular attr, or
something was returned by a descriptor protocol). Set
the second element of the stack to NULL, to signal
CALL_METHOD that it's not a method call.
NULL | meth | arg1 | ... | argN
*/
SET_TOP(NULL);
Py_DECREF(obj);
PUSH(meth);
}
DISPATCH();
}
TARGET(CALL_METHOD) {
/* Designed to work in tamdem with LOAD_METHOD. */
PyObject **sp, *res, *meth;
sp = stack_pointer;
meth = PEEK(oparg + 2);
if (meth == NULL) {
/* `meth` is NULL when LOAD_METHOD thinks that it's not
a method call.
Stack layout:
... | NULL | callable | arg1 | ... | argN
^- TOP()
^- (-oparg)
^- (-oparg-1)
^- (-oparg-2)
`callable` will be POPed by call_function.
NULL will will be POPed manually later.
*/
res = call_function(&sp, oparg, NULL);
stack_pointer = sp;
(void)POP(); /* POP the NULL. */
}
else {
/* This is a method call. Stack layout:
... | method | self | arg1 | ... | argN
^- TOP()
^- (-oparg)
^- (-oparg-1)
^- (-oparg-2)
`self` and `method` will be POPed by call_function.
We'll be passing `oparg + 1` to call_function, to
make it accept the `self` as a first argument.
*/
res = call_function(&sp, oparg + 1, NULL);
stack_pointer = sp;
}
PUSH(res);
if (res == NULL)
goto error;
DISPATCH();
}
PREDICTED(CALL_FUNCTION);
TARGET(CALL_FUNCTION) {
PyObject **sp, *res;
@ -3964,7 +3876,7 @@ too_many_positional(PyCodeObject *co, Py_ssize_t given, Py_ssize_t defcount,
/* This is gonna seem *real weird*, but if you put some other code between
PyEval_EvalFrame() and _PyEval_EvalFrameDefault() you will need to adjust
the test in the if statements in Misc/gdbinit (pystack and pystackv). */
PyObject *
static PyObject *
_PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals,
PyObject **args, Py_ssize_t argcount,
PyObject **kwnames, PyObject **kwargs,
@ -3990,7 +3902,7 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals,
/* Create the frame */
tstate = PyThreadState_GET();
assert(tstate != NULL);
f = _PyFrame_New_NoTrack(tstate, co, globals, locals);
f = PyFrame_New(tstate, co, globals, locals);
if (f == NULL) {
return NULL;
}
@ -4212,15 +4124,9 @@ fail: /* Jump here from prelude on failure */
so recursion_depth must be boosted for the duration.
*/
assert(tstate != NULL);
if (Py_REFCNT(f) > 1) {
Py_DECREF(f);
_PyObject_GC_TRACK(f);
}
else {
++tstate->recursion_depth;
Py_DECREF(f);
--tstate->recursion_depth;
}
++tstate->recursion_depth;
Py_DECREF(f);
--tstate->recursion_depth;
return retval;
}
@ -4756,6 +4662,35 @@ PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
}
/* External interface to call any callable object.
The arg must be a tuple or NULL. The kw must be a dict or NULL. */
PyObject *
PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
{
#ifdef Py_DEBUG
/* PyEval_CallObjectWithKeywords() must not be called with an exception
set. It raises a new exception if parameters are invalid or if
PyTuple_New() fails, and so the original exception is lost. */
assert(!PyErr_Occurred());
#endif
if (args != NULL && !PyTuple_Check(args)) {
PyErr_SetString(PyExc_TypeError,
"argument list must be a tuple");
return NULL;
}
if (kwargs != NULL && !PyDict_Check(kwargs)) {
PyErr_SetString(PyExc_TypeError,
"keyword list must be a dictionary");
return NULL;
}
if (args == NULL) {
return _PyObject_FastCallDict(func, NULL, 0, kwargs);
}
else {
return PyObject_Call(func, args, kwargs);
}
}
const char *
PyEval_GetFuncName(PyObject *func)
{
@ -4813,7 +4748,7 @@ if (tstate->use_tracing && tstate->c_profilefunc) { \
x = call; \
}
forceinline PyObject * _Py_HOT_FUNCTION
static PyObject *
call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames)
{
PyObject **pfunc = (*pp_stack) - oparg - 1;
@ -4821,41 +4756,16 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames)
PyObject *x, *w;
Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
Py_ssize_t nargs = oparg - nkwargs;
PyObject **stack = (*pp_stack) - nargs - nkwargs;
PyObject **stack;
/* Always dispatch PyCFunction first, because these are
presumed to be the most frequent callable object.
*/
if (PyCFunction_Check(func)) {
PyThreadState *tstate = PyThreadState_GET();
PCALL(PCALL_CFUNCTION);
stack = (*pp_stack) - nargs - nkwargs;
C_TRACE(x, _PyCFunction_FastCallKeywords(func, stack, nargs, kwnames));
}
else if (Py_TYPE(func) == &PyMethodDescr_Type) {
PyThreadState *tstate = PyThreadState_GET();
if (nargs > 0 && tstate->use_tracing) {
/* We need to create a temporary bound method as argument
for profiling.
If nargs == 0, then this cannot work because we have no
"self". In any case, the call itself would raise
TypeError (foo needs an argument), so we just skip
profiling. */
PyObject *self = stack[0];
func = Py_TYPE(func)->tp_descr_get(func, self, (PyObject*)Py_TYPE(self));
if (func != NULL) {
C_TRACE(x, _PyCFunction_FastCallKeywords(func,
stack+1, nargs-1,
kwnames));
Py_DECREF(func);
}
else {
x = NULL;
}
}
else {
x = _PyMethodDescr_FastCallKeywords(func, stack, nargs, kwnames);
}
}
else {
if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) {
/* optimize access to bound methods */
@ -4867,13 +4777,13 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames)
Py_INCREF(func);
Py_SETREF(*pfunc, self);
nargs++;
stack--;
}
else {
Py_INCREF(func);
}
stack = (*pp_stack) - nargs - nkwargs;
if (PyFunction_Check(func)) {
x = _PyFunction_FastCallKeywords(func, stack, nargs, kwnames);
x = fast_function(func, stack, nargs, kwnames);
}
else {
x = _PyObject_FastCallKeywords(func, stack, nargs, kwnames);
@ -4881,7 +4791,10 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames)
Py_DECREF(func);
}
assert((x != NULL) ^ (PyErr_Occurred() != NULL));
/* Clear the stack of the function object. */
/* Clear the stack of the function object. Also removes
the arguments in case they weren't consumed already
(fast_function() and err_args() leave them on the stack).
*/
while ((*pp_stack) > pfunc) {
w = EXT_POP(*pp_stack);
Py_DECREF(w);
@ -4890,6 +4803,183 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames)
return x;
}
/* The fast_function() function optimize calls for which no argument
tuple is necessary; the objects are passed directly from the stack.
For the simplest case -- a function that takes only positional
arguments and is called with only positional arguments -- it
inlines the most primitive frame setup code from
PyEval_EvalCodeEx(), which vastly reduces the checks that must be
done before evaluating the frame.
*/
static PyObject*
_PyFunction_FastCall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs,
PyObject *globals)
{
PyFrameObject *f;
PyThreadState *tstate = PyThreadState_GET();
PyObject **fastlocals;
Py_ssize_t i;
PyObject *result;
PCALL(PCALL_FASTER_FUNCTION);
assert(globals != NULL);
/* XXX Perhaps we should create a specialized
PyFrame_New() that doesn't take locals, but does
take builtins without sanity checking them.
*/
assert(tstate != NULL);
f = PyFrame_New(tstate, co, globals, NULL);
if (f == NULL) {
return NULL;
}
fastlocals = f->f_localsplus;
for (i = 0; i < nargs; i++) {
Py_INCREF(*args);
fastlocals[i] = *args++;
}
result = PyEval_EvalFrameEx(f,0);
++tstate->recursion_depth;
Py_DECREF(f);
--tstate->recursion_depth;
return result;
}
static PyObject *
fast_function(PyObject *func, PyObject **stack,
Py_ssize_t nargs, PyObject *kwnames)
{
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
PyObject *globals = PyFunction_GET_GLOBALS(func);
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
PyObject *kwdefs, *closure, *name, *qualname;
PyObject **d;
Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
Py_ssize_t nd;
assert(PyFunction_Check(func));
assert(nargs >= 0);
assert(kwnames == NULL || PyTuple_CheckExact(kwnames));
assert((nargs == 0 && nkwargs == 0) || stack != NULL);
/* kwnames must only contains str strings, no subclass, and all keys must
be unique */
PCALL(PCALL_FUNCTION);
PCALL(PCALL_FAST_FUNCTION);
if (co->co_kwonlyargcount == 0 && nkwargs == 0 &&
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE))
{
if (argdefs == NULL && co->co_argcount == nargs) {
return _PyFunction_FastCall(co, stack, nargs, globals);
}
else if (nargs == 0 && argdefs != NULL
&& co->co_argcount == Py_SIZE(argdefs)) {
/* function called with no arguments, but all parameters have
a default value: use default values as arguments .*/
stack = &PyTuple_GET_ITEM(argdefs, 0);
return _PyFunction_FastCall(co, stack, Py_SIZE(argdefs), globals);
}
}
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
closure = PyFunction_GET_CLOSURE(func);
name = ((PyFunctionObject *)func) -> func_name;
qualname = ((PyFunctionObject *)func) -> func_qualname;
if (argdefs != NULL) {
d = &PyTuple_GET_ITEM(argdefs, 0);
nd = Py_SIZE(argdefs);
}
else {
d = NULL;
nd = 0;
}
return _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL,
stack, nargs,
nkwargs ? &PyTuple_GET_ITEM(kwnames, 0) : NULL,
stack + nargs,
nkwargs, 1,
d, (int)nd, kwdefs,
closure, name, qualname);
}
PyObject *
_PyFunction_FastCallKeywords(PyObject *func, PyObject **stack,
Py_ssize_t nargs, PyObject *kwnames)
{
return fast_function(func, stack, nargs, kwnames);
}
PyObject *
_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs,
PyObject *kwargs)
{
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
PyObject *globals = PyFunction_GET_GLOBALS(func);
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
PyObject *kwdefs, *closure, *name, *qualname;
PyObject *kwtuple, **k;
PyObject **d;
Py_ssize_t nd, nk;
PyObject *result;
assert(func != NULL);
assert(nargs >= 0);
assert(nargs == 0 || args != NULL);
assert(kwargs == NULL || PyDict_Check(kwargs));
PCALL(PCALL_FUNCTION);
PCALL(PCALL_FAST_FUNCTION);
if (co->co_kwonlyargcount == 0 &&
(kwargs == NULL || PyDict_Size(kwargs) == 0) &&
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE))
{
/* Fast paths */
if (argdefs == NULL && co->co_argcount == nargs) {
return _PyFunction_FastCall(co, args, nargs, globals);
}
else if (nargs == 0 && argdefs != NULL
&& co->co_argcount == Py_SIZE(argdefs)) {
/* function called with no arguments, but all parameters have
a default value: use default values as arguments .*/
args = &PyTuple_GET_ITEM(argdefs, 0);
return _PyFunction_FastCall(co, args, Py_SIZE(argdefs), globals);
}
}
if (kwargs != NULL) {
Py_ssize_t pos, i;
nk = PyDict_Size(kwargs);
kwtuple = PyTuple_New(2 * nk);
if (kwtuple == NULL) {
return NULL;
}
k = &PyTuple_GET_ITEM(kwtuple, 0);
pos = i = 0;
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
Py_INCREF(k[i]);
Py_INCREF(k[i+1]);
i += 2;
}
nk = i / 2;
}
else {
kwtuple = NULL;
k = NULL;
nk = 0;
}
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
closure = PyFunction_GET_CLOSURE(func);
name = ((PyFunctionObject *)func) -> func_name;
qualname = ((PyFunctionObject *)func) -> func_qualname;
if (argdefs != NULL) {
d = &PyTuple_GET_ITEM(argdefs, 0);
nd = Py_SIZE(argdefs);
}
else {
d = NULL;
nd = 0;
}
result = _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL,
args, nargs,
k, k != NULL ? k + 1 : NULL, nk, 2,
d, nd, kwdefs,
closure, name, qualname);
Py_XDECREF(kwtuple);
return result;
}
static PyObject *
do_call_core(PyObject *func, PyObject *callargs, PyObject *kwdict)
{

View file

@ -89,7 +89,7 @@ static PyObject *
builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec);
static PyObject *
builtin_format(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_format(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *value;
@ -99,6 +99,10 @@ builtin_format(PyObject *module, PyObject **args, Py_ssize_t nargs)
&value, &format_spec)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("format", kwnames)) {
goto exit;
}
return_value = builtin_format_impl(module, value, format_spec);
exit:
@ -151,7 +155,7 @@ PyDoc_STRVAR(builtin_compile__doc__,
"in addition to any features explicitly specified.");
#define BUILTIN_COMPILE_METHODDEF \
{"compile", (PyCFunction)builtin_compile, METH_FASTCALL|METH_KEYWORDS, builtin_compile__doc__},
{"compile", (PyCFunction)builtin_compile, METH_FASTCALL, builtin_compile__doc__},
static PyObject *
builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
@ -194,7 +198,7 @@ static PyObject *
builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y);
static PyObject *
builtin_divmod(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_divmod(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *x;
@ -205,6 +209,10 @@ builtin_divmod(PyObject *module, PyObject **args, Py_ssize_t nargs)
&x, &y)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("divmod", kwnames)) {
goto exit;
}
return_value = builtin_divmod_impl(module, x, y);
exit:
@ -231,7 +239,7 @@ builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals,
PyObject *locals);
static PyObject *
builtin_eval(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_eval(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *source;
@ -243,6 +251,10 @@ builtin_eval(PyObject *module, PyObject **args, Py_ssize_t nargs)
&source, &globals, &locals)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("eval", kwnames)) {
goto exit;
}
return_value = builtin_eval_impl(module, source, globals, locals);
exit:
@ -269,7 +281,7 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
PyObject *locals);
static PyObject *
builtin_exec(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_exec(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *source;
@ -281,6 +293,10 @@ builtin_exec(PyObject *module, PyObject **args, Py_ssize_t nargs)
&source, &globals, &locals)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("exec", kwnames)) {
goto exit;
}
return_value = builtin_exec_impl(module, source, globals, locals);
exit:
@ -323,7 +339,7 @@ static PyObject *
builtin_hasattr_impl(PyObject *module, PyObject *obj, PyObject *name);
static PyObject *
builtin_hasattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_hasattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *obj;
@ -334,6 +350,10 @@ builtin_hasattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
&obj, &name)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("hasattr", kwnames)) {
goto exit;
}
return_value = builtin_hasattr_impl(module, obj, name);
exit:
@ -368,7 +388,7 @@ builtin_setattr_impl(PyObject *module, PyObject *obj, PyObject *name,
PyObject *value);
static PyObject *
builtin_setattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_setattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *obj;
@ -380,6 +400,10 @@ builtin_setattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
&obj, &name, &value)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("setattr", kwnames)) {
goto exit;
}
return_value = builtin_setattr_impl(module, obj, name, value);
exit:
@ -401,7 +425,7 @@ static PyObject *
builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name);
static PyObject *
builtin_delattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_delattr(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *obj;
@ -412,6 +436,10 @@ builtin_delattr(PyObject *module, PyObject **args, Py_ssize_t nargs)
&obj, &name)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("delattr", kwnames)) {
goto exit;
}
return_value = builtin_delattr_impl(module, obj, name);
exit:
@ -510,7 +538,7 @@ static PyObject *
builtin_pow_impl(PyObject *module, PyObject *x, PyObject *y, PyObject *z);
static PyObject *
builtin_pow(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_pow(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *x;
@ -522,6 +550,10 @@ builtin_pow(PyObject *module, PyObject **args, Py_ssize_t nargs)
&x, &y, &z)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("pow", kwnames)) {
goto exit;
}
return_value = builtin_pow_impl(module, x, y, z);
exit:
@ -547,7 +579,7 @@ static PyObject *
builtin_input_impl(PyObject *module, PyObject *prompt);
static PyObject *
builtin_input(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_input(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *prompt = NULL;
@ -557,6 +589,10 @@ builtin_input(PyObject *module, PyObject **args, Py_ssize_t nargs)
&prompt)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("input", kwnames)) {
goto exit;
}
return_value = builtin_input_impl(module, prompt);
exit:
@ -591,7 +627,7 @@ static PyObject *
builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start);
static PyObject *
builtin_sum(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_sum(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *iterable;
@ -602,6 +638,10 @@ builtin_sum(PyObject *module, PyObject **args, Py_ssize_t nargs)
&iterable, &start)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("sum", kwnames)) {
goto exit;
}
return_value = builtin_sum_impl(module, iterable, start);
exit:
@ -626,7 +666,7 @@ builtin_isinstance_impl(PyObject *module, PyObject *obj,
PyObject *class_or_tuple);
static PyObject *
builtin_isinstance(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_isinstance(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *obj;
@ -637,6 +677,10 @@ builtin_isinstance(PyObject *module, PyObject **args, Py_ssize_t nargs)
&obj, &class_or_tuple)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("isinstance", kwnames)) {
goto exit;
}
return_value = builtin_isinstance_impl(module, obj, class_or_tuple);
exit:
@ -661,7 +705,7 @@ builtin_issubclass_impl(PyObject *module, PyObject *cls,
PyObject *class_or_tuple);
static PyObject *
builtin_issubclass(PyObject *module, PyObject **args, Py_ssize_t nargs)
builtin_issubclass(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *cls;
@ -672,9 +716,13 @@ builtin_issubclass(PyObject *module, PyObject **args, Py_ssize_t nargs)
&cls, &class_or_tuple)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("issubclass", kwnames)) {
goto exit;
}
return_value = builtin_issubclass_impl(module, cls, class_or_tuple);
exit:
return return_value;
}
/*[clinic end generated code: output=09752daa8cdd6ec7 input=a9049054013a1b77]*/
/*[clinic end generated code: output=17fedd2dec148677 input=a9049054013a1b77]*/

View file

@ -83,7 +83,7 @@ _imp__fix_co_filename_impl(PyObject *module, PyCodeObject *code,
PyObject *path);
static PyObject *
_imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs)
_imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyCodeObject *code;
@ -93,6 +93,10 @@ _imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs)
&PyCode_Type, &code, &path)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("_fix_co_filename", kwnames)) {
goto exit;
}
return_value = _imp__fix_co_filename_impl(module, code, path);
exit:
@ -276,7 +280,7 @@ static PyObject *
_imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file);
static PyObject *
_imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs)
_imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
PyObject *spec;
@ -287,6 +291,10 @@ _imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs)
&spec, &file)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("create_dynamic", kwnames)) {
goto exit;
}
return_value = _imp_create_dynamic_impl(module, spec, file);
exit:
@ -362,4 +370,4 @@ exit:
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _IMP_EXEC_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
/*[clinic end generated code: output=d068dd493e513604 input=a9049054013a1b77]*/
/*[clinic end generated code: output=c1d0e65d04114958 input=a9049054013a1b77]*/

View file

@ -1058,8 +1058,6 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
return -oparg;
case CALL_FUNCTION:
return -oparg;
case CALL_METHOD:
return -oparg-1;
case CALL_FUNCTION_KW:
return -oparg-1;
case CALL_FUNCTION_EX:
@ -1098,8 +1096,6 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
/* If there's a fmt_spec on the stack, we go from 2->1,
else 1->1. */
return (oparg & FVS_MASK) == FVS_HAVE_SPEC ? -1 : 0;
case LOAD_METHOD:
return 1;
default:
return PY_INVALID_STACK_EFFECT;
}
@ -3419,44 +3415,9 @@ compiler_compare(struct compiler *c, expr_ty e)
return 1;
}
// Return 1 if the method call was optimized, -1 if not, and 0 on error.
static int
maybe_optimize_method_call(struct compiler *c, expr_ty e)
{
Py_ssize_t argsl, i;
expr_ty meth = e->v.Call.func;
asdl_seq *args = e->v.Call.args;
/* Check that the call node is an attribute access, and that
the call doesn't have keyword parameters. */
if (meth->kind != Attribute_kind || meth->v.Attribute.ctx != Load ||
asdl_seq_LEN(e->v.Call.keywords))
return -1;
/* Check that there are no *varargs types of arguments. */
argsl = asdl_seq_LEN(args);
for (i = 0; i < argsl; i++) {
expr_ty elt = asdl_seq_GET(args, i);
if (elt->kind == Starred_kind) {
return -1;
}
}
/* Alright, we can optimize the code. */
VISIT(c, expr, meth->v.Attribute.value);
ADDOP_NAME(c, LOAD_METHOD, meth->v.Attribute.attr, names);
VISIT_SEQ(c, expr, e->v.Call.args);
ADDOP_I(c, CALL_METHOD, asdl_seq_LEN(e->v.Call.args));
return 1;
}
static int
compiler_call(struct compiler *c, expr_ty e)
{
int ret = maybe_optimize_method_call(c, e);
if (ret >= 0) {
return ret;
}
VISIT(c, expr, e->v.Call.func);
return compiler_call_helper(c, 0,
e->v.Call.args,

View file

@ -153,7 +153,7 @@ PyErr_SetString(PyObject *exception, const char *string)
Py_XDECREF(value);
}
PyObject * _Py_HOT_FUNCTION
PyObject *
PyErr_Occurred(void)
{
PyThreadState *tstate = _PyThreadState_UncheckedGet();

View file

@ -1688,7 +1688,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
/* And an interface for Python programs... */
static PyObject *
marshal_dump(PyObject *self, PyObject **args, Py_ssize_t nargs)
marshal_dump(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
/* XXX Quick hack -- need to do this differently */
PyObject *x;
@ -1700,6 +1700,8 @@ marshal_dump(PyObject *self, PyObject **args, Py_ssize_t nargs)
if (!_PyArg_ParseStack(args, nargs, "OO|i:dump", &x, &f, &version))
return NULL;
if (!_PyArg_NoStackKeywords("dump", kwnames))
return NULL;
s = PyMarshal_WriteObjectToString(x, version);
if (s == NULL)
@ -1776,12 +1778,14 @@ dump(), load() will substitute None for the unmarshallable type.");
static PyObject *
marshal_dumps(PyObject *self, PyObject **args, Py_ssize_t nargs)
marshal_dumps(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *x;
int version = Py_MARSHAL_VERSION;
if (!_PyArg_ParseStack(args, nargs, "O|i:dumps", &x, &version))
return NULL;
if(!_PyArg_NoStackKeywords("dumps", kwnames))
return NULL;
return PyMarshal_WriteObjectToString(x, version);
}
@ -1796,7 +1800,7 @@ The version argument indicates the data format that dumps should use.");
static PyObject *
marshal_loads(PyObject *self, PyObject **args, Py_ssize_t nargs)
marshal_loads(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
RFILE rf;
Py_buffer p;
@ -1805,6 +1809,8 @@ marshal_loads(PyObject *self, PyObject **args, Py_ssize_t nargs)
PyObject* result;
if (!_PyArg_ParseStack(args, nargs, "y*:loads", &p))
return NULL;
if(!_PyArg_NoStackKeywords("loads", kwnames))
return NULL;
s = p.buf;
n = p.len;
rf.fp = NULL;

View file

@ -600,6 +600,58 @@ va_build_stack(PyObject **small_stack, Py_ssize_t small_stack_len,
return stack;
}
PyObject *
PyEval_CallFunction(PyObject *callable, const char *format, ...)
{
va_list vargs;
PyObject *args;
PyObject *res;
va_start(vargs, format);
args = Py_VaBuildValue(format, vargs);
va_end(vargs);
if (args == NULL)
return NULL;
res = PyEval_CallObject(callable, args);
Py_DECREF(args);
return res;
}
PyObject *
PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...)
{
va_list vargs;
PyObject *meth;
PyObject *args;
PyObject *res;
meth = PyObject_GetAttrString(obj, name);
if (meth == NULL)
return NULL;
va_start(vargs, format);
args = Py_VaBuildValue(format, vargs);
va_end(vargs);
if (args == NULL) {
Py_DECREF(meth);
return NULL;
}
res = PyEval_CallObject(meth, args);
Py_DECREF(meth);
Py_DECREF(args);
return res;
}
int
PyModule_AddObject(PyObject *m, const char *name, PyObject *o)
{

View file

@ -167,8 +167,8 @@ static void *const opcode_targets[256] = {
&&TARGET_BUILD_STRING,
&&TARGET_BUILD_TUPLE_UNPACK_WITH_CALL,
&&_unknown_opcode,
&&TARGET_LOAD_METHOD,
&&TARGET_CALL_METHOD,
&&_unknown_opcode,
&&_unknown_opcode,
&&_unknown_opcode,
&&_unknown_opcode,
&&_unknown_opcode,

View file

@ -137,7 +137,7 @@ main(int argc, char *argv[])
p = PyBytes_AS_STRING(marshalled);
n = PyBytes_GET_SIZE(marshalled);
CHECK_NE(-1, (fd = open(outpath, O_CREAT|O_TRUNC|O_WRONLY, 0644)));
WRITE16LE(m+0, 3390); /* Python 3.7a1 */
WRITE16LE(m+0, 3379); /* Python 3.6rc1 */
WRITE16LE(m+2, READ16LE("\r\n"));
WRITE32LE(m+4, st.st_mtim.tv_sec); /* tsk tsk y2038 */
WRITE32LE(m+8, n);

Some files were not shown because too many files have changed in this diff Show more