Fixes a bug where calling assign_device with readonly keyword parameter
raises exception stating it takes no keyword arguments.
Context_assign_device has positional and keyword arguments. Adds
flags METH_KEYWORDS in method declaration (see Context_methods).
Replaces format string in PyArg_ParseTupleAndKeywords from "s|p" to
"s|$p". Adds $ after |, meaning all later optional arguments are
also keyword only.
(See https://docs.python.org/3/c-api/arg.html#other-objects)
Empty names in the kwlist array correspond to positional arguments.
Replaces fname variable name with device for better readability.
Fixes 88c7374db2
("context: check self->cxt and rc in assign_device")