_testclinic.c.h 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172
  1. /*[clinic input]
  2. preserve
  3. [clinic start generated code]*/
  4. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  5. # include "pycore_gc.h" // PyGC_Head
  6. # include "pycore_runtime.h" // _Py_ID()
  7. #endif
  8. PyDoc_STRVAR(test_empty_function__doc__,
  9. "test_empty_function($module, /)\n"
  10. "--\n"
  11. "\n");
  12. #define TEST_EMPTY_FUNCTION_METHODDEF \
  13. {"test_empty_function", (PyCFunction)test_empty_function, METH_NOARGS, test_empty_function__doc__},
  14. static PyObject *
  15. test_empty_function_impl(PyObject *module);
  16. static PyObject *
  17. test_empty_function(PyObject *module, PyObject *Py_UNUSED(ignored))
  18. {
  19. return test_empty_function_impl(module);
  20. }
  21. PyDoc_STRVAR(objects_converter__doc__,
  22. "objects_converter($module, a, b=<unrepresentable>, /)\n"
  23. "--\n"
  24. "\n");
  25. #define OBJECTS_CONVERTER_METHODDEF \
  26. {"objects_converter", _PyCFunction_CAST(objects_converter), METH_FASTCALL, objects_converter__doc__},
  27. static PyObject *
  28. objects_converter_impl(PyObject *module, PyObject *a, PyObject *b);
  29. static PyObject *
  30. objects_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  31. {
  32. PyObject *return_value = NULL;
  33. PyObject *a;
  34. PyObject *b = NULL;
  35. if (!_PyArg_CheckPositional("objects_converter", nargs, 1, 2)) {
  36. goto exit;
  37. }
  38. a = args[0];
  39. if (nargs < 2) {
  40. goto skip_optional;
  41. }
  42. b = args[1];
  43. skip_optional:
  44. return_value = objects_converter_impl(module, a, b);
  45. exit:
  46. return return_value;
  47. }
  48. PyDoc_STRVAR(bytes_object_converter__doc__,
  49. "bytes_object_converter($module, a, /)\n"
  50. "--\n"
  51. "\n");
  52. #define BYTES_OBJECT_CONVERTER_METHODDEF \
  53. {"bytes_object_converter", (PyCFunction)bytes_object_converter, METH_O, bytes_object_converter__doc__},
  54. static PyObject *
  55. bytes_object_converter_impl(PyObject *module, PyBytesObject *a);
  56. static PyObject *
  57. bytes_object_converter(PyObject *module, PyObject *arg)
  58. {
  59. PyObject *return_value = NULL;
  60. PyBytesObject *a;
  61. if (!PyBytes_Check(arg)) {
  62. _PyArg_BadArgument("bytes_object_converter", "argument", "bytes", arg);
  63. goto exit;
  64. }
  65. a = (PyBytesObject *)arg;
  66. return_value = bytes_object_converter_impl(module, a);
  67. exit:
  68. return return_value;
  69. }
  70. PyDoc_STRVAR(byte_array_object_converter__doc__,
  71. "byte_array_object_converter($module, a, /)\n"
  72. "--\n"
  73. "\n");
  74. #define BYTE_ARRAY_OBJECT_CONVERTER_METHODDEF \
  75. {"byte_array_object_converter", (PyCFunction)byte_array_object_converter, METH_O, byte_array_object_converter__doc__},
  76. static PyObject *
  77. byte_array_object_converter_impl(PyObject *module, PyByteArrayObject *a);
  78. static PyObject *
  79. byte_array_object_converter(PyObject *module, PyObject *arg)
  80. {
  81. PyObject *return_value = NULL;
  82. PyByteArrayObject *a;
  83. if (!PyByteArray_Check(arg)) {
  84. _PyArg_BadArgument("byte_array_object_converter", "argument", "bytearray", arg);
  85. goto exit;
  86. }
  87. a = (PyByteArrayObject *)arg;
  88. return_value = byte_array_object_converter_impl(module, a);
  89. exit:
  90. return return_value;
  91. }
  92. PyDoc_STRVAR(unicode_converter__doc__,
  93. "unicode_converter($module, a, /)\n"
  94. "--\n"
  95. "\n");
  96. #define UNICODE_CONVERTER_METHODDEF \
  97. {"unicode_converter", (PyCFunction)unicode_converter, METH_O, unicode_converter__doc__},
  98. static PyObject *
  99. unicode_converter_impl(PyObject *module, PyObject *a);
  100. static PyObject *
  101. unicode_converter(PyObject *module, PyObject *arg)
  102. {
  103. PyObject *return_value = NULL;
  104. PyObject *a;
  105. if (!PyUnicode_Check(arg)) {
  106. _PyArg_BadArgument("unicode_converter", "argument", "str", arg);
  107. goto exit;
  108. }
  109. if (PyUnicode_READY(arg) == -1) {
  110. goto exit;
  111. }
  112. a = arg;
  113. return_value = unicode_converter_impl(module, a);
  114. exit:
  115. return return_value;
  116. }
  117. PyDoc_STRVAR(bool_converter__doc__,
  118. "bool_converter($module, a=True, b=True, c=True, /)\n"
  119. "--\n"
  120. "\n");
  121. #define BOOL_CONVERTER_METHODDEF \
  122. {"bool_converter", _PyCFunction_CAST(bool_converter), METH_FASTCALL, bool_converter__doc__},
  123. static PyObject *
  124. bool_converter_impl(PyObject *module, int a, int b, int c);
  125. static PyObject *
  126. bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  127. {
  128. PyObject *return_value = NULL;
  129. int a = 1;
  130. int b = 1;
  131. int c = 1;
  132. if (!_PyArg_CheckPositional("bool_converter", nargs, 0, 3)) {
  133. goto exit;
  134. }
  135. if (nargs < 1) {
  136. goto skip_optional;
  137. }
  138. a = PyObject_IsTrue(args[0]);
  139. if (a < 0) {
  140. goto exit;
  141. }
  142. if (nargs < 2) {
  143. goto skip_optional;
  144. }
  145. b = PyObject_IsTrue(args[1]);
  146. if (b < 0) {
  147. goto exit;
  148. }
  149. if (nargs < 3) {
  150. goto skip_optional;
  151. }
  152. c = _PyLong_AsInt(args[2]);
  153. if (c == -1 && PyErr_Occurred()) {
  154. goto exit;
  155. }
  156. skip_optional:
  157. return_value = bool_converter_impl(module, a, b, c);
  158. exit:
  159. return return_value;
  160. }
  161. PyDoc_STRVAR(char_converter__doc__,
  162. "char_converter($module, a=b\'A\', b=b\'\\x07\', c=b\'\\x08\', d=b\'\\t\', e=b\'\\n\',\n"
  163. " f=b\'\\x0b\', g=b\'\\x0c\', h=b\'\\r\', i=b\'\"\', j=b\"\'\", k=b\'?\',\n"
  164. " l=b\'\\\\\', m=b\'\\x00\', n=b\'\\xff\', /)\n"
  165. "--\n"
  166. "\n");
  167. #define CHAR_CONVERTER_METHODDEF \
  168. {"char_converter", _PyCFunction_CAST(char_converter), METH_FASTCALL, char_converter__doc__},
  169. static PyObject *
  170. char_converter_impl(PyObject *module, char a, char b, char c, char d, char e,
  171. char f, char g, char h, char i, char j, char k, char l,
  172. char m, char n);
  173. static PyObject *
  174. char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  175. {
  176. PyObject *return_value = NULL;
  177. char a = 'A';
  178. char b = '\x07';
  179. char c = '\x08';
  180. char d = '\t';
  181. char e = '\n';
  182. char f = '\x0b';
  183. char g = '\x0c';
  184. char h = '\r';
  185. char i = '"';
  186. char j = '\'';
  187. char k = '?';
  188. char l = '\\';
  189. char m = '\x00';
  190. char n = '\xff';
  191. if (!_PyArg_CheckPositional("char_converter", nargs, 0, 14)) {
  192. goto exit;
  193. }
  194. if (nargs < 1) {
  195. goto skip_optional;
  196. }
  197. if (PyBytes_Check(args[0]) && PyBytes_GET_SIZE(args[0]) == 1) {
  198. a = PyBytes_AS_STRING(args[0])[0];
  199. }
  200. else if (PyByteArray_Check(args[0]) && PyByteArray_GET_SIZE(args[0]) == 1) {
  201. a = PyByteArray_AS_STRING(args[0])[0];
  202. }
  203. else {
  204. _PyArg_BadArgument("char_converter", "argument 1", "a byte string of length 1", args[0]);
  205. goto exit;
  206. }
  207. if (nargs < 2) {
  208. goto skip_optional;
  209. }
  210. if (PyBytes_Check(args[1]) && PyBytes_GET_SIZE(args[1]) == 1) {
  211. b = PyBytes_AS_STRING(args[1])[0];
  212. }
  213. else if (PyByteArray_Check(args[1]) && PyByteArray_GET_SIZE(args[1]) == 1) {
  214. b = PyByteArray_AS_STRING(args[1])[0];
  215. }
  216. else {
  217. _PyArg_BadArgument("char_converter", "argument 2", "a byte string of length 1", args[1]);
  218. goto exit;
  219. }
  220. if (nargs < 3) {
  221. goto skip_optional;
  222. }
  223. if (PyBytes_Check(args[2]) && PyBytes_GET_SIZE(args[2]) == 1) {
  224. c = PyBytes_AS_STRING(args[2])[0];
  225. }
  226. else if (PyByteArray_Check(args[2]) && PyByteArray_GET_SIZE(args[2]) == 1) {
  227. c = PyByteArray_AS_STRING(args[2])[0];
  228. }
  229. else {
  230. _PyArg_BadArgument("char_converter", "argument 3", "a byte string of length 1", args[2]);
  231. goto exit;
  232. }
  233. if (nargs < 4) {
  234. goto skip_optional;
  235. }
  236. if (PyBytes_Check(args[3]) && PyBytes_GET_SIZE(args[3]) == 1) {
  237. d = PyBytes_AS_STRING(args[3])[0];
  238. }
  239. else if (PyByteArray_Check(args[3]) && PyByteArray_GET_SIZE(args[3]) == 1) {
  240. d = PyByteArray_AS_STRING(args[3])[0];
  241. }
  242. else {
  243. _PyArg_BadArgument("char_converter", "argument 4", "a byte string of length 1", args[3]);
  244. goto exit;
  245. }
  246. if (nargs < 5) {
  247. goto skip_optional;
  248. }
  249. if (PyBytes_Check(args[4]) && PyBytes_GET_SIZE(args[4]) == 1) {
  250. e = PyBytes_AS_STRING(args[4])[0];
  251. }
  252. else if (PyByteArray_Check(args[4]) && PyByteArray_GET_SIZE(args[4]) == 1) {
  253. e = PyByteArray_AS_STRING(args[4])[0];
  254. }
  255. else {
  256. _PyArg_BadArgument("char_converter", "argument 5", "a byte string of length 1", args[4]);
  257. goto exit;
  258. }
  259. if (nargs < 6) {
  260. goto skip_optional;
  261. }
  262. if (PyBytes_Check(args[5]) && PyBytes_GET_SIZE(args[5]) == 1) {
  263. f = PyBytes_AS_STRING(args[5])[0];
  264. }
  265. else if (PyByteArray_Check(args[5]) && PyByteArray_GET_SIZE(args[5]) == 1) {
  266. f = PyByteArray_AS_STRING(args[5])[0];
  267. }
  268. else {
  269. _PyArg_BadArgument("char_converter", "argument 6", "a byte string of length 1", args[5]);
  270. goto exit;
  271. }
  272. if (nargs < 7) {
  273. goto skip_optional;
  274. }
  275. if (PyBytes_Check(args[6]) && PyBytes_GET_SIZE(args[6]) == 1) {
  276. g = PyBytes_AS_STRING(args[6])[0];
  277. }
  278. else if (PyByteArray_Check(args[6]) && PyByteArray_GET_SIZE(args[6]) == 1) {
  279. g = PyByteArray_AS_STRING(args[6])[0];
  280. }
  281. else {
  282. _PyArg_BadArgument("char_converter", "argument 7", "a byte string of length 1", args[6]);
  283. goto exit;
  284. }
  285. if (nargs < 8) {
  286. goto skip_optional;
  287. }
  288. if (PyBytes_Check(args[7]) && PyBytes_GET_SIZE(args[7]) == 1) {
  289. h = PyBytes_AS_STRING(args[7])[0];
  290. }
  291. else if (PyByteArray_Check(args[7]) && PyByteArray_GET_SIZE(args[7]) == 1) {
  292. h = PyByteArray_AS_STRING(args[7])[0];
  293. }
  294. else {
  295. _PyArg_BadArgument("char_converter", "argument 8", "a byte string of length 1", args[7]);
  296. goto exit;
  297. }
  298. if (nargs < 9) {
  299. goto skip_optional;
  300. }
  301. if (PyBytes_Check(args[8]) && PyBytes_GET_SIZE(args[8]) == 1) {
  302. i = PyBytes_AS_STRING(args[8])[0];
  303. }
  304. else if (PyByteArray_Check(args[8]) && PyByteArray_GET_SIZE(args[8]) == 1) {
  305. i = PyByteArray_AS_STRING(args[8])[0];
  306. }
  307. else {
  308. _PyArg_BadArgument("char_converter", "argument 9", "a byte string of length 1", args[8]);
  309. goto exit;
  310. }
  311. if (nargs < 10) {
  312. goto skip_optional;
  313. }
  314. if (PyBytes_Check(args[9]) && PyBytes_GET_SIZE(args[9]) == 1) {
  315. j = PyBytes_AS_STRING(args[9])[0];
  316. }
  317. else if (PyByteArray_Check(args[9]) && PyByteArray_GET_SIZE(args[9]) == 1) {
  318. j = PyByteArray_AS_STRING(args[9])[0];
  319. }
  320. else {
  321. _PyArg_BadArgument("char_converter", "argument 10", "a byte string of length 1", args[9]);
  322. goto exit;
  323. }
  324. if (nargs < 11) {
  325. goto skip_optional;
  326. }
  327. if (PyBytes_Check(args[10]) && PyBytes_GET_SIZE(args[10]) == 1) {
  328. k = PyBytes_AS_STRING(args[10])[0];
  329. }
  330. else if (PyByteArray_Check(args[10]) && PyByteArray_GET_SIZE(args[10]) == 1) {
  331. k = PyByteArray_AS_STRING(args[10])[0];
  332. }
  333. else {
  334. _PyArg_BadArgument("char_converter", "argument 11", "a byte string of length 1", args[10]);
  335. goto exit;
  336. }
  337. if (nargs < 12) {
  338. goto skip_optional;
  339. }
  340. if (PyBytes_Check(args[11]) && PyBytes_GET_SIZE(args[11]) == 1) {
  341. l = PyBytes_AS_STRING(args[11])[0];
  342. }
  343. else if (PyByteArray_Check(args[11]) && PyByteArray_GET_SIZE(args[11]) == 1) {
  344. l = PyByteArray_AS_STRING(args[11])[0];
  345. }
  346. else {
  347. _PyArg_BadArgument("char_converter", "argument 12", "a byte string of length 1", args[11]);
  348. goto exit;
  349. }
  350. if (nargs < 13) {
  351. goto skip_optional;
  352. }
  353. if (PyBytes_Check(args[12]) && PyBytes_GET_SIZE(args[12]) == 1) {
  354. m = PyBytes_AS_STRING(args[12])[0];
  355. }
  356. else if (PyByteArray_Check(args[12]) && PyByteArray_GET_SIZE(args[12]) == 1) {
  357. m = PyByteArray_AS_STRING(args[12])[0];
  358. }
  359. else {
  360. _PyArg_BadArgument("char_converter", "argument 13", "a byte string of length 1", args[12]);
  361. goto exit;
  362. }
  363. if (nargs < 14) {
  364. goto skip_optional;
  365. }
  366. if (PyBytes_Check(args[13]) && PyBytes_GET_SIZE(args[13]) == 1) {
  367. n = PyBytes_AS_STRING(args[13])[0];
  368. }
  369. else if (PyByteArray_Check(args[13]) && PyByteArray_GET_SIZE(args[13]) == 1) {
  370. n = PyByteArray_AS_STRING(args[13])[0];
  371. }
  372. else {
  373. _PyArg_BadArgument("char_converter", "argument 14", "a byte string of length 1", args[13]);
  374. goto exit;
  375. }
  376. skip_optional:
  377. return_value = char_converter_impl(module, a, b, c, d, e, f, g, h, i, j, k, l, m, n);
  378. exit:
  379. return return_value;
  380. }
  381. PyDoc_STRVAR(unsigned_char_converter__doc__,
  382. "unsigned_char_converter($module, a=12, b=34, c=56, /)\n"
  383. "--\n"
  384. "\n");
  385. #define UNSIGNED_CHAR_CONVERTER_METHODDEF \
  386. {"unsigned_char_converter", _PyCFunction_CAST(unsigned_char_converter), METH_FASTCALL, unsigned_char_converter__doc__},
  387. static PyObject *
  388. unsigned_char_converter_impl(PyObject *module, unsigned char a,
  389. unsigned char b, unsigned char c);
  390. static PyObject *
  391. unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  392. {
  393. PyObject *return_value = NULL;
  394. unsigned char a = 12;
  395. unsigned char b = 34;
  396. unsigned char c = 56;
  397. if (!_PyArg_CheckPositional("unsigned_char_converter", nargs, 0, 3)) {
  398. goto exit;
  399. }
  400. if (nargs < 1) {
  401. goto skip_optional;
  402. }
  403. {
  404. long ival = PyLong_AsLong(args[0]);
  405. if (ival == -1 && PyErr_Occurred()) {
  406. goto exit;
  407. }
  408. else if (ival < 0) {
  409. PyErr_SetString(PyExc_OverflowError,
  410. "unsigned byte integer is less than minimum");
  411. goto exit;
  412. }
  413. else if (ival > UCHAR_MAX) {
  414. PyErr_SetString(PyExc_OverflowError,
  415. "unsigned byte integer is greater than maximum");
  416. goto exit;
  417. }
  418. else {
  419. a = (unsigned char) ival;
  420. }
  421. }
  422. if (nargs < 2) {
  423. goto skip_optional;
  424. }
  425. {
  426. long ival = PyLong_AsLong(args[1]);
  427. if (ival == -1 && PyErr_Occurred()) {
  428. goto exit;
  429. }
  430. else if (ival < 0) {
  431. PyErr_SetString(PyExc_OverflowError,
  432. "unsigned byte integer is less than minimum");
  433. goto exit;
  434. }
  435. else if (ival > UCHAR_MAX) {
  436. PyErr_SetString(PyExc_OverflowError,
  437. "unsigned byte integer is greater than maximum");
  438. goto exit;
  439. }
  440. else {
  441. b = (unsigned char) ival;
  442. }
  443. }
  444. if (nargs < 3) {
  445. goto skip_optional;
  446. }
  447. {
  448. unsigned long ival = PyLong_AsUnsignedLongMask(args[2]);
  449. if (ival == (unsigned long)-1 && PyErr_Occurred()) {
  450. goto exit;
  451. }
  452. else {
  453. c = (unsigned char) ival;
  454. }
  455. }
  456. skip_optional:
  457. return_value = unsigned_char_converter_impl(module, a, b, c);
  458. exit:
  459. return return_value;
  460. }
  461. PyDoc_STRVAR(short_converter__doc__,
  462. "short_converter($module, a=12, /)\n"
  463. "--\n"
  464. "\n");
  465. #define SHORT_CONVERTER_METHODDEF \
  466. {"short_converter", _PyCFunction_CAST(short_converter), METH_FASTCALL, short_converter__doc__},
  467. static PyObject *
  468. short_converter_impl(PyObject *module, short a);
  469. static PyObject *
  470. short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  471. {
  472. PyObject *return_value = NULL;
  473. short a = 12;
  474. if (!_PyArg_CheckPositional("short_converter", nargs, 0, 1)) {
  475. goto exit;
  476. }
  477. if (nargs < 1) {
  478. goto skip_optional;
  479. }
  480. {
  481. long ival = PyLong_AsLong(args[0]);
  482. if (ival == -1 && PyErr_Occurred()) {
  483. goto exit;
  484. }
  485. else if (ival < SHRT_MIN) {
  486. PyErr_SetString(PyExc_OverflowError,
  487. "signed short integer is less than minimum");
  488. goto exit;
  489. }
  490. else if (ival > SHRT_MAX) {
  491. PyErr_SetString(PyExc_OverflowError,
  492. "signed short integer is greater than maximum");
  493. goto exit;
  494. }
  495. else {
  496. a = (short) ival;
  497. }
  498. }
  499. skip_optional:
  500. return_value = short_converter_impl(module, a);
  501. exit:
  502. return return_value;
  503. }
  504. PyDoc_STRVAR(unsigned_short_converter__doc__,
  505. "unsigned_short_converter($module, a=12, b=34, c=56, /)\n"
  506. "--\n"
  507. "\n");
  508. #define UNSIGNED_SHORT_CONVERTER_METHODDEF \
  509. {"unsigned_short_converter", _PyCFunction_CAST(unsigned_short_converter), METH_FASTCALL, unsigned_short_converter__doc__},
  510. static PyObject *
  511. unsigned_short_converter_impl(PyObject *module, unsigned short a,
  512. unsigned short b, unsigned short c);
  513. static PyObject *
  514. unsigned_short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  515. {
  516. PyObject *return_value = NULL;
  517. unsigned short a = 12;
  518. unsigned short b = 34;
  519. unsigned short c = 56;
  520. if (!_PyArg_CheckPositional("unsigned_short_converter", nargs, 0, 3)) {
  521. goto exit;
  522. }
  523. if (nargs < 1) {
  524. goto skip_optional;
  525. }
  526. if (!_PyLong_UnsignedShort_Converter(args[0], &a)) {
  527. goto exit;
  528. }
  529. if (nargs < 2) {
  530. goto skip_optional;
  531. }
  532. if (!_PyLong_UnsignedShort_Converter(args[1], &b)) {
  533. goto exit;
  534. }
  535. if (nargs < 3) {
  536. goto skip_optional;
  537. }
  538. c = (unsigned short)PyLong_AsUnsignedLongMask(args[2]);
  539. if (c == (unsigned short)-1 && PyErr_Occurred()) {
  540. goto exit;
  541. }
  542. skip_optional:
  543. return_value = unsigned_short_converter_impl(module, a, b, c);
  544. exit:
  545. return return_value;
  546. }
  547. PyDoc_STRVAR(int_converter__doc__,
  548. "int_converter($module, a=12, b=34, c=45, /)\n"
  549. "--\n"
  550. "\n");
  551. #define INT_CONVERTER_METHODDEF \
  552. {"int_converter", _PyCFunction_CAST(int_converter), METH_FASTCALL, int_converter__doc__},
  553. static PyObject *
  554. int_converter_impl(PyObject *module, int a, int b, int c);
  555. static PyObject *
  556. int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  557. {
  558. PyObject *return_value = NULL;
  559. int a = 12;
  560. int b = 34;
  561. int c = 45;
  562. if (!_PyArg_CheckPositional("int_converter", nargs, 0, 3)) {
  563. goto exit;
  564. }
  565. if (nargs < 1) {
  566. goto skip_optional;
  567. }
  568. a = _PyLong_AsInt(args[0]);
  569. if (a == -1 && PyErr_Occurred()) {
  570. goto exit;
  571. }
  572. if (nargs < 2) {
  573. goto skip_optional;
  574. }
  575. b = _PyLong_AsInt(args[1]);
  576. if (b == -1 && PyErr_Occurred()) {
  577. goto exit;
  578. }
  579. if (nargs < 3) {
  580. goto skip_optional;
  581. }
  582. if (!PyUnicode_Check(args[2])) {
  583. _PyArg_BadArgument("int_converter", "argument 3", "a unicode character", args[2]);
  584. goto exit;
  585. }
  586. if (PyUnicode_READY(args[2])) {
  587. goto exit;
  588. }
  589. if (PyUnicode_GET_LENGTH(args[2]) != 1) {
  590. _PyArg_BadArgument("int_converter", "argument 3", "a unicode character", args[2]);
  591. goto exit;
  592. }
  593. c = PyUnicode_READ_CHAR(args[2], 0);
  594. skip_optional:
  595. return_value = int_converter_impl(module, a, b, c);
  596. exit:
  597. return return_value;
  598. }
  599. PyDoc_STRVAR(unsigned_int_converter__doc__,
  600. "unsigned_int_converter($module, a=12, b=34, c=56, /)\n"
  601. "--\n"
  602. "\n");
  603. #define UNSIGNED_INT_CONVERTER_METHODDEF \
  604. {"unsigned_int_converter", _PyCFunction_CAST(unsigned_int_converter), METH_FASTCALL, unsigned_int_converter__doc__},
  605. static PyObject *
  606. unsigned_int_converter_impl(PyObject *module, unsigned int a, unsigned int b,
  607. unsigned int c);
  608. static PyObject *
  609. unsigned_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  610. {
  611. PyObject *return_value = NULL;
  612. unsigned int a = 12;
  613. unsigned int b = 34;
  614. unsigned int c = 56;
  615. if (!_PyArg_CheckPositional("unsigned_int_converter", nargs, 0, 3)) {
  616. goto exit;
  617. }
  618. if (nargs < 1) {
  619. goto skip_optional;
  620. }
  621. if (!_PyLong_UnsignedInt_Converter(args[0], &a)) {
  622. goto exit;
  623. }
  624. if (nargs < 2) {
  625. goto skip_optional;
  626. }
  627. if (!_PyLong_UnsignedInt_Converter(args[1], &b)) {
  628. goto exit;
  629. }
  630. if (nargs < 3) {
  631. goto skip_optional;
  632. }
  633. c = (unsigned int)PyLong_AsUnsignedLongMask(args[2]);
  634. if (c == (unsigned int)-1 && PyErr_Occurred()) {
  635. goto exit;
  636. }
  637. skip_optional:
  638. return_value = unsigned_int_converter_impl(module, a, b, c);
  639. exit:
  640. return return_value;
  641. }
  642. PyDoc_STRVAR(long_converter__doc__,
  643. "long_converter($module, a=12, /)\n"
  644. "--\n"
  645. "\n");
  646. #define LONG_CONVERTER_METHODDEF \
  647. {"long_converter", _PyCFunction_CAST(long_converter), METH_FASTCALL, long_converter__doc__},
  648. static PyObject *
  649. long_converter_impl(PyObject *module, long a);
  650. static PyObject *
  651. long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  652. {
  653. PyObject *return_value = NULL;
  654. long a = 12;
  655. if (!_PyArg_CheckPositional("long_converter", nargs, 0, 1)) {
  656. goto exit;
  657. }
  658. if (nargs < 1) {
  659. goto skip_optional;
  660. }
  661. a = PyLong_AsLong(args[0]);
  662. if (a == -1 && PyErr_Occurred()) {
  663. goto exit;
  664. }
  665. skip_optional:
  666. return_value = long_converter_impl(module, a);
  667. exit:
  668. return return_value;
  669. }
  670. PyDoc_STRVAR(unsigned_long_converter__doc__,
  671. "unsigned_long_converter($module, a=12, b=34, c=56, /)\n"
  672. "--\n"
  673. "\n");
  674. #define UNSIGNED_LONG_CONVERTER_METHODDEF \
  675. {"unsigned_long_converter", _PyCFunction_CAST(unsigned_long_converter), METH_FASTCALL, unsigned_long_converter__doc__},
  676. static PyObject *
  677. unsigned_long_converter_impl(PyObject *module, unsigned long a,
  678. unsigned long b, unsigned long c);
  679. static PyObject *
  680. unsigned_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  681. {
  682. PyObject *return_value = NULL;
  683. unsigned long a = 12;
  684. unsigned long b = 34;
  685. unsigned long c = 56;
  686. if (!_PyArg_CheckPositional("unsigned_long_converter", nargs, 0, 3)) {
  687. goto exit;
  688. }
  689. if (nargs < 1) {
  690. goto skip_optional;
  691. }
  692. if (!_PyLong_UnsignedLong_Converter(args[0], &a)) {
  693. goto exit;
  694. }
  695. if (nargs < 2) {
  696. goto skip_optional;
  697. }
  698. if (!_PyLong_UnsignedLong_Converter(args[1], &b)) {
  699. goto exit;
  700. }
  701. if (nargs < 3) {
  702. goto skip_optional;
  703. }
  704. if (!PyLong_Check(args[2])) {
  705. _PyArg_BadArgument("unsigned_long_converter", "argument 3", "int", args[2]);
  706. goto exit;
  707. }
  708. c = PyLong_AsUnsignedLongMask(args[2]);
  709. skip_optional:
  710. return_value = unsigned_long_converter_impl(module, a, b, c);
  711. exit:
  712. return return_value;
  713. }
  714. PyDoc_STRVAR(long_long_converter__doc__,
  715. "long_long_converter($module, a=12, /)\n"
  716. "--\n"
  717. "\n");
  718. #define LONG_LONG_CONVERTER_METHODDEF \
  719. {"long_long_converter", _PyCFunction_CAST(long_long_converter), METH_FASTCALL, long_long_converter__doc__},
  720. static PyObject *
  721. long_long_converter_impl(PyObject *module, long long a);
  722. static PyObject *
  723. long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  724. {
  725. PyObject *return_value = NULL;
  726. long long a = 12;
  727. if (!_PyArg_CheckPositional("long_long_converter", nargs, 0, 1)) {
  728. goto exit;
  729. }
  730. if (nargs < 1) {
  731. goto skip_optional;
  732. }
  733. a = PyLong_AsLongLong(args[0]);
  734. if (a == -1 && PyErr_Occurred()) {
  735. goto exit;
  736. }
  737. skip_optional:
  738. return_value = long_long_converter_impl(module, a);
  739. exit:
  740. return return_value;
  741. }
  742. PyDoc_STRVAR(unsigned_long_long_converter__doc__,
  743. "unsigned_long_long_converter($module, a=12, b=34, c=56, /)\n"
  744. "--\n"
  745. "\n");
  746. #define UNSIGNED_LONG_LONG_CONVERTER_METHODDEF \
  747. {"unsigned_long_long_converter", _PyCFunction_CAST(unsigned_long_long_converter), METH_FASTCALL, unsigned_long_long_converter__doc__},
  748. static PyObject *
  749. unsigned_long_long_converter_impl(PyObject *module, unsigned long long a,
  750. unsigned long long b, unsigned long long c);
  751. static PyObject *
  752. unsigned_long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  753. {
  754. PyObject *return_value = NULL;
  755. unsigned long long a = 12;
  756. unsigned long long b = 34;
  757. unsigned long long c = 56;
  758. if (!_PyArg_CheckPositional("unsigned_long_long_converter", nargs, 0, 3)) {
  759. goto exit;
  760. }
  761. if (nargs < 1) {
  762. goto skip_optional;
  763. }
  764. if (!_PyLong_UnsignedLongLong_Converter(args[0], &a)) {
  765. goto exit;
  766. }
  767. if (nargs < 2) {
  768. goto skip_optional;
  769. }
  770. if (!_PyLong_UnsignedLongLong_Converter(args[1], &b)) {
  771. goto exit;
  772. }
  773. if (nargs < 3) {
  774. goto skip_optional;
  775. }
  776. if (!PyLong_Check(args[2])) {
  777. _PyArg_BadArgument("unsigned_long_long_converter", "argument 3", "int", args[2]);
  778. goto exit;
  779. }
  780. c = PyLong_AsUnsignedLongLongMask(args[2]);
  781. skip_optional:
  782. return_value = unsigned_long_long_converter_impl(module, a, b, c);
  783. exit:
  784. return return_value;
  785. }
  786. PyDoc_STRVAR(py_ssize_t_converter__doc__,
  787. "py_ssize_t_converter($module, a=12, b=34, c=56, /)\n"
  788. "--\n"
  789. "\n");
  790. #define PY_SSIZE_T_CONVERTER_METHODDEF \
  791. {"py_ssize_t_converter", _PyCFunction_CAST(py_ssize_t_converter), METH_FASTCALL, py_ssize_t_converter__doc__},
  792. static PyObject *
  793. py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
  794. Py_ssize_t c);
  795. static PyObject *
  796. py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  797. {
  798. PyObject *return_value = NULL;
  799. Py_ssize_t a = 12;
  800. Py_ssize_t b = 34;
  801. Py_ssize_t c = 56;
  802. if (!_PyArg_CheckPositional("py_ssize_t_converter", nargs, 0, 3)) {
  803. goto exit;
  804. }
  805. if (nargs < 1) {
  806. goto skip_optional;
  807. }
  808. {
  809. Py_ssize_t ival = -1;
  810. PyObject *iobj = _PyNumber_Index(args[0]);
  811. if (iobj != NULL) {
  812. ival = PyLong_AsSsize_t(iobj);
  813. Py_DECREF(iobj);
  814. }
  815. if (ival == -1 && PyErr_Occurred()) {
  816. goto exit;
  817. }
  818. a = ival;
  819. }
  820. if (nargs < 2) {
  821. goto skip_optional;
  822. }
  823. {
  824. Py_ssize_t ival = -1;
  825. PyObject *iobj = _PyNumber_Index(args[1]);
  826. if (iobj != NULL) {
  827. ival = PyLong_AsSsize_t(iobj);
  828. Py_DECREF(iobj);
  829. }
  830. if (ival == -1 && PyErr_Occurred()) {
  831. goto exit;
  832. }
  833. b = ival;
  834. }
  835. if (nargs < 3) {
  836. goto skip_optional;
  837. }
  838. if (!_Py_convert_optional_to_ssize_t(args[2], &c)) {
  839. goto exit;
  840. }
  841. skip_optional:
  842. return_value = py_ssize_t_converter_impl(module, a, b, c);
  843. exit:
  844. return return_value;
  845. }
  846. PyDoc_STRVAR(slice_index_converter__doc__,
  847. "slice_index_converter($module, a=12, b=34, c=56, /)\n"
  848. "--\n"
  849. "\n");
  850. #define SLICE_INDEX_CONVERTER_METHODDEF \
  851. {"slice_index_converter", _PyCFunction_CAST(slice_index_converter), METH_FASTCALL, slice_index_converter__doc__},
  852. static PyObject *
  853. slice_index_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
  854. Py_ssize_t c);
  855. static PyObject *
  856. slice_index_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  857. {
  858. PyObject *return_value = NULL;
  859. Py_ssize_t a = 12;
  860. Py_ssize_t b = 34;
  861. Py_ssize_t c = 56;
  862. if (!_PyArg_CheckPositional("slice_index_converter", nargs, 0, 3)) {
  863. goto exit;
  864. }
  865. if (nargs < 1) {
  866. goto skip_optional;
  867. }
  868. if (!_PyEval_SliceIndex(args[0], &a)) {
  869. goto exit;
  870. }
  871. if (nargs < 2) {
  872. goto skip_optional;
  873. }
  874. if (!_PyEval_SliceIndexNotNone(args[1], &b)) {
  875. goto exit;
  876. }
  877. if (nargs < 3) {
  878. goto skip_optional;
  879. }
  880. if (!_PyEval_SliceIndex(args[2], &c)) {
  881. goto exit;
  882. }
  883. skip_optional:
  884. return_value = slice_index_converter_impl(module, a, b, c);
  885. exit:
  886. return return_value;
  887. }
  888. PyDoc_STRVAR(size_t_converter__doc__,
  889. "size_t_converter($module, a=12, /)\n"
  890. "--\n"
  891. "\n");
  892. #define SIZE_T_CONVERTER_METHODDEF \
  893. {"size_t_converter", _PyCFunction_CAST(size_t_converter), METH_FASTCALL, size_t_converter__doc__},
  894. static PyObject *
  895. size_t_converter_impl(PyObject *module, size_t a);
  896. static PyObject *
  897. size_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  898. {
  899. PyObject *return_value = NULL;
  900. size_t a = 12;
  901. if (!_PyArg_CheckPositional("size_t_converter", nargs, 0, 1)) {
  902. goto exit;
  903. }
  904. if (nargs < 1) {
  905. goto skip_optional;
  906. }
  907. if (!_PyLong_Size_t_Converter(args[0], &a)) {
  908. goto exit;
  909. }
  910. skip_optional:
  911. return_value = size_t_converter_impl(module, a);
  912. exit:
  913. return return_value;
  914. }
  915. PyDoc_STRVAR(float_converter__doc__,
  916. "float_converter($module, a=12.5, /)\n"
  917. "--\n"
  918. "\n");
  919. #define FLOAT_CONVERTER_METHODDEF \
  920. {"float_converter", _PyCFunction_CAST(float_converter), METH_FASTCALL, float_converter__doc__},
  921. static PyObject *
  922. float_converter_impl(PyObject *module, float a);
  923. static PyObject *
  924. float_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  925. {
  926. PyObject *return_value = NULL;
  927. float a = 12.5;
  928. if (!_PyArg_CheckPositional("float_converter", nargs, 0, 1)) {
  929. goto exit;
  930. }
  931. if (nargs < 1) {
  932. goto skip_optional;
  933. }
  934. if (PyFloat_CheckExact(args[0])) {
  935. a = (float) (PyFloat_AS_DOUBLE(args[0]));
  936. }
  937. else
  938. {
  939. a = (float) PyFloat_AsDouble(args[0]);
  940. if (a == -1.0 && PyErr_Occurred()) {
  941. goto exit;
  942. }
  943. }
  944. skip_optional:
  945. return_value = float_converter_impl(module, a);
  946. exit:
  947. return return_value;
  948. }
  949. PyDoc_STRVAR(double_converter__doc__,
  950. "double_converter($module, a=12.5, /)\n"
  951. "--\n"
  952. "\n");
  953. #define DOUBLE_CONVERTER_METHODDEF \
  954. {"double_converter", _PyCFunction_CAST(double_converter), METH_FASTCALL, double_converter__doc__},
  955. static PyObject *
  956. double_converter_impl(PyObject *module, double a);
  957. static PyObject *
  958. double_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  959. {
  960. PyObject *return_value = NULL;
  961. double a = 12.5;
  962. if (!_PyArg_CheckPositional("double_converter", nargs, 0, 1)) {
  963. goto exit;
  964. }
  965. if (nargs < 1) {
  966. goto skip_optional;
  967. }
  968. if (PyFloat_CheckExact(args[0])) {
  969. a = PyFloat_AS_DOUBLE(args[0]);
  970. }
  971. else
  972. {
  973. a = PyFloat_AsDouble(args[0]);
  974. if (a == -1.0 && PyErr_Occurred()) {
  975. goto exit;
  976. }
  977. }
  978. skip_optional:
  979. return_value = double_converter_impl(module, a);
  980. exit:
  981. return return_value;
  982. }
  983. PyDoc_STRVAR(py_complex_converter__doc__,
  984. "py_complex_converter($module, a, /)\n"
  985. "--\n"
  986. "\n");
  987. #define PY_COMPLEX_CONVERTER_METHODDEF \
  988. {"py_complex_converter", (PyCFunction)py_complex_converter, METH_O, py_complex_converter__doc__},
  989. static PyObject *
  990. py_complex_converter_impl(PyObject *module, Py_complex a);
  991. static PyObject *
  992. py_complex_converter(PyObject *module, PyObject *arg)
  993. {
  994. PyObject *return_value = NULL;
  995. Py_complex a;
  996. a = PyComplex_AsCComplex(arg);
  997. if (PyErr_Occurred()) {
  998. goto exit;
  999. }
  1000. return_value = py_complex_converter_impl(module, a);
  1001. exit:
  1002. return return_value;
  1003. }
  1004. PyDoc_STRVAR(str_converter__doc__,
  1005. "str_converter($module, a=\'a\', b=\'b\', c=\'c\', /)\n"
  1006. "--\n"
  1007. "\n");
  1008. #define STR_CONVERTER_METHODDEF \
  1009. {"str_converter", _PyCFunction_CAST(str_converter), METH_FASTCALL, str_converter__doc__},
  1010. static PyObject *
  1011. str_converter_impl(PyObject *module, const char *a, const char *b,
  1012. const char *c, Py_ssize_t c_length);
  1013. static PyObject *
  1014. str_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  1015. {
  1016. PyObject *return_value = NULL;
  1017. const char *a = "a";
  1018. const char *b = "b";
  1019. const char *c = "c";
  1020. Py_ssize_t c_length;
  1021. if (!_PyArg_ParseStack(args, nargs, "|sys#:str_converter",
  1022. &a, &b, &c, &c_length)) {
  1023. goto exit;
  1024. }
  1025. return_value = str_converter_impl(module, a, b, c, c_length);
  1026. exit:
  1027. return return_value;
  1028. }
  1029. PyDoc_STRVAR(str_converter_encoding__doc__,
  1030. "str_converter_encoding($module, a, b, c, /)\n"
  1031. "--\n"
  1032. "\n");
  1033. #define STR_CONVERTER_ENCODING_METHODDEF \
  1034. {"str_converter_encoding", _PyCFunction_CAST(str_converter_encoding), METH_FASTCALL, str_converter_encoding__doc__},
  1035. static PyObject *
  1036. str_converter_encoding_impl(PyObject *module, char *a, char *b, char *c,
  1037. Py_ssize_t c_length);
  1038. static PyObject *
  1039. str_converter_encoding(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  1040. {
  1041. PyObject *return_value = NULL;
  1042. char *a = NULL;
  1043. char *b = NULL;
  1044. char *c = NULL;
  1045. Py_ssize_t c_length;
  1046. if (!_PyArg_ParseStack(args, nargs, "esetet#:str_converter_encoding",
  1047. "idna", &a, "idna", &b, "idna", &c, &c_length)) {
  1048. goto exit;
  1049. }
  1050. return_value = str_converter_encoding_impl(module, a, b, c, c_length);
  1051. /* Post parse cleanup for a */
  1052. PyMem_FREE(a);
  1053. /* Post parse cleanup for b */
  1054. PyMem_FREE(b);
  1055. /* Post parse cleanup for c */
  1056. PyMem_FREE(c);
  1057. exit:
  1058. return return_value;
  1059. }
  1060. PyDoc_STRVAR(py_buffer_converter__doc__,
  1061. "py_buffer_converter($module, a, b, /)\n"
  1062. "--\n"
  1063. "\n");
  1064. #define PY_BUFFER_CONVERTER_METHODDEF \
  1065. {"py_buffer_converter", _PyCFunction_CAST(py_buffer_converter), METH_FASTCALL, py_buffer_converter__doc__},
  1066. static PyObject *
  1067. py_buffer_converter_impl(PyObject *module, Py_buffer *a, Py_buffer *b);
  1068. static PyObject *
  1069. py_buffer_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  1070. {
  1071. PyObject *return_value = NULL;
  1072. Py_buffer a = {NULL, NULL};
  1073. Py_buffer b = {NULL, NULL};
  1074. if (!_PyArg_ParseStack(args, nargs, "z*w*:py_buffer_converter",
  1075. &a, &b)) {
  1076. goto exit;
  1077. }
  1078. return_value = py_buffer_converter_impl(module, &a, &b);
  1079. exit:
  1080. /* Cleanup for a */
  1081. if (a.obj) {
  1082. PyBuffer_Release(&a);
  1083. }
  1084. /* Cleanup for b */
  1085. if (b.obj) {
  1086. PyBuffer_Release(&b);
  1087. }
  1088. return return_value;
  1089. }
  1090. PyDoc_STRVAR(keywords__doc__,
  1091. "keywords($module, /, a, b)\n"
  1092. "--\n"
  1093. "\n");
  1094. #define KEYWORDS_METHODDEF \
  1095. {"keywords", _PyCFunction_CAST(keywords), METH_FASTCALL|METH_KEYWORDS, keywords__doc__},
  1096. static PyObject *
  1097. keywords_impl(PyObject *module, PyObject *a, PyObject *b);
  1098. static PyObject *
  1099. keywords(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1100. {
  1101. PyObject *return_value = NULL;
  1102. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1103. #define NUM_KEYWORDS 2
  1104. static struct {
  1105. PyGC_Head _this_is_not_used;
  1106. PyObject_VAR_HEAD
  1107. PyObject *ob_item[NUM_KEYWORDS];
  1108. } _kwtuple = {
  1109. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1110. .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), },
  1111. };
  1112. #undef NUM_KEYWORDS
  1113. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1114. #else // !Py_BUILD_CORE
  1115. # define KWTUPLE NULL
  1116. #endif // !Py_BUILD_CORE
  1117. static const char * const _keywords[] = {"a", "b", NULL};
  1118. static _PyArg_Parser _parser = {
  1119. .keywords = _keywords,
  1120. .fname = "keywords",
  1121. .kwtuple = KWTUPLE,
  1122. };
  1123. #undef KWTUPLE
  1124. PyObject *argsbuf[2];
  1125. PyObject *a;
  1126. PyObject *b;
  1127. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
  1128. if (!args) {
  1129. goto exit;
  1130. }
  1131. a = args[0];
  1132. b = args[1];
  1133. return_value = keywords_impl(module, a, b);
  1134. exit:
  1135. return return_value;
  1136. }
  1137. PyDoc_STRVAR(keywords_kwonly__doc__,
  1138. "keywords_kwonly($module, /, a, *, b)\n"
  1139. "--\n"
  1140. "\n");
  1141. #define KEYWORDS_KWONLY_METHODDEF \
  1142. {"keywords_kwonly", _PyCFunction_CAST(keywords_kwonly), METH_FASTCALL|METH_KEYWORDS, keywords_kwonly__doc__},
  1143. static PyObject *
  1144. keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b);
  1145. static PyObject *
  1146. keywords_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1147. {
  1148. PyObject *return_value = NULL;
  1149. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1150. #define NUM_KEYWORDS 2
  1151. static struct {
  1152. PyGC_Head _this_is_not_used;
  1153. PyObject_VAR_HEAD
  1154. PyObject *ob_item[NUM_KEYWORDS];
  1155. } _kwtuple = {
  1156. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1157. .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), },
  1158. };
  1159. #undef NUM_KEYWORDS
  1160. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1161. #else // !Py_BUILD_CORE
  1162. # define KWTUPLE NULL
  1163. #endif // !Py_BUILD_CORE
  1164. static const char * const _keywords[] = {"a", "b", NULL};
  1165. static _PyArg_Parser _parser = {
  1166. .keywords = _keywords,
  1167. .fname = "keywords_kwonly",
  1168. .kwtuple = KWTUPLE,
  1169. };
  1170. #undef KWTUPLE
  1171. PyObject *argsbuf[2];
  1172. PyObject *a;
  1173. PyObject *b;
  1174. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
  1175. if (!args) {
  1176. goto exit;
  1177. }
  1178. a = args[0];
  1179. b = args[1];
  1180. return_value = keywords_kwonly_impl(module, a, b);
  1181. exit:
  1182. return return_value;
  1183. }
  1184. PyDoc_STRVAR(keywords_opt__doc__,
  1185. "keywords_opt($module, /, a, b=None, c=None)\n"
  1186. "--\n"
  1187. "\n");
  1188. #define KEYWORDS_OPT_METHODDEF \
  1189. {"keywords_opt", _PyCFunction_CAST(keywords_opt), METH_FASTCALL|METH_KEYWORDS, keywords_opt__doc__},
  1190. static PyObject *
  1191. keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b, PyObject *c);
  1192. static PyObject *
  1193. keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1194. {
  1195. PyObject *return_value = NULL;
  1196. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1197. #define NUM_KEYWORDS 3
  1198. static struct {
  1199. PyGC_Head _this_is_not_used;
  1200. PyObject_VAR_HEAD
  1201. PyObject *ob_item[NUM_KEYWORDS];
  1202. } _kwtuple = {
  1203. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1204. .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
  1205. };
  1206. #undef NUM_KEYWORDS
  1207. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1208. #else // !Py_BUILD_CORE
  1209. # define KWTUPLE NULL
  1210. #endif // !Py_BUILD_CORE
  1211. static const char * const _keywords[] = {"a", "b", "c", NULL};
  1212. static _PyArg_Parser _parser = {
  1213. .keywords = _keywords,
  1214. .fname = "keywords_opt",
  1215. .kwtuple = KWTUPLE,
  1216. };
  1217. #undef KWTUPLE
  1218. PyObject *argsbuf[3];
  1219. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  1220. PyObject *a;
  1221. PyObject *b = Py_None;
  1222. PyObject *c = Py_None;
  1223. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
  1224. if (!args) {
  1225. goto exit;
  1226. }
  1227. a = args[0];
  1228. if (!noptargs) {
  1229. goto skip_optional_pos;
  1230. }
  1231. if (args[1]) {
  1232. b = args[1];
  1233. if (!--noptargs) {
  1234. goto skip_optional_pos;
  1235. }
  1236. }
  1237. c = args[2];
  1238. skip_optional_pos:
  1239. return_value = keywords_opt_impl(module, a, b, c);
  1240. exit:
  1241. return return_value;
  1242. }
  1243. PyDoc_STRVAR(keywords_opt_kwonly__doc__,
  1244. "keywords_opt_kwonly($module, /, a, b=None, *, c=None, d=None)\n"
  1245. "--\n"
  1246. "\n");
  1247. #define KEYWORDS_OPT_KWONLY_METHODDEF \
  1248. {"keywords_opt_kwonly", _PyCFunction_CAST(keywords_opt_kwonly), METH_FASTCALL|METH_KEYWORDS, keywords_opt_kwonly__doc__},
  1249. static PyObject *
  1250. keywords_opt_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
  1251. PyObject *c, PyObject *d);
  1252. static PyObject *
  1253. keywords_opt_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1254. {
  1255. PyObject *return_value = NULL;
  1256. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1257. #define NUM_KEYWORDS 4
  1258. static struct {
  1259. PyGC_Head _this_is_not_used;
  1260. PyObject_VAR_HEAD
  1261. PyObject *ob_item[NUM_KEYWORDS];
  1262. } _kwtuple = {
  1263. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1264. .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
  1265. };
  1266. #undef NUM_KEYWORDS
  1267. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1268. #else // !Py_BUILD_CORE
  1269. # define KWTUPLE NULL
  1270. #endif // !Py_BUILD_CORE
  1271. static const char * const _keywords[] = {"a", "b", "c", "d", NULL};
  1272. static _PyArg_Parser _parser = {
  1273. .keywords = _keywords,
  1274. .fname = "keywords_opt_kwonly",
  1275. .kwtuple = KWTUPLE,
  1276. };
  1277. #undef KWTUPLE
  1278. PyObject *argsbuf[4];
  1279. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  1280. PyObject *a;
  1281. PyObject *b = Py_None;
  1282. PyObject *c = Py_None;
  1283. PyObject *d = Py_None;
  1284. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
  1285. if (!args) {
  1286. goto exit;
  1287. }
  1288. a = args[0];
  1289. if (!noptargs) {
  1290. goto skip_optional_pos;
  1291. }
  1292. if (args[1]) {
  1293. b = args[1];
  1294. if (!--noptargs) {
  1295. goto skip_optional_pos;
  1296. }
  1297. }
  1298. skip_optional_pos:
  1299. if (!noptargs) {
  1300. goto skip_optional_kwonly;
  1301. }
  1302. if (args[2]) {
  1303. c = args[2];
  1304. if (!--noptargs) {
  1305. goto skip_optional_kwonly;
  1306. }
  1307. }
  1308. d = args[3];
  1309. skip_optional_kwonly:
  1310. return_value = keywords_opt_kwonly_impl(module, a, b, c, d);
  1311. exit:
  1312. return return_value;
  1313. }
  1314. PyDoc_STRVAR(keywords_kwonly_opt__doc__,
  1315. "keywords_kwonly_opt($module, /, a, *, b=None, c=None)\n"
  1316. "--\n"
  1317. "\n");
  1318. #define KEYWORDS_KWONLY_OPT_METHODDEF \
  1319. {"keywords_kwonly_opt", _PyCFunction_CAST(keywords_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, keywords_kwonly_opt__doc__},
  1320. static PyObject *
  1321. keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
  1322. PyObject *c);
  1323. static PyObject *
  1324. keywords_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1325. {
  1326. PyObject *return_value = NULL;
  1327. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1328. #define NUM_KEYWORDS 3
  1329. static struct {
  1330. PyGC_Head _this_is_not_used;
  1331. PyObject_VAR_HEAD
  1332. PyObject *ob_item[NUM_KEYWORDS];
  1333. } _kwtuple = {
  1334. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1335. .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
  1336. };
  1337. #undef NUM_KEYWORDS
  1338. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1339. #else // !Py_BUILD_CORE
  1340. # define KWTUPLE NULL
  1341. #endif // !Py_BUILD_CORE
  1342. static const char * const _keywords[] = {"a", "b", "c", NULL};
  1343. static _PyArg_Parser _parser = {
  1344. .keywords = _keywords,
  1345. .fname = "keywords_kwonly_opt",
  1346. .kwtuple = KWTUPLE,
  1347. };
  1348. #undef KWTUPLE
  1349. PyObject *argsbuf[3];
  1350. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  1351. PyObject *a;
  1352. PyObject *b = Py_None;
  1353. PyObject *c = Py_None;
  1354. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
  1355. if (!args) {
  1356. goto exit;
  1357. }
  1358. a = args[0];
  1359. if (!noptargs) {
  1360. goto skip_optional_kwonly;
  1361. }
  1362. if (args[1]) {
  1363. b = args[1];
  1364. if (!--noptargs) {
  1365. goto skip_optional_kwonly;
  1366. }
  1367. }
  1368. c = args[2];
  1369. skip_optional_kwonly:
  1370. return_value = keywords_kwonly_opt_impl(module, a, b, c);
  1371. exit:
  1372. return return_value;
  1373. }
  1374. PyDoc_STRVAR(posonly_keywords__doc__,
  1375. "posonly_keywords($module, a, /, b)\n"
  1376. "--\n"
  1377. "\n");
  1378. #define POSONLY_KEYWORDS_METHODDEF \
  1379. {"posonly_keywords", _PyCFunction_CAST(posonly_keywords), METH_FASTCALL|METH_KEYWORDS, posonly_keywords__doc__},
  1380. static PyObject *
  1381. posonly_keywords_impl(PyObject *module, PyObject *a, PyObject *b);
  1382. static PyObject *
  1383. posonly_keywords(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1384. {
  1385. PyObject *return_value = NULL;
  1386. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1387. #define NUM_KEYWORDS 1
  1388. static struct {
  1389. PyGC_Head _this_is_not_used;
  1390. PyObject_VAR_HEAD
  1391. PyObject *ob_item[NUM_KEYWORDS];
  1392. } _kwtuple = {
  1393. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1394. .ob_item = { _Py_LATIN1_CHR('b'), },
  1395. };
  1396. #undef NUM_KEYWORDS
  1397. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1398. #else // !Py_BUILD_CORE
  1399. # define KWTUPLE NULL
  1400. #endif // !Py_BUILD_CORE
  1401. static const char * const _keywords[] = {"", "b", NULL};
  1402. static _PyArg_Parser _parser = {
  1403. .keywords = _keywords,
  1404. .fname = "posonly_keywords",
  1405. .kwtuple = KWTUPLE,
  1406. };
  1407. #undef KWTUPLE
  1408. PyObject *argsbuf[2];
  1409. PyObject *a;
  1410. PyObject *b;
  1411. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
  1412. if (!args) {
  1413. goto exit;
  1414. }
  1415. a = args[0];
  1416. b = args[1];
  1417. return_value = posonly_keywords_impl(module, a, b);
  1418. exit:
  1419. return return_value;
  1420. }
  1421. PyDoc_STRVAR(posonly_kwonly__doc__,
  1422. "posonly_kwonly($module, a, /, *, b)\n"
  1423. "--\n"
  1424. "\n");
  1425. #define POSONLY_KWONLY_METHODDEF \
  1426. {"posonly_kwonly", _PyCFunction_CAST(posonly_kwonly), METH_FASTCALL|METH_KEYWORDS, posonly_kwonly__doc__},
  1427. static PyObject *
  1428. posonly_kwonly_impl(PyObject *module, PyObject *a, PyObject *b);
  1429. static PyObject *
  1430. posonly_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1431. {
  1432. PyObject *return_value = NULL;
  1433. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1434. #define NUM_KEYWORDS 1
  1435. static struct {
  1436. PyGC_Head _this_is_not_used;
  1437. PyObject_VAR_HEAD
  1438. PyObject *ob_item[NUM_KEYWORDS];
  1439. } _kwtuple = {
  1440. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1441. .ob_item = { _Py_LATIN1_CHR('b'), },
  1442. };
  1443. #undef NUM_KEYWORDS
  1444. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1445. #else // !Py_BUILD_CORE
  1446. # define KWTUPLE NULL
  1447. #endif // !Py_BUILD_CORE
  1448. static const char * const _keywords[] = {"", "b", NULL};
  1449. static _PyArg_Parser _parser = {
  1450. .keywords = _keywords,
  1451. .fname = "posonly_kwonly",
  1452. .kwtuple = KWTUPLE,
  1453. };
  1454. #undef KWTUPLE
  1455. PyObject *argsbuf[2];
  1456. PyObject *a;
  1457. PyObject *b;
  1458. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
  1459. if (!args) {
  1460. goto exit;
  1461. }
  1462. a = args[0];
  1463. b = args[1];
  1464. return_value = posonly_kwonly_impl(module, a, b);
  1465. exit:
  1466. return return_value;
  1467. }
  1468. PyDoc_STRVAR(posonly_keywords_kwonly__doc__,
  1469. "posonly_keywords_kwonly($module, a, /, b, *, c)\n"
  1470. "--\n"
  1471. "\n");
  1472. #define POSONLY_KEYWORDS_KWONLY_METHODDEF \
  1473. {"posonly_keywords_kwonly", _PyCFunction_CAST(posonly_keywords_kwonly), METH_FASTCALL|METH_KEYWORDS, posonly_keywords_kwonly__doc__},
  1474. static PyObject *
  1475. posonly_keywords_kwonly_impl(PyObject *module, PyObject *a, PyObject *b,
  1476. PyObject *c);
  1477. static PyObject *
  1478. posonly_keywords_kwonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1479. {
  1480. PyObject *return_value = NULL;
  1481. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1482. #define NUM_KEYWORDS 2
  1483. static struct {
  1484. PyGC_Head _this_is_not_used;
  1485. PyObject_VAR_HEAD
  1486. PyObject *ob_item[NUM_KEYWORDS];
  1487. } _kwtuple = {
  1488. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1489. .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
  1490. };
  1491. #undef NUM_KEYWORDS
  1492. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1493. #else // !Py_BUILD_CORE
  1494. # define KWTUPLE NULL
  1495. #endif // !Py_BUILD_CORE
  1496. static const char * const _keywords[] = {"", "b", "c", NULL};
  1497. static _PyArg_Parser _parser = {
  1498. .keywords = _keywords,
  1499. .fname = "posonly_keywords_kwonly",
  1500. .kwtuple = KWTUPLE,
  1501. };
  1502. #undef KWTUPLE
  1503. PyObject *argsbuf[3];
  1504. PyObject *a;
  1505. PyObject *b;
  1506. PyObject *c;
  1507. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 1, argsbuf);
  1508. if (!args) {
  1509. goto exit;
  1510. }
  1511. a = args[0];
  1512. b = args[1];
  1513. c = args[2];
  1514. return_value = posonly_keywords_kwonly_impl(module, a, b, c);
  1515. exit:
  1516. return return_value;
  1517. }
  1518. PyDoc_STRVAR(posonly_keywords_opt__doc__,
  1519. "posonly_keywords_opt($module, a, /, b, c=None, d=None)\n"
  1520. "--\n"
  1521. "\n");
  1522. #define POSONLY_KEYWORDS_OPT_METHODDEF \
  1523. {"posonly_keywords_opt", _PyCFunction_CAST(posonly_keywords_opt), METH_FASTCALL|METH_KEYWORDS, posonly_keywords_opt__doc__},
  1524. static PyObject *
  1525. posonly_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
  1526. PyObject *c, PyObject *d);
  1527. static PyObject *
  1528. posonly_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1529. {
  1530. PyObject *return_value = NULL;
  1531. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1532. #define NUM_KEYWORDS 3
  1533. static struct {
  1534. PyGC_Head _this_is_not_used;
  1535. PyObject_VAR_HEAD
  1536. PyObject *ob_item[NUM_KEYWORDS];
  1537. } _kwtuple = {
  1538. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1539. .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
  1540. };
  1541. #undef NUM_KEYWORDS
  1542. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1543. #else // !Py_BUILD_CORE
  1544. # define KWTUPLE NULL
  1545. #endif // !Py_BUILD_CORE
  1546. static const char * const _keywords[] = {"", "b", "c", "d", NULL};
  1547. static _PyArg_Parser _parser = {
  1548. .keywords = _keywords,
  1549. .fname = "posonly_keywords_opt",
  1550. .kwtuple = KWTUPLE,
  1551. };
  1552. #undef KWTUPLE
  1553. PyObject *argsbuf[4];
  1554. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
  1555. PyObject *a;
  1556. PyObject *b;
  1557. PyObject *c = Py_None;
  1558. PyObject *d = Py_None;
  1559. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 4, 0, argsbuf);
  1560. if (!args) {
  1561. goto exit;
  1562. }
  1563. a = args[0];
  1564. b = args[1];
  1565. if (!noptargs) {
  1566. goto skip_optional_pos;
  1567. }
  1568. if (args[2]) {
  1569. c = args[2];
  1570. if (!--noptargs) {
  1571. goto skip_optional_pos;
  1572. }
  1573. }
  1574. d = args[3];
  1575. skip_optional_pos:
  1576. return_value = posonly_keywords_opt_impl(module, a, b, c, d);
  1577. exit:
  1578. return return_value;
  1579. }
  1580. PyDoc_STRVAR(posonly_opt_keywords_opt__doc__,
  1581. "posonly_opt_keywords_opt($module, a, b=None, /, c=None, d=None)\n"
  1582. "--\n"
  1583. "\n");
  1584. #define POSONLY_OPT_KEYWORDS_OPT_METHODDEF \
  1585. {"posonly_opt_keywords_opt", _PyCFunction_CAST(posonly_opt_keywords_opt), METH_FASTCALL|METH_KEYWORDS, posonly_opt_keywords_opt__doc__},
  1586. static PyObject *
  1587. posonly_opt_keywords_opt_impl(PyObject *module, PyObject *a, PyObject *b,
  1588. PyObject *c, PyObject *d);
  1589. static PyObject *
  1590. posonly_opt_keywords_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1591. {
  1592. PyObject *return_value = NULL;
  1593. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1594. #define NUM_KEYWORDS 2
  1595. static struct {
  1596. PyGC_Head _this_is_not_used;
  1597. PyObject_VAR_HEAD
  1598. PyObject *ob_item[NUM_KEYWORDS];
  1599. } _kwtuple = {
  1600. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1601. .ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
  1602. };
  1603. #undef NUM_KEYWORDS
  1604. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1605. #else // !Py_BUILD_CORE
  1606. # define KWTUPLE NULL
  1607. #endif // !Py_BUILD_CORE
  1608. static const char * const _keywords[] = {"", "", "c", "d", NULL};
  1609. static _PyArg_Parser _parser = {
  1610. .keywords = _keywords,
  1611. .fname = "posonly_opt_keywords_opt",
  1612. .kwtuple = KWTUPLE,
  1613. };
  1614. #undef KWTUPLE
  1615. PyObject *argsbuf[4];
  1616. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  1617. PyObject *a;
  1618. PyObject *b = Py_None;
  1619. PyObject *c = Py_None;
  1620. PyObject *d = Py_None;
  1621. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf);
  1622. if (!args) {
  1623. goto exit;
  1624. }
  1625. a = args[0];
  1626. if (nargs < 2) {
  1627. goto skip_optional_posonly;
  1628. }
  1629. noptargs--;
  1630. b = args[1];
  1631. skip_optional_posonly:
  1632. if (!noptargs) {
  1633. goto skip_optional_pos;
  1634. }
  1635. if (args[2]) {
  1636. c = args[2];
  1637. if (!--noptargs) {
  1638. goto skip_optional_pos;
  1639. }
  1640. }
  1641. d = args[3];
  1642. skip_optional_pos:
  1643. return_value = posonly_opt_keywords_opt_impl(module, a, b, c, d);
  1644. exit:
  1645. return return_value;
  1646. }
  1647. PyDoc_STRVAR(posonly_kwonly_opt__doc__,
  1648. "posonly_kwonly_opt($module, a, /, *, b, c=None, d=None)\n"
  1649. "--\n"
  1650. "\n");
  1651. #define POSONLY_KWONLY_OPT_METHODDEF \
  1652. {"posonly_kwonly_opt", _PyCFunction_CAST(posonly_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_kwonly_opt__doc__},
  1653. static PyObject *
  1654. posonly_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
  1655. PyObject *c, PyObject *d);
  1656. static PyObject *
  1657. posonly_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1658. {
  1659. PyObject *return_value = NULL;
  1660. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1661. #define NUM_KEYWORDS 3
  1662. static struct {
  1663. PyGC_Head _this_is_not_used;
  1664. PyObject_VAR_HEAD
  1665. PyObject *ob_item[NUM_KEYWORDS];
  1666. } _kwtuple = {
  1667. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1668. .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
  1669. };
  1670. #undef NUM_KEYWORDS
  1671. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1672. #else // !Py_BUILD_CORE
  1673. # define KWTUPLE NULL
  1674. #endif // !Py_BUILD_CORE
  1675. static const char * const _keywords[] = {"", "b", "c", "d", NULL};
  1676. static _PyArg_Parser _parser = {
  1677. .keywords = _keywords,
  1678. .fname = "posonly_kwonly_opt",
  1679. .kwtuple = KWTUPLE,
  1680. };
  1681. #undef KWTUPLE
  1682. PyObject *argsbuf[4];
  1683. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
  1684. PyObject *a;
  1685. PyObject *b;
  1686. PyObject *c = Py_None;
  1687. PyObject *d = Py_None;
  1688. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 1, argsbuf);
  1689. if (!args) {
  1690. goto exit;
  1691. }
  1692. a = args[0];
  1693. b = args[1];
  1694. if (!noptargs) {
  1695. goto skip_optional_kwonly;
  1696. }
  1697. if (args[2]) {
  1698. c = args[2];
  1699. if (!--noptargs) {
  1700. goto skip_optional_kwonly;
  1701. }
  1702. }
  1703. d = args[3];
  1704. skip_optional_kwonly:
  1705. return_value = posonly_kwonly_opt_impl(module, a, b, c, d);
  1706. exit:
  1707. return return_value;
  1708. }
  1709. PyDoc_STRVAR(posonly_opt_kwonly_opt__doc__,
  1710. "posonly_opt_kwonly_opt($module, a, b=None, /, *, c=None, d=None)\n"
  1711. "--\n"
  1712. "\n");
  1713. #define POSONLY_OPT_KWONLY_OPT_METHODDEF \
  1714. {"posonly_opt_kwonly_opt", _PyCFunction_CAST(posonly_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_opt_kwonly_opt__doc__},
  1715. static PyObject *
  1716. posonly_opt_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
  1717. PyObject *c, PyObject *d);
  1718. static PyObject *
  1719. posonly_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1720. {
  1721. PyObject *return_value = NULL;
  1722. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1723. #define NUM_KEYWORDS 2
  1724. static struct {
  1725. PyGC_Head _this_is_not_used;
  1726. PyObject_VAR_HEAD
  1727. PyObject *ob_item[NUM_KEYWORDS];
  1728. } _kwtuple = {
  1729. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1730. .ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
  1731. };
  1732. #undef NUM_KEYWORDS
  1733. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1734. #else // !Py_BUILD_CORE
  1735. # define KWTUPLE NULL
  1736. #endif // !Py_BUILD_CORE
  1737. static const char * const _keywords[] = {"", "", "c", "d", NULL};
  1738. static _PyArg_Parser _parser = {
  1739. .keywords = _keywords,
  1740. .fname = "posonly_opt_kwonly_opt",
  1741. .kwtuple = KWTUPLE,
  1742. };
  1743. #undef KWTUPLE
  1744. PyObject *argsbuf[4];
  1745. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  1746. PyObject *a;
  1747. PyObject *b = Py_None;
  1748. PyObject *c = Py_None;
  1749. PyObject *d = Py_None;
  1750. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
  1751. if (!args) {
  1752. goto exit;
  1753. }
  1754. a = args[0];
  1755. if (nargs < 2) {
  1756. goto skip_optional_posonly;
  1757. }
  1758. noptargs--;
  1759. b = args[1];
  1760. skip_optional_posonly:
  1761. if (!noptargs) {
  1762. goto skip_optional_kwonly;
  1763. }
  1764. if (args[2]) {
  1765. c = args[2];
  1766. if (!--noptargs) {
  1767. goto skip_optional_kwonly;
  1768. }
  1769. }
  1770. d = args[3];
  1771. skip_optional_kwonly:
  1772. return_value = posonly_opt_kwonly_opt_impl(module, a, b, c, d);
  1773. exit:
  1774. return return_value;
  1775. }
  1776. PyDoc_STRVAR(posonly_keywords_kwonly_opt__doc__,
  1777. "posonly_keywords_kwonly_opt($module, a, /, b, *, c, d=None, e=None)\n"
  1778. "--\n"
  1779. "\n");
  1780. #define POSONLY_KEYWORDS_KWONLY_OPT_METHODDEF \
  1781. {"posonly_keywords_kwonly_opt", _PyCFunction_CAST(posonly_keywords_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_keywords_kwonly_opt__doc__},
  1782. static PyObject *
  1783. posonly_keywords_kwonly_opt_impl(PyObject *module, PyObject *a, PyObject *b,
  1784. PyObject *c, PyObject *d, PyObject *e);
  1785. static PyObject *
  1786. posonly_keywords_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1787. {
  1788. PyObject *return_value = NULL;
  1789. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1790. #define NUM_KEYWORDS 4
  1791. static struct {
  1792. PyGC_Head _this_is_not_used;
  1793. PyObject_VAR_HEAD
  1794. PyObject *ob_item[NUM_KEYWORDS];
  1795. } _kwtuple = {
  1796. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1797. .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), _Py_LATIN1_CHR('e'), },
  1798. };
  1799. #undef NUM_KEYWORDS
  1800. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1801. #else // !Py_BUILD_CORE
  1802. # define KWTUPLE NULL
  1803. #endif // !Py_BUILD_CORE
  1804. static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL};
  1805. static _PyArg_Parser _parser = {
  1806. .keywords = _keywords,
  1807. .fname = "posonly_keywords_kwonly_opt",
  1808. .kwtuple = KWTUPLE,
  1809. };
  1810. #undef KWTUPLE
  1811. PyObject *argsbuf[5];
  1812. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
  1813. PyObject *a;
  1814. PyObject *b;
  1815. PyObject *c;
  1816. PyObject *d = Py_None;
  1817. PyObject *e = Py_None;
  1818. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 1, argsbuf);
  1819. if (!args) {
  1820. goto exit;
  1821. }
  1822. a = args[0];
  1823. b = args[1];
  1824. c = args[2];
  1825. if (!noptargs) {
  1826. goto skip_optional_kwonly;
  1827. }
  1828. if (args[3]) {
  1829. d = args[3];
  1830. if (!--noptargs) {
  1831. goto skip_optional_kwonly;
  1832. }
  1833. }
  1834. e = args[4];
  1835. skip_optional_kwonly:
  1836. return_value = posonly_keywords_kwonly_opt_impl(module, a, b, c, d, e);
  1837. exit:
  1838. return return_value;
  1839. }
  1840. PyDoc_STRVAR(posonly_keywords_opt_kwonly_opt__doc__,
  1841. "posonly_keywords_opt_kwonly_opt($module, a, /, b, c=None, *, d=None,\n"
  1842. " e=None)\n"
  1843. "--\n"
  1844. "\n");
  1845. #define POSONLY_KEYWORDS_OPT_KWONLY_OPT_METHODDEF \
  1846. {"posonly_keywords_opt_kwonly_opt", _PyCFunction_CAST(posonly_keywords_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_keywords_opt_kwonly_opt__doc__},
  1847. static PyObject *
  1848. posonly_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
  1849. PyObject *b, PyObject *c, PyObject *d,
  1850. PyObject *e);
  1851. static PyObject *
  1852. posonly_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1853. {
  1854. PyObject *return_value = NULL;
  1855. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1856. #define NUM_KEYWORDS 4
  1857. static struct {
  1858. PyGC_Head _this_is_not_used;
  1859. PyObject_VAR_HEAD
  1860. PyObject *ob_item[NUM_KEYWORDS];
  1861. } _kwtuple = {
  1862. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1863. .ob_item = { _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), _Py_LATIN1_CHR('e'), },
  1864. };
  1865. #undef NUM_KEYWORDS
  1866. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1867. #else // !Py_BUILD_CORE
  1868. # define KWTUPLE NULL
  1869. #endif // !Py_BUILD_CORE
  1870. static const char * const _keywords[] = {"", "b", "c", "d", "e", NULL};
  1871. static _PyArg_Parser _parser = {
  1872. .keywords = _keywords,
  1873. .fname = "posonly_keywords_opt_kwonly_opt",
  1874. .kwtuple = KWTUPLE,
  1875. };
  1876. #undef KWTUPLE
  1877. PyObject *argsbuf[5];
  1878. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
  1879. PyObject *a;
  1880. PyObject *b;
  1881. PyObject *c = Py_None;
  1882. PyObject *d = Py_None;
  1883. PyObject *e = Py_None;
  1884. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
  1885. if (!args) {
  1886. goto exit;
  1887. }
  1888. a = args[0];
  1889. b = args[1];
  1890. if (!noptargs) {
  1891. goto skip_optional_pos;
  1892. }
  1893. if (args[2]) {
  1894. c = args[2];
  1895. if (!--noptargs) {
  1896. goto skip_optional_pos;
  1897. }
  1898. }
  1899. skip_optional_pos:
  1900. if (!noptargs) {
  1901. goto skip_optional_kwonly;
  1902. }
  1903. if (args[3]) {
  1904. d = args[3];
  1905. if (!--noptargs) {
  1906. goto skip_optional_kwonly;
  1907. }
  1908. }
  1909. e = args[4];
  1910. skip_optional_kwonly:
  1911. return_value = posonly_keywords_opt_kwonly_opt_impl(module, a, b, c, d, e);
  1912. exit:
  1913. return return_value;
  1914. }
  1915. PyDoc_STRVAR(posonly_opt_keywords_opt_kwonly_opt__doc__,
  1916. "posonly_opt_keywords_opt_kwonly_opt($module, a, b=None, /, c=None, *,\n"
  1917. " d=None)\n"
  1918. "--\n"
  1919. "\n");
  1920. #define POSONLY_OPT_KEYWORDS_OPT_KWONLY_OPT_METHODDEF \
  1921. {"posonly_opt_keywords_opt_kwonly_opt", _PyCFunction_CAST(posonly_opt_keywords_opt_kwonly_opt), METH_FASTCALL|METH_KEYWORDS, posonly_opt_keywords_opt_kwonly_opt__doc__},
  1922. static PyObject *
  1923. posonly_opt_keywords_opt_kwonly_opt_impl(PyObject *module, PyObject *a,
  1924. PyObject *b, PyObject *c,
  1925. PyObject *d);
  1926. static PyObject *
  1927. posonly_opt_keywords_opt_kwonly_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1928. {
  1929. PyObject *return_value = NULL;
  1930. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  1931. #define NUM_KEYWORDS 2
  1932. static struct {
  1933. PyGC_Head _this_is_not_used;
  1934. PyObject_VAR_HEAD
  1935. PyObject *ob_item[NUM_KEYWORDS];
  1936. } _kwtuple = {
  1937. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  1938. .ob_item = { _Py_LATIN1_CHR('c'), _Py_LATIN1_CHR('d'), },
  1939. };
  1940. #undef NUM_KEYWORDS
  1941. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  1942. #else // !Py_BUILD_CORE
  1943. # define KWTUPLE NULL
  1944. #endif // !Py_BUILD_CORE
  1945. static const char * const _keywords[] = {"", "", "c", "d", NULL};
  1946. static _PyArg_Parser _parser = {
  1947. .keywords = _keywords,
  1948. .fname = "posonly_opt_keywords_opt_kwonly_opt",
  1949. .kwtuple = KWTUPLE,
  1950. };
  1951. #undef KWTUPLE
  1952. PyObject *argsbuf[4];
  1953. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  1954. PyObject *a;
  1955. PyObject *b = Py_None;
  1956. PyObject *c = Py_None;
  1957. PyObject *d = Py_None;
  1958. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
  1959. if (!args) {
  1960. goto exit;
  1961. }
  1962. a = args[0];
  1963. if (nargs < 2) {
  1964. goto skip_optional_posonly;
  1965. }
  1966. noptargs--;
  1967. b = args[1];
  1968. skip_optional_posonly:
  1969. if (!noptargs) {
  1970. goto skip_optional_pos;
  1971. }
  1972. if (args[2]) {
  1973. c = args[2];
  1974. if (!--noptargs) {
  1975. goto skip_optional_pos;
  1976. }
  1977. }
  1978. skip_optional_pos:
  1979. if (!noptargs) {
  1980. goto skip_optional_kwonly;
  1981. }
  1982. d = args[3];
  1983. skip_optional_kwonly:
  1984. return_value = posonly_opt_keywords_opt_kwonly_opt_impl(module, a, b, c, d);
  1985. exit:
  1986. return return_value;
  1987. }
  1988. PyDoc_STRVAR(keyword_only_parameter__doc__,
  1989. "keyword_only_parameter($module, /, *, a)\n"
  1990. "--\n"
  1991. "\n");
  1992. #define KEYWORD_ONLY_PARAMETER_METHODDEF \
  1993. {"keyword_only_parameter", _PyCFunction_CAST(keyword_only_parameter), METH_FASTCALL|METH_KEYWORDS, keyword_only_parameter__doc__},
  1994. static PyObject *
  1995. keyword_only_parameter_impl(PyObject *module, PyObject *a);
  1996. static PyObject *
  1997. keyword_only_parameter(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  1998. {
  1999. PyObject *return_value = NULL;
  2000. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2001. #define NUM_KEYWORDS 1
  2002. static struct {
  2003. PyGC_Head _this_is_not_used;
  2004. PyObject_VAR_HEAD
  2005. PyObject *ob_item[NUM_KEYWORDS];
  2006. } _kwtuple = {
  2007. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2008. .ob_item = { _Py_LATIN1_CHR('a'), },
  2009. };
  2010. #undef NUM_KEYWORDS
  2011. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2012. #else // !Py_BUILD_CORE
  2013. # define KWTUPLE NULL
  2014. #endif // !Py_BUILD_CORE
  2015. static const char * const _keywords[] = {"a", NULL};
  2016. static _PyArg_Parser _parser = {
  2017. .keywords = _keywords,
  2018. .fname = "keyword_only_parameter",
  2019. .kwtuple = KWTUPLE,
  2020. };
  2021. #undef KWTUPLE
  2022. PyObject *argsbuf[1];
  2023. PyObject *a;
  2024. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 1, argsbuf);
  2025. if (!args) {
  2026. goto exit;
  2027. }
  2028. a = args[0];
  2029. return_value = keyword_only_parameter_impl(module, a);
  2030. exit:
  2031. return return_value;
  2032. }
  2033. PyDoc_STRVAR(posonly_vararg__doc__,
  2034. "posonly_vararg($module, a, /, b, *args)\n"
  2035. "--\n"
  2036. "\n");
  2037. #define POSONLY_VARARG_METHODDEF \
  2038. {"posonly_vararg", _PyCFunction_CAST(posonly_vararg), METH_FASTCALL|METH_KEYWORDS, posonly_vararg__doc__},
  2039. static PyObject *
  2040. posonly_vararg_impl(PyObject *module, PyObject *a, PyObject *b,
  2041. PyObject *args);
  2042. static PyObject *
  2043. posonly_vararg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2044. {
  2045. PyObject *return_value = NULL;
  2046. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2047. #define NUM_KEYWORDS 1
  2048. static struct {
  2049. PyGC_Head _this_is_not_used;
  2050. PyObject_VAR_HEAD
  2051. PyObject *ob_item[NUM_KEYWORDS];
  2052. } _kwtuple = {
  2053. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2054. .ob_item = { _Py_LATIN1_CHR('b'), },
  2055. };
  2056. #undef NUM_KEYWORDS
  2057. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2058. #else // !Py_BUILD_CORE
  2059. # define KWTUPLE NULL
  2060. #endif // !Py_BUILD_CORE
  2061. static const char * const _keywords[] = {"", "b", NULL};
  2062. static _PyArg_Parser _parser = {
  2063. .keywords = _keywords,
  2064. .fname = "posonly_vararg",
  2065. .kwtuple = KWTUPLE,
  2066. };
  2067. #undef KWTUPLE
  2068. PyObject *argsbuf[3];
  2069. PyObject *a;
  2070. PyObject *b;
  2071. PyObject *__clinic_args = NULL;
  2072. args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, 2, argsbuf);
  2073. if (!args) {
  2074. goto exit;
  2075. }
  2076. a = args[0];
  2077. b = args[1];
  2078. __clinic_args = args[2];
  2079. return_value = posonly_vararg_impl(module, a, b, __clinic_args);
  2080. exit:
  2081. Py_XDECREF(__clinic_args);
  2082. return return_value;
  2083. }
  2084. PyDoc_STRVAR(vararg_and_posonly__doc__,
  2085. "vararg_and_posonly($module, a, /, *args)\n"
  2086. "--\n"
  2087. "\n");
  2088. #define VARARG_AND_POSONLY_METHODDEF \
  2089. {"vararg_and_posonly", _PyCFunction_CAST(vararg_and_posonly), METH_FASTCALL, vararg_and_posonly__doc__},
  2090. static PyObject *
  2091. vararg_and_posonly_impl(PyObject *module, PyObject *a, PyObject *args);
  2092. static PyObject *
  2093. vararg_and_posonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  2094. {
  2095. PyObject *return_value = NULL;
  2096. PyObject *a;
  2097. PyObject *__clinic_args = NULL;
  2098. if (!_PyArg_CheckPositional("vararg_and_posonly", nargs, 1, PY_SSIZE_T_MAX)) {
  2099. goto exit;
  2100. }
  2101. a = args[0];
  2102. __clinic_args = PyTuple_New(nargs - 1);
  2103. if (!__clinic_args) {
  2104. goto exit;
  2105. }
  2106. for (Py_ssize_t i = 0; i < nargs - 1; ++i) {
  2107. PyTuple_SET_ITEM(__clinic_args, i, Py_NewRef(args[1 + i]));
  2108. }
  2109. return_value = vararg_and_posonly_impl(module, a, __clinic_args);
  2110. exit:
  2111. Py_XDECREF(__clinic_args);
  2112. return return_value;
  2113. }
  2114. PyDoc_STRVAR(vararg__doc__,
  2115. "vararg($module, /, a, *args)\n"
  2116. "--\n"
  2117. "\n");
  2118. #define VARARG_METHODDEF \
  2119. {"vararg", _PyCFunction_CAST(vararg), METH_FASTCALL|METH_KEYWORDS, vararg__doc__},
  2120. static PyObject *
  2121. vararg_impl(PyObject *module, PyObject *a, PyObject *args);
  2122. static PyObject *
  2123. vararg(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2124. {
  2125. PyObject *return_value = NULL;
  2126. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2127. #define NUM_KEYWORDS 1
  2128. static struct {
  2129. PyGC_Head _this_is_not_used;
  2130. PyObject_VAR_HEAD
  2131. PyObject *ob_item[NUM_KEYWORDS];
  2132. } _kwtuple = {
  2133. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2134. .ob_item = { _Py_LATIN1_CHR('a'), },
  2135. };
  2136. #undef NUM_KEYWORDS
  2137. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2138. #else // !Py_BUILD_CORE
  2139. # define KWTUPLE NULL
  2140. #endif // !Py_BUILD_CORE
  2141. static const char * const _keywords[] = {"a", NULL};
  2142. static _PyArg_Parser _parser = {
  2143. .keywords = _keywords,
  2144. .fname = "vararg",
  2145. .kwtuple = KWTUPLE,
  2146. };
  2147. #undef KWTUPLE
  2148. PyObject *argsbuf[2];
  2149. PyObject *a;
  2150. PyObject *__clinic_args = NULL;
  2151. args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf);
  2152. if (!args) {
  2153. goto exit;
  2154. }
  2155. a = args[0];
  2156. __clinic_args = args[1];
  2157. return_value = vararg_impl(module, a, __clinic_args);
  2158. exit:
  2159. Py_XDECREF(__clinic_args);
  2160. return return_value;
  2161. }
  2162. PyDoc_STRVAR(vararg_with_default__doc__,
  2163. "vararg_with_default($module, /, a, *args, b=False)\n"
  2164. "--\n"
  2165. "\n");
  2166. #define VARARG_WITH_DEFAULT_METHODDEF \
  2167. {"vararg_with_default", _PyCFunction_CAST(vararg_with_default), METH_FASTCALL|METH_KEYWORDS, vararg_with_default__doc__},
  2168. static PyObject *
  2169. vararg_with_default_impl(PyObject *module, PyObject *a, PyObject *args,
  2170. int b);
  2171. static PyObject *
  2172. vararg_with_default(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2173. {
  2174. PyObject *return_value = NULL;
  2175. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2176. #define NUM_KEYWORDS 2
  2177. static struct {
  2178. PyGC_Head _this_is_not_used;
  2179. PyObject_VAR_HEAD
  2180. PyObject *ob_item[NUM_KEYWORDS];
  2181. } _kwtuple = {
  2182. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2183. .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), },
  2184. };
  2185. #undef NUM_KEYWORDS
  2186. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2187. #else // !Py_BUILD_CORE
  2188. # define KWTUPLE NULL
  2189. #endif // !Py_BUILD_CORE
  2190. static const char * const _keywords[] = {"a", "b", NULL};
  2191. static _PyArg_Parser _parser = {
  2192. .keywords = _keywords,
  2193. .fname = "vararg_with_default",
  2194. .kwtuple = KWTUPLE,
  2195. };
  2196. #undef KWTUPLE
  2197. PyObject *argsbuf[3];
  2198. Py_ssize_t noptargs = Py_MIN(nargs, 1) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  2199. PyObject *a;
  2200. PyObject *__clinic_args = NULL;
  2201. int b = 0;
  2202. args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf);
  2203. if (!args) {
  2204. goto exit;
  2205. }
  2206. a = args[0];
  2207. __clinic_args = args[1];
  2208. if (!noptargs) {
  2209. goto skip_optional_kwonly;
  2210. }
  2211. b = PyObject_IsTrue(args[2]);
  2212. if (b < 0) {
  2213. goto exit;
  2214. }
  2215. skip_optional_kwonly:
  2216. return_value = vararg_with_default_impl(module, a, __clinic_args, b);
  2217. exit:
  2218. Py_XDECREF(__clinic_args);
  2219. return return_value;
  2220. }
  2221. PyDoc_STRVAR(vararg_with_default2__doc__,
  2222. "vararg_with_default2($module, /, a, *args, b=None, c=None)\n"
  2223. "--\n"
  2224. "\n");
  2225. #define VARARG_WITH_DEFAULT2_METHODDEF \
  2226. {"vararg_with_default2", _PyCFunction_CAST(vararg_with_default2), METH_FASTCALL|METH_KEYWORDS, vararg_with_default2__doc__},
  2227. static PyObject *
  2228. vararg_with_default2_impl(PyObject *module, PyObject *a, PyObject *args,
  2229. PyObject *b, PyObject *c);
  2230. static PyObject *
  2231. vararg_with_default2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2232. {
  2233. PyObject *return_value = NULL;
  2234. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2235. #define NUM_KEYWORDS 3
  2236. static struct {
  2237. PyGC_Head _this_is_not_used;
  2238. PyObject_VAR_HEAD
  2239. PyObject *ob_item[NUM_KEYWORDS];
  2240. } _kwtuple = {
  2241. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2242. .ob_item = { _Py_LATIN1_CHR('a'), _Py_LATIN1_CHR('b'), _Py_LATIN1_CHR('c'), },
  2243. };
  2244. #undef NUM_KEYWORDS
  2245. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2246. #else // !Py_BUILD_CORE
  2247. # define KWTUPLE NULL
  2248. #endif // !Py_BUILD_CORE
  2249. static const char * const _keywords[] = {"a", "b", "c", NULL};
  2250. static _PyArg_Parser _parser = {
  2251. .keywords = _keywords,
  2252. .fname = "vararg_with_default2",
  2253. .kwtuple = KWTUPLE,
  2254. };
  2255. #undef KWTUPLE
  2256. PyObject *argsbuf[4];
  2257. Py_ssize_t noptargs = Py_MIN(nargs, 1) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  2258. PyObject *a;
  2259. PyObject *__clinic_args = NULL;
  2260. PyObject *b = Py_None;
  2261. PyObject *c = Py_None;
  2262. args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf);
  2263. if (!args) {
  2264. goto exit;
  2265. }
  2266. a = args[0];
  2267. __clinic_args = args[1];
  2268. if (!noptargs) {
  2269. goto skip_optional_kwonly;
  2270. }
  2271. if (args[2]) {
  2272. b = args[2];
  2273. if (!--noptargs) {
  2274. goto skip_optional_kwonly;
  2275. }
  2276. }
  2277. c = args[3];
  2278. skip_optional_kwonly:
  2279. return_value = vararg_with_default2_impl(module, a, __clinic_args, b, c);
  2280. exit:
  2281. Py_XDECREF(__clinic_args);
  2282. return return_value;
  2283. }
  2284. PyDoc_STRVAR(vararg_with_only_defaults__doc__,
  2285. "vararg_with_only_defaults($module, /, *args, b=None)\n"
  2286. "--\n"
  2287. "\n");
  2288. #define VARARG_WITH_ONLY_DEFAULTS_METHODDEF \
  2289. {"vararg_with_only_defaults", _PyCFunction_CAST(vararg_with_only_defaults), METH_FASTCALL|METH_KEYWORDS, vararg_with_only_defaults__doc__},
  2290. static PyObject *
  2291. vararg_with_only_defaults_impl(PyObject *module, PyObject *args, PyObject *b);
  2292. static PyObject *
  2293. vararg_with_only_defaults(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2294. {
  2295. PyObject *return_value = NULL;
  2296. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2297. #define NUM_KEYWORDS 1
  2298. static struct {
  2299. PyGC_Head _this_is_not_used;
  2300. PyObject_VAR_HEAD
  2301. PyObject *ob_item[NUM_KEYWORDS];
  2302. } _kwtuple = {
  2303. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2304. .ob_item = { _Py_LATIN1_CHR('b'), },
  2305. };
  2306. #undef NUM_KEYWORDS
  2307. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2308. #else // !Py_BUILD_CORE
  2309. # define KWTUPLE NULL
  2310. #endif // !Py_BUILD_CORE
  2311. static const char * const _keywords[] = {"b", NULL};
  2312. static _PyArg_Parser _parser = {
  2313. .keywords = _keywords,
  2314. .fname = "vararg_with_only_defaults",
  2315. .kwtuple = KWTUPLE,
  2316. };
  2317. #undef KWTUPLE
  2318. PyObject *argsbuf[2];
  2319. Py_ssize_t noptargs = 0 + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
  2320. PyObject *__clinic_args = NULL;
  2321. PyObject *b = Py_None;
  2322. args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, 0, argsbuf);
  2323. if (!args) {
  2324. goto exit;
  2325. }
  2326. __clinic_args = args[0];
  2327. if (!noptargs) {
  2328. goto skip_optional_kwonly;
  2329. }
  2330. b = args[1];
  2331. skip_optional_kwonly:
  2332. return_value = vararg_with_only_defaults_impl(module, __clinic_args, b);
  2333. exit:
  2334. Py_XDECREF(__clinic_args);
  2335. return return_value;
  2336. }
  2337. PyDoc_STRVAR(gh_32092_oob__doc__,
  2338. "gh_32092_oob($module, /, pos1, pos2, *varargs, kw1=None, kw2=None)\n"
  2339. "--\n"
  2340. "\n"
  2341. "Proof-of-concept of GH-32092 OOB bug.");
  2342. #define GH_32092_OOB_METHODDEF \
  2343. {"gh_32092_oob", _PyCFunction_CAST(gh_32092_oob), METH_FASTCALL|METH_KEYWORDS, gh_32092_oob__doc__},
  2344. static PyObject *
  2345. gh_32092_oob_impl(PyObject *module, PyObject *pos1, PyObject *pos2,
  2346. PyObject *varargs, PyObject *kw1, PyObject *kw2);
  2347. static PyObject *
  2348. gh_32092_oob(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2349. {
  2350. PyObject *return_value = NULL;
  2351. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2352. #define NUM_KEYWORDS 4
  2353. static struct {
  2354. PyGC_Head _this_is_not_used;
  2355. PyObject_VAR_HEAD
  2356. PyObject *ob_item[NUM_KEYWORDS];
  2357. } _kwtuple = {
  2358. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2359. .ob_item = { &_Py_ID(pos1), &_Py_ID(pos2), &_Py_ID(kw1), &_Py_ID(kw2), },
  2360. };
  2361. #undef NUM_KEYWORDS
  2362. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2363. #else // !Py_BUILD_CORE
  2364. # define KWTUPLE NULL
  2365. #endif // !Py_BUILD_CORE
  2366. static const char * const _keywords[] = {"pos1", "pos2", "kw1", "kw2", NULL};
  2367. static _PyArg_Parser _parser = {
  2368. .keywords = _keywords,
  2369. .fname = "gh_32092_oob",
  2370. .kwtuple = KWTUPLE,
  2371. };
  2372. #undef KWTUPLE
  2373. PyObject *argsbuf[5];
  2374. Py_ssize_t noptargs = Py_MIN(nargs, 2) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
  2375. PyObject *pos1;
  2376. PyObject *pos2;
  2377. PyObject *varargs = NULL;
  2378. PyObject *kw1 = Py_None;
  2379. PyObject *kw2 = Py_None;
  2380. args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, 2, argsbuf);
  2381. if (!args) {
  2382. goto exit;
  2383. }
  2384. pos1 = args[0];
  2385. pos2 = args[1];
  2386. varargs = args[2];
  2387. if (!noptargs) {
  2388. goto skip_optional_kwonly;
  2389. }
  2390. if (args[3]) {
  2391. kw1 = args[3];
  2392. if (!--noptargs) {
  2393. goto skip_optional_kwonly;
  2394. }
  2395. }
  2396. kw2 = args[4];
  2397. skip_optional_kwonly:
  2398. return_value = gh_32092_oob_impl(module, pos1, pos2, varargs, kw1, kw2);
  2399. exit:
  2400. Py_XDECREF(varargs);
  2401. return return_value;
  2402. }
  2403. PyDoc_STRVAR(gh_32092_kw_pass__doc__,
  2404. "gh_32092_kw_pass($module, /, pos, *args, kw=None)\n"
  2405. "--\n"
  2406. "\n"
  2407. "Proof-of-concept of GH-32092 keyword args passing bug.");
  2408. #define GH_32092_KW_PASS_METHODDEF \
  2409. {"gh_32092_kw_pass", _PyCFunction_CAST(gh_32092_kw_pass), METH_FASTCALL|METH_KEYWORDS, gh_32092_kw_pass__doc__},
  2410. static PyObject *
  2411. gh_32092_kw_pass_impl(PyObject *module, PyObject *pos, PyObject *args,
  2412. PyObject *kw);
  2413. static PyObject *
  2414. gh_32092_kw_pass(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2415. {
  2416. PyObject *return_value = NULL;
  2417. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2418. #define NUM_KEYWORDS 2
  2419. static struct {
  2420. PyGC_Head _this_is_not_used;
  2421. PyObject_VAR_HEAD
  2422. PyObject *ob_item[NUM_KEYWORDS];
  2423. } _kwtuple = {
  2424. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2425. .ob_item = { &_Py_ID(pos), &_Py_ID(kw), },
  2426. };
  2427. #undef NUM_KEYWORDS
  2428. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2429. #else // !Py_BUILD_CORE
  2430. # define KWTUPLE NULL
  2431. #endif // !Py_BUILD_CORE
  2432. static const char * const _keywords[] = {"pos", "kw", NULL};
  2433. static _PyArg_Parser _parser = {
  2434. .keywords = _keywords,
  2435. .fname = "gh_32092_kw_pass",
  2436. .kwtuple = KWTUPLE,
  2437. };
  2438. #undef KWTUPLE
  2439. PyObject *argsbuf[3];
  2440. Py_ssize_t noptargs = Py_MIN(nargs, 1) + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
  2441. PyObject *pos;
  2442. PyObject *__clinic_args = NULL;
  2443. PyObject *kw = Py_None;
  2444. args = _PyArg_UnpackKeywordsWithVararg(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, 1, argsbuf);
  2445. if (!args) {
  2446. goto exit;
  2447. }
  2448. pos = args[0];
  2449. __clinic_args = args[1];
  2450. if (!noptargs) {
  2451. goto skip_optional_kwonly;
  2452. }
  2453. kw = args[2];
  2454. skip_optional_kwonly:
  2455. return_value = gh_32092_kw_pass_impl(module, pos, __clinic_args, kw);
  2456. exit:
  2457. Py_XDECREF(__clinic_args);
  2458. return return_value;
  2459. }
  2460. PyDoc_STRVAR(gh_99233_refcount__doc__,
  2461. "gh_99233_refcount($module, /, *args)\n"
  2462. "--\n"
  2463. "\n"
  2464. "Proof-of-concept of GH-99233 refcount error bug.");
  2465. #define GH_99233_REFCOUNT_METHODDEF \
  2466. {"gh_99233_refcount", _PyCFunction_CAST(gh_99233_refcount), METH_FASTCALL, gh_99233_refcount__doc__},
  2467. static PyObject *
  2468. gh_99233_refcount_impl(PyObject *module, PyObject *args);
  2469. static PyObject *
  2470. gh_99233_refcount(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  2471. {
  2472. PyObject *return_value = NULL;
  2473. PyObject *__clinic_args = NULL;
  2474. if (!_PyArg_CheckPositional("gh_99233_refcount", nargs, 0, PY_SSIZE_T_MAX)) {
  2475. goto exit;
  2476. }
  2477. __clinic_args = PyTuple_New(nargs - 0);
  2478. if (!__clinic_args) {
  2479. goto exit;
  2480. }
  2481. for (Py_ssize_t i = 0; i < nargs - 0; ++i) {
  2482. PyTuple_SET_ITEM(__clinic_args, i, Py_NewRef(args[0 + i]));
  2483. }
  2484. return_value = gh_99233_refcount_impl(module, __clinic_args);
  2485. exit:
  2486. Py_XDECREF(__clinic_args);
  2487. return return_value;
  2488. }
  2489. PyDoc_STRVAR(gh_99240_double_free__doc__,
  2490. "gh_99240_double_free($module, a, b, /)\n"
  2491. "--\n"
  2492. "\n"
  2493. "Proof-of-concept of GH-99240 double-free bug.");
  2494. #define GH_99240_DOUBLE_FREE_METHODDEF \
  2495. {"gh_99240_double_free", _PyCFunction_CAST(gh_99240_double_free), METH_FASTCALL, gh_99240_double_free__doc__},
  2496. static PyObject *
  2497. gh_99240_double_free_impl(PyObject *module, char *a, char *b);
  2498. static PyObject *
  2499. gh_99240_double_free(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  2500. {
  2501. PyObject *return_value = NULL;
  2502. char *a = NULL;
  2503. char *b = NULL;
  2504. if (!_PyArg_ParseStack(args, nargs, "eses:gh_99240_double_free",
  2505. "idna", &a, "idna", &b)) {
  2506. goto exit;
  2507. }
  2508. return_value = gh_99240_double_free_impl(module, a, b);
  2509. /* Post parse cleanup for a */
  2510. PyMem_FREE(a);
  2511. /* Post parse cleanup for b */
  2512. PyMem_FREE(b);
  2513. exit:
  2514. return return_value;
  2515. }
  2516. PyDoc_STRVAR(clone_f1__doc__,
  2517. "clone_f1($module, /, path)\n"
  2518. "--\n"
  2519. "\n");
  2520. #define CLONE_F1_METHODDEF \
  2521. {"clone_f1", _PyCFunction_CAST(clone_f1), METH_FASTCALL|METH_KEYWORDS, clone_f1__doc__},
  2522. static PyObject *
  2523. clone_f1_impl(PyObject *module, const char *path);
  2524. static PyObject *
  2525. clone_f1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2526. {
  2527. PyObject *return_value = NULL;
  2528. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2529. #define NUM_KEYWORDS 1
  2530. static struct {
  2531. PyGC_Head _this_is_not_used;
  2532. PyObject_VAR_HEAD
  2533. PyObject *ob_item[NUM_KEYWORDS];
  2534. } _kwtuple = {
  2535. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2536. .ob_item = { &_Py_ID(path), },
  2537. };
  2538. #undef NUM_KEYWORDS
  2539. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2540. #else // !Py_BUILD_CORE
  2541. # define KWTUPLE NULL
  2542. #endif // !Py_BUILD_CORE
  2543. static const char * const _keywords[] = {"path", NULL};
  2544. static _PyArg_Parser _parser = {
  2545. .keywords = _keywords,
  2546. .fname = "clone_f1",
  2547. .kwtuple = KWTUPLE,
  2548. };
  2549. #undef KWTUPLE
  2550. PyObject *argsbuf[1];
  2551. const char *path;
  2552. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
  2553. if (!args) {
  2554. goto exit;
  2555. }
  2556. if (!PyUnicode_Check(args[0])) {
  2557. _PyArg_BadArgument("clone_f1", "argument 'path'", "str", args[0]);
  2558. goto exit;
  2559. }
  2560. Py_ssize_t path_length;
  2561. path = PyUnicode_AsUTF8AndSize(args[0], &path_length);
  2562. if (path == NULL) {
  2563. goto exit;
  2564. }
  2565. if (strlen(path) != (size_t)path_length) {
  2566. PyErr_SetString(PyExc_ValueError, "embedded null character");
  2567. goto exit;
  2568. }
  2569. return_value = clone_f1_impl(module, path);
  2570. exit:
  2571. return return_value;
  2572. }
  2573. PyDoc_STRVAR(clone_f2__doc__,
  2574. "clone_f2($module, /, path)\n"
  2575. "--\n"
  2576. "\n");
  2577. #define CLONE_F2_METHODDEF \
  2578. {"clone_f2", _PyCFunction_CAST(clone_f2), METH_FASTCALL|METH_KEYWORDS, clone_f2__doc__},
  2579. static PyObject *
  2580. clone_f2_impl(PyObject *module, const char *path);
  2581. static PyObject *
  2582. clone_f2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2583. {
  2584. PyObject *return_value = NULL;
  2585. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2586. #define NUM_KEYWORDS 1
  2587. static struct {
  2588. PyGC_Head _this_is_not_used;
  2589. PyObject_VAR_HEAD
  2590. PyObject *ob_item[NUM_KEYWORDS];
  2591. } _kwtuple = {
  2592. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2593. .ob_item = { &_Py_ID(path), },
  2594. };
  2595. #undef NUM_KEYWORDS
  2596. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2597. #else // !Py_BUILD_CORE
  2598. # define KWTUPLE NULL
  2599. #endif // !Py_BUILD_CORE
  2600. static const char * const _keywords[] = {"path", NULL};
  2601. static _PyArg_Parser _parser = {
  2602. .keywords = _keywords,
  2603. .fname = "clone_f2",
  2604. .kwtuple = KWTUPLE,
  2605. };
  2606. #undef KWTUPLE
  2607. PyObject *argsbuf[1];
  2608. const char *path;
  2609. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
  2610. if (!args) {
  2611. goto exit;
  2612. }
  2613. if (!PyUnicode_Check(args[0])) {
  2614. _PyArg_BadArgument("clone_f2", "argument 'path'", "str", args[0]);
  2615. goto exit;
  2616. }
  2617. Py_ssize_t path_length;
  2618. path = PyUnicode_AsUTF8AndSize(args[0], &path_length);
  2619. if (path == NULL) {
  2620. goto exit;
  2621. }
  2622. if (strlen(path) != (size_t)path_length) {
  2623. PyErr_SetString(PyExc_ValueError, "embedded null character");
  2624. goto exit;
  2625. }
  2626. return_value = clone_f2_impl(module, path);
  2627. exit:
  2628. return return_value;
  2629. }
  2630. PyDoc_STRVAR(clone_with_conv_f1__doc__,
  2631. "clone_with_conv_f1($module, /, path=None)\n"
  2632. "--\n"
  2633. "\n");
  2634. #define CLONE_WITH_CONV_F1_METHODDEF \
  2635. {"clone_with_conv_f1", _PyCFunction_CAST(clone_with_conv_f1), METH_FASTCALL|METH_KEYWORDS, clone_with_conv_f1__doc__},
  2636. static PyObject *
  2637. clone_with_conv_f1_impl(PyObject *module, custom_t path);
  2638. static PyObject *
  2639. clone_with_conv_f1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2640. {
  2641. PyObject *return_value = NULL;
  2642. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2643. #define NUM_KEYWORDS 1
  2644. static struct {
  2645. PyGC_Head _this_is_not_used;
  2646. PyObject_VAR_HEAD
  2647. PyObject *ob_item[NUM_KEYWORDS];
  2648. } _kwtuple = {
  2649. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2650. .ob_item = { &_Py_ID(path), },
  2651. };
  2652. #undef NUM_KEYWORDS
  2653. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2654. #else // !Py_BUILD_CORE
  2655. # define KWTUPLE NULL
  2656. #endif // !Py_BUILD_CORE
  2657. static const char * const _keywords[] = {"path", NULL};
  2658. static _PyArg_Parser _parser = {
  2659. .keywords = _keywords,
  2660. .fname = "clone_with_conv_f1",
  2661. .kwtuple = KWTUPLE,
  2662. };
  2663. #undef KWTUPLE
  2664. PyObject *argsbuf[1];
  2665. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
  2666. custom_t path = {
  2667. .name = "clone_with_conv_f1",
  2668. };
  2669. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
  2670. if (!args) {
  2671. goto exit;
  2672. }
  2673. if (!noptargs) {
  2674. goto skip_optional_pos;
  2675. }
  2676. if (!custom_converter(args[0], &path)) {
  2677. goto exit;
  2678. }
  2679. skip_optional_pos:
  2680. return_value = clone_with_conv_f1_impl(module, path);
  2681. exit:
  2682. return return_value;
  2683. }
  2684. PyDoc_STRVAR(clone_with_conv_f2__doc__,
  2685. "clone_with_conv_f2($module, /, path=None)\n"
  2686. "--\n"
  2687. "\n");
  2688. #define CLONE_WITH_CONV_F2_METHODDEF \
  2689. {"clone_with_conv_f2", _PyCFunction_CAST(clone_with_conv_f2), METH_FASTCALL|METH_KEYWORDS, clone_with_conv_f2__doc__},
  2690. static PyObject *
  2691. clone_with_conv_f2_impl(PyObject *module, custom_t path);
  2692. static PyObject *
  2693. clone_with_conv_f2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2694. {
  2695. PyObject *return_value = NULL;
  2696. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  2697. #define NUM_KEYWORDS 1
  2698. static struct {
  2699. PyGC_Head _this_is_not_used;
  2700. PyObject_VAR_HEAD
  2701. PyObject *ob_item[NUM_KEYWORDS];
  2702. } _kwtuple = {
  2703. .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
  2704. .ob_item = { &_Py_ID(path), },
  2705. };
  2706. #undef NUM_KEYWORDS
  2707. #define KWTUPLE (&_kwtuple.ob_base.ob_base)
  2708. #else // !Py_BUILD_CORE
  2709. # define KWTUPLE NULL
  2710. #endif // !Py_BUILD_CORE
  2711. static const char * const _keywords[] = {"path", NULL};
  2712. static _PyArg_Parser _parser = {
  2713. .keywords = _keywords,
  2714. .fname = "clone_with_conv_f2",
  2715. .kwtuple = KWTUPLE,
  2716. };
  2717. #undef KWTUPLE
  2718. PyObject *argsbuf[1];
  2719. Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
  2720. custom_t path = {
  2721. .name = "clone_with_conv_f2",
  2722. };
  2723. args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
  2724. if (!args) {
  2725. goto exit;
  2726. }
  2727. if (!noptargs) {
  2728. goto skip_optional_pos;
  2729. }
  2730. if (!custom_converter(args[0], &path)) {
  2731. goto exit;
  2732. }
  2733. skip_optional_pos:
  2734. return_value = clone_with_conv_f2_impl(module, path);
  2735. exit:
  2736. return return_value;
  2737. }
  2738. PyDoc_STRVAR(_testclinic_TestClass_meth_method_no_params__doc__,
  2739. "meth_method_no_params($self, /)\n"
  2740. "--\n"
  2741. "\n");
  2742. #define _TESTCLINIC_TESTCLASS_METH_METHOD_NO_PARAMS_METHODDEF \
  2743. {"meth_method_no_params", _PyCFunction_CAST(_testclinic_TestClass_meth_method_no_params), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testclinic_TestClass_meth_method_no_params__doc__},
  2744. static PyObject *
  2745. _testclinic_TestClass_meth_method_no_params_impl(PyObject *self,
  2746. PyTypeObject *cls);
  2747. static PyObject *
  2748. _testclinic_TestClass_meth_method_no_params(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
  2749. {
  2750. if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
  2751. PyErr_SetString(PyExc_TypeError, "meth_method_no_params() takes no arguments");
  2752. return NULL;
  2753. }
  2754. return _testclinic_TestClass_meth_method_no_params_impl(self, cls);
  2755. }
  2756. /*[clinic end generated code: output=74fdd265fd402226 input=a9049054013a1b77]*/