8000 SQLAlchemy 1.4: Fix building the C extension on Python 3.13 by musicinmybrain · Pull Request #11500 · sqlalchemy/sqlalchemy · GitHub
[go: up one dir, main page]

Skip to content

SQLAlchemy 1.4: Fix building the C extension on Python 3.13 #11500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Convers 8000 ations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion lib/sqlalchemy/cextension/resultproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,37 @@ typedef struct {

static PyTypeObject tuplegetter_type;

static int
PyArg_NoKeywords(const char *funcname, PyObject *kwargs)
{
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 13
/* Based on the one in CPython, removed from the public headers in 3.13
* (https://github.com/python/cpython/issues/110964)
*/
if (kwargs == NULL)
return 1;
if (!PyDict_CheckExact(kwargs)) {
PyErr_BadInternalCall();
return 0;
}
if (PyDict_GET_SIZE(kwargs) == 0)
return 1;

PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", funcname);
return 0;
#else
return _PyArg_NoKeywords(funcname, kwargs);
#endif
}

static PyObject *
tuplegetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
tuplegetterobject *tg;
PyObject *item;
Py_ssize_t nitems;

if (!_PyArg_NoKeywords("tuplegetter", kwds))
if (!PyArg_NoKeywords("tuplegetter", kwds))
return NULL;

nitems = PyTuple_GET_SIZE(args);
Expand Down
0