mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-02 20:53:37 +02:00
Fix NULL address check and add docstring to set_uint_at_address
This commit is contained in:
committed by
GitHub
parent
c35ff2e843
commit
f6d813dc26
@@ -689,7 +689,10 @@ set_uint_at_address(PyObject *self UNUSED, PyObject *args) {
|
||||
unsigned int value;
|
||||
if (!PyArg_ParseTuple(args, "OI", &address_obj, &value)) return NULL;
|
||||
void *ptr = PyLong_AsVoidPtr(address_obj);
|
||||
if (ptr == NULL && PyErr_Occurred()) return NULL;
|
||||
if (ptr == NULL) {
|
||||
if (!PyErr_Occurred()) PyErr_SetString(PyExc_ValueError, "NULL address is not valid");
|
||||
return NULL;
|
||||
}
|
||||
*((unsigned int*)ptr) = value;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@@ -727,7 +730,7 @@ static PyMethodDef module_methods[] = {
|
||||
{"timed_debug_print", (PyCFunction)py_timed_debug_print, METH_VARARGS, ""},
|
||||
{"find_in_memoryview", (PyCFunction)find_in_memoryview, METH_VARARGS, ""},
|
||||
{"run_at_exit_cleanup_functions", (PyCFunction)py_run_atexit_cleanup_functions, METH_NOARGS, ""},
|
||||
{"set_uint_at_address", (PyCFunction)set_uint_at_address, METH_VARARGS, ""},
|
||||
{"set_uint_at_address", (PyCFunction)set_uint_at_address, METH_VARARGS, "Write an unsigned integer value to a memory address"},
|
||||
#ifdef __APPLE__
|
||||
METHODB(user_cache_dir, METH_NOARGS),
|
||||
METHODB(process_group_map, METH_NOARGS),
|
||||
|
||||
Reference in New Issue
Block a user