Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-132987: Support __index__() in the select.kqueue_event constructor #133094

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-132987: Support __index__() in the select.kqueue_event constructor
  • Loading branch information
serhiy-storchaka committed Apr 28, 2025
commit bf48d7c75970139a6d02b96dfd0bc9c4ce56e7fb
23 changes: 18 additions & 5 deletions 23 Modules/selectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1922,14 +1922,27 @@ kqueue_event_init(PyObject *op, PyObject *args, PyObject *kwds)
return -1;
}

if (PyLong_Check(pfd)) {
self->e.ident = PyLong_AsSize_t(pfd);
if (PyIndex_Check(pfd)) {
Py_ssize_t bytes = PyLong_AsNativeBytes(pfd,
self->e.ident, sizeof(self->e.ident),
Py_ASNATIVEBYTES_NATIVE_ENDIAN |
Py_ASNATIVEBYTES_ALLOW_INDEX |
Py_ASNATIVEBYTES_REJECT_NEGATIVE |
Py_ASNATIVEBYTES_UNSIGNED_BUFFER);
if (bytes < 0) {
return -1;
}
if ((size_t)bytes > sizeof(self->e.ident)) {
PyErr_SetString(PyExc_OverflowError,
"Python int too large for C uintptr_t");
serhiy-storchaka marked this conversation as resolved.
Show resolved Hide resolved
return -1;
}
}
else {
self->e.ident = PyObject_AsFileDescriptor(pfd);
}
if (PyErr_Occurred()) {
return -1;
if (PyErr_Occurred()) {
return -1;
}
}
return 0;
}
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.