@@ -4,9 +4,11 @@ output preset block
4
4
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=3c81ac2402d06a8b]*/
5
5
6
6
/*[clinic input]
7
+ module m
8
+ class m.T "TestObj *" "TestType"
7
9
class Test "TestObj *" "TestType"
8
10
[clinic start generated code]*/
9
- /*[clinic end generated code: output=da39a3ee5e6b4b0d input=fc7e50384d12b83f ]*/
11
+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=f761b4d55cb179cf ]*/
10
12
11
13
/*[clinic input]
12
14
test_object_converter
@@ -6437,3 +6439,192 @@ test_deprecate_positional_pos2_len3_with_kwdonly_impl(PyObject *module,
6437
6439
PyObject * d ,
6438
6440
PyObject * e )
6439
6441
/*[clinic end generated code: output=383d56b03f7c2dcb input=154fd450448d8935]*/
6442
+
6443
+
6444
+ /*[clinic input]
6445
+ @classmethod
6446
+ Test.__new__
6447
+ * [from 3.14]
6448
+ a: object
6449
+ The deprecation message should use the class name instead of __new__.
6450
+ [clinic start generated code]*/
6451
+
6452
+ PyDoc_STRVAR (Test__doc__ ,
6453
+ "Test (a )\n "
6454
+ "-- \n "
6455
+ "\n "
6456
+ "The deprecation message should use the class name instead of __new__.\n"
6457
+ "\n"
6458
+ "Note: Passing positional arguments to Test() is deprecated. Parameter\n"
6459
+ "\'a\' will become a keyword-only parameter in Python 3.14.\n"
6460
+ "" );
6461
+
6462
+ static PyObject *
6463
+ Test_impl (PyTypeObject * type , PyObject * a );
6464
+
6465
+ static PyObject *
6466
+ Test (PyTypeObject * type , PyObject * args , PyObject * kwargs )
6467
+ {
6468
+ PyObject * return_value = NULL ;
6469
+ #if defined(Py_BUILD_CORE ) && !defined(Py_BUILD_CORE_MODULE )
6470
+
6471
+ #define NUM_KEYWORDS 1
6472
+ static struct {
6473
+ PyGC_Head _this_is_not_used ;
6474
+ PyObject_VAR_HEAD
6475
+ PyObject * ob_item [NUM_KEYWORDS ];
6476
+ } _kwtuple = {
6477
+ .ob_base = PyVarObject_HEAD_INIT (& PyTuple_Type , NUM_KEYWORDS )
6478
+ .ob_item = { & _Py_ID (a ), },
6479
+ };
6480
+ #undef NUM_KEYWORDS
6481
+ #define KWTUPLE (&_kwtuple.ob_base.ob_base)
6482
+
6483
+ #else // !Py_BUILD_CORE
6484
+ # define KWTUPLE NULL
6485
+ #endif // !Py_BUILD_CORE
6486
+
6487
+ static const char * const _keywords [] = {"a" , NULL };
6488
+ static _PyArg_Parser _parser = {
6489
+ .keywords = _keywords ,
6490
+ .fname = "Test" ,
6491
+ .kwtuple = KWTUPLE ,
6492
+ };
6493
+ #undef KWTUPLE
6494
+ PyObject * argsbuf [1 ];
6495
+ PyObject * const * fastargs ;
6496
+ Py_ssize_t nargs = PyTuple_GET_SIZE (args );
6497
+ PyObject * a ;
6498
+
6499
+ // Emit compiler warnings when we get to Python 3.14.
6500
+ #if PY_VERSION_HEX >= 0x030e00C0
6501
+ # error \
6502
+ "In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
6503
+ " 'Test.__new__' to be keyword-only."
6504
+ #elif PY_VERSION_HEX >= 0x030e00A0
6505
+ # ifdef _MSC_VER
6506
+ # pragma message ( \
6507
+ "In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
6508
+ " 'Test.__new__' to be keyword-only.")
6509
+ # else
6510
+ # warning \
6511
+ "In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
6512
+ " 'Test.__new__' to be keyword-only."
6513
+ # endif
6514
+ #endif
6515
+ if (nargs == 1 ) {
6516
+ if (PyErr_WarnEx (PyExc_DeprecationWarning ,
6517
+ "Passing positional arguments to Test() is deprecated. Parameter "
6518
+ "'a' will become a keyword-only parameter in Python 3.14." , 1 ))
6519
+ {
6520
+ goto exit ;
6521
+ }
6522
+ }
6523
+ fastargs = _PyArg_UnpackKeywords (_PyTuple_CAST (args )-> ob_item , nargs , kwargs , NULL , & _parser , 1 , 1 , 0 , argsbuf );
6524
+ if (!fastargs ) {
6525
+ goto exit ;
6526
+ }
6527
+ a = fastargs [0 ];
6528
+ return_value = Test_impl (type , a );
6529
+
6530
+ exit :
6531
+ return return_value ;
6532
+ }
6533
+
6534
+ static PyObject *
6535
+ Test_impl (PyTypeObject * type , PyObject * a )
6536
+ /*[clinic end generated code: output=d15a69ea37ec6502 input=f133dc077aef49ec]*/
6537
+
6538
+
6539
+ /*[clinic input]
6540
+ m.T.__init__
6541
+ * [from 3.14]
6542
+ a: object
6543
+ The deprecation message should use the class name instead of __init__.
6544
+ [clinic start generated code]*/
6545
+
6546
+ PyDoc_STRVAR (m_T___init____doc__ ,
6547
+ "T (a )\n "
6548
+ "-- \n "
6549
+ "\n "
6550
+ "The deprecation message should use the class name instead of __init__.\n"
6551
+ "\n"
6552
+ "Note: Passing positional arguments to m.T() is deprecated. Parameter\n"
6553
+ "\'a\' will become a keyword-only parameter in Python 3.14.\n"
6554
+ "" );
6555
+
6556
+ static int
6557
+ m_T___init___impl (TestObj * self , PyObject * a );
6558
+
6559
+ static int
6560
+ m_T___init__ (PyObject * self , PyObject * args , PyObject * kwargs )
6561
+ {
6562
+ int return_value = -1 ;
6563
+ #if defined(Py_BUILD_CORE ) && !defined(Py_BUILD_CORE_MODULE )
6564
+
6565
+ #define NUM_KEYWORDS 1
6566
+ static struct {
6567
+ PyGC_Head _this_is_not_used ;
6568
+ PyObject_VAR_HEAD
6569
+ PyObject * ob_item [NUM_KEYWORDS ];
6570
+ } _kwtuple = {
6571
+ .ob_base = PyVarObject_HEAD_INIT (& PyTuple_Type , NUM_KEYWORDS )
6572
+ .ob_item = { & _Py_ID (a ), },
6573
+ };
6574
+ #undef NUM_KEYWORDS
6575
+ #define KWTUPLE (&_kwtuple.ob_base.ob_base)
6576
+
6577
+ #else // !Py_BUILD_CORE
6578
+ # define KWTUPLE NULL
6579
+ #endif // !Py_BUILD_CORE
6580
+
6581
+ static const char * const _keywords [] = {"a" , NULL };
6582
+ static _PyArg_Parser _parser = {
6583
+ .keywords = _keywords ,
6584
+ .fname = "T" ,
6585
+ .kwtuple = KWTUPLE ,
6586
+ };
6587
+ #undef KWTUPLE
6588
+ PyObject * argsbuf [1 ];
6589
+ PyObject * const * fastargs ;
6590
+ Py_ssize_t nargs = PyTuple_GET_SIZE (args );
6591
+ PyObject * a ;
6592
+
6593
+ // Emit compiler warnings when we get to Python 3.14.
6594
+ #if PY_VERSION_HEX >= 0x030e00C0
6595
+ # error \
6596
+ "In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
6597
+ " 'm.T.__init__' to be keyword-only."
6598
+ #elif PY_VERSION_HEX >= 0x030e00A0
6599
+ # ifdef _MSC_VER
6600
+ # pragma message ( \
6601
+ "In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
6602
+ " 'm.T.__init__' to be keyword-only.")
6603
+ # else
6604
+ # warning \
6605
+ "In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
6606
+ " 'm.T.__init__' to be keyword-only."
6607
+ # endif
6608
+ #endif
6609
+ if (nargs == 1 ) {
6610
+ if (PyErr_WarnEx (PyExc_DeprecationWarning ,
6611
+ "Passing positional arguments to m.T() is deprecated. Parameter "
6612
+ "'a' will become a keyword-only parameter in Python 3.14." , 1 ))
6613
+ {
6614
+ goto exit ;
6615
+ }
6616
+ }
6617
+ fastargs = _PyArg_UnpackKeywords (_PyTuple_CAST (args )-> ob_item , nargs , kwargs , NULL , & _parser , 1 , 1 , 0 , argsbuf );
6618
+ if (!fastargs ) {
6619
+ goto exit ;
6620
+ }
6621
+ a = fastargs [0 ];
6622
+ return_value = m_T___init___impl ((TestObj * )self , a );
6623
+
6624
+ exit :
6625
+ return return_value ;
6626
+ }
6627
+
6628
+ static int
6629
+ m_T___init___impl (TestObj * self , PyObject * a )
6630
+ /*[clinic end generated code: output=ef43c425816a549f input=f71b51dbe19fa657]*/
0 commit comments