Skip to content

Commit 36da74b

Browse files
Apply ruff/pyupgrade rule UP036
UP036 Version block is outdated for minimum Python version Lots of manual fixes here, in order to discard Python 2 aliases. Co-authored-by: Matti Picus <matti.picus@gmail.com>
1 parent ee1a87b commit 36da74b

26 files changed

+388
-636
lines changed

src/c/ffi_obj.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,17 +447,17 @@ static PyObject *ffi_cast(FFIObject *self, PyObject *args)
447447
}
448448

449449
PyDoc_STRVAR(ffi_string_doc,
450-
"Return a Python string (or unicode string) from the 'cdata'. If\n"
450+
"Return a Python string from the 'cdata'. If\n"
451451
"'cdata' is a pointer or array of characters or bytes, returns the\n"
452452
"null-terminated string. The returned string extends until the first\n"
453453
"null character, or at most 'maxlen' characters. If 'cdata' is an\n"
454454
"array then 'maxlen' defaults to its length.\n"
455455
"\n"
456-
"If 'cdata' is a pointer or array of wchar_t, returns a unicode string\n"
456+
"If 'cdata' is a pointer or array of wchar_t, returns a string\n"
457457
"following the same rules.\n"
458458
"\n"
459459
"If 'cdata' is a single character or byte or a wchar_t, returns it as a\n"
460-
"string or unicode string.\n"
460+
"string.\n"
461461
"\n"
462462
"If 'cdata' is an enum, returns the value of the enumerator as a\n"
463463
"string, or 'NUMBER' if the value is out of range.");
@@ -467,13 +467,13 @@ PyDoc_STRVAR(ffi_string_doc,
467467

468468
PyDoc_STRVAR(ffi_unpack_doc,
469469
"Unpack an array of C data of the given length,\n"
470-
"returning a Python string/unicode/list.\n"
470+
"returning a Python string/list.\n"
471471
"\n"
472472
"If 'cdata' is a pointer to 'char', returns a byte string.\n"
473473
"It does not stop at the first null. This is equivalent to:\n"
474474
"ffi.buffer(cdata, length)[:]\n"
475475
"\n"
476-
"If 'cdata' is a pointer to 'wchar_t', returns a unicode string.\n"
476+
"If 'cdata' is a pointer to 'wchar_t', returns a string.\n"
477477
"'length' is measured in wchar_t's; it is not the size in bytes.\n"
478478
"\n"
479479
"If 'cdata' is a pointer to anything else, returns a list of\n"
@@ -662,7 +662,7 @@ static PyObject *ffi_getctype(FFIObject *self, PyObject *args, PyObject *kwds)
662662
if (add_paren)
663663
p[replace_with_len] = ')';
664664

665-
/* bytes -> unicode string */
665+
/* bytes -> string */
666666
u = PyUnicode_DecodeLatin1(PyBytes_AS_STRING(res),
667667
PyBytes_GET_SIZE(res),
668668
NULL);
@@ -696,7 +696,7 @@ PyDoc_STRVAR(ffi_from_handle_doc,
696696
PyDoc_STRVAR(ffi_from_buffer_doc,
697697
"Return a <cdata 'char[]'> that points to the data of the given Python\n"
698698
"object, which must support the buffer interface. Note that this is\n"
699-
"not meant to be used on the built-in types str or unicode\n"
699+
"not meant to be used on the built-in types str or bytes\n"
700700
"(you can build 'char[]' arrays explicitly) but only on objects\n"
701701
"containing large quantities of raw data in some other format, like\n"
702702
"'array.array' or numpy arrays.");

src/c/lib_obj.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,7 @@ static PyObject *address_of_global_var(PyObject *args)
695695
if (!PyArg_ParseTuple(args, "O!s", &Lib_Type, &lib, &varname))
696696
return NULL;
697697

698-
/* rebuild a string from 'varname', to do typechecks and to force
699-
a unicode back to a plain string (on python 2) */
698+
/* rebuild a string from 'varname', to do typechecks */
700699
o_varname = PyUnicode_FromString(varname);
701700
if (o_varname == NULL)
702701
return NULL;

0 commit comments

Comments
 (0)