Fix some method declarations for Python API compat

This commit is contained in:
Kovid Goyal 2024-12-24 22:22:12 +05:30
parent bc612a5437
commit 155990ce0b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 8 additions and 8 deletions

View file

@ -939,7 +939,7 @@ - (BOOL)openFileURLs:(NSPasteboard*)pasteboard
}
static PyObject*
cocoa_get_lang(PyObject UNUSED *self) {
cocoa_get_lang(PyObject UNUSED *self, PyObject *args UNUSED) {
@autoreleasepool {
NSString* lang_code = [[NSLocale currentLocale] languageCode];
NSString* country_code = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];

View file

@ -1035,7 +1035,7 @@ static CTFontRef nerd_font(CGFloat sz) {
}
static PyObject*
get_variation(CTFace *self) {
get_variation(CTFace *self, PyObject *args UNUSED) {
RAII_CoreFoundation(CFDictionaryRef, src, CTFontCopyVariation(self->ct_font));
return variation_to_python(src);
}
@ -1062,7 +1062,7 @@ static CTFontRef nerd_font(CGFloat sz) {
static PyObject*
get_variable_data(CTFace *self) {
get_variable_data(CTFace *self, PyObject *args UNUSED) {
if (!ensure_name_table(self)) return NULL;
RAII_PyObject(output, PyDict_New());
if (!output) return NULL;
@ -1078,7 +1078,7 @@ static CTFontRef nerd_font(CGFloat sz) {
}
static PyObject*
identify_for_debug(CTFace *self) {
identify_for_debug(CTFace *self, PyObject *args UNUSED) {
RAII_PyObject(features, PyTuple_New(self->font_features.count)); if (!features) return NULL;
char buf[128];
for (unsigned i = 0; i < self->font_features.count; i++) {
@ -1095,13 +1095,13 @@ static CTFontRef nerd_font(CGFloat sz) {
// Boilerplate {{{
static PyObject*
display_name(CTFace *self) {
display_name(CTFace *self, PyObject *args UNUSED) {
CFStringRef dn = CTFontCopyDisplayName(self->ct_font);
return convert_cfstring(dn, true);
}
static PyObject*
postscript_name(CTFace *self) {
postscript_name(CTFace *self, PyObject *args UNUSED) {
return self->postscript_name ? Py_BuildValue("O", self->postscript_name) : PyUnicode_FromString("");
}

View file

@ -42,14 +42,14 @@
#include <xlocale.h>
static PyObject*
user_cache_dir(void) {
user_cache_dir(PyObject *self UNUSED, PyObject *args UNUSED) {
static char buf[1024];
if (!confstr(_CS_DARWIN_USER_CACHE_DIR, buf, sizeof(buf) - 1)) return PyErr_SetFromErrno(PyExc_OSError);
return PyUnicode_FromString(buf);
}
static PyObject*
process_group_map(void) {
process_group_map(PyObject *self UNUSED, PyObject *args UNUSED) {
int num_of_processes = proc_listallpids(NULL, 0);
size_t bufsize = sizeof(pid_t) * (num_of_processes + 1024);
RAII_ALLOC(pid_t, buf, malloc(bufsize));