File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
lib/sqlalchemy/cextension Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -821,14 +821,37 @@ typedef struct {
821
821
822
822
static PyTypeObject tuplegetter_type ;
823
823
824
+ static int
825
+ PyArg_NoKeywords (const char * funcname , PyObject * kwargs )
826
+ {
827
+ #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 13
828
+ /* Based on the one in CPython, removed from the public headers in 3.13
829
+ * (https://github.com/python/cpython/issues/110964)
830
+ */
831
+ if (kwargs == NULL )
832
+ return 1 ;
833
+ if (!PyDict_CheckExact (kwargs )) {
834
+ PyErr_BadInternalCall ();
835
+ return 0 ;
836
+ }
837
+ if (PyDict_GET_SIZE (kwargs ) == 0 )
838
+ return 1 ;
839
+
840
+ PyErr_Format (PyExc_TypeError , "%.200s() takes no keyword arguments" , funcname );
841
+ return 0 ;
842
+ #else
843
+ return _PyArg_NoKeywords (funcname , kwargs );
844
+ #endif
845
+ }
846
+
824
847
static PyObject *
825
848
tuplegetter_new (PyTypeObject * type , PyObject * args , PyObject * kwds )
826
849
{
827
850
tuplegetterobject * tg ;
828
851
PyObject * item ;
829
852
Py_ssize_t nitems ;
830
853
831
- if (!_PyArg_NoKeywords ("tuplegetter" , kwds ))
854
+ if (!PyArg_NoKeywords ("tuplegetter" , kwds ))
832
855
return NULL ;
833
856
834
857
nitems = PyTuple_GET_SIZE (args );
You can’t perform that action at this time.
0 commit comments