font_render (PyObject* self, PyObject* args)
{
TTF_Font* font = PyFont_AsFont (self);
int aa;
PyObject* text, *final;
PyObject* fg_rgba_obj, *bg_rgba_obj = NULL;
Uint8 rgba[4];
SDL_Surface* surf;
SDL_Color foreg, backg;
int just_return;
just_return = 0;
if (!PyArg_ParseTuple (args, "OiO|O", &text, &aa, &fg_rgba_obj,
&bg_rgba_obj))
return NULL;
if (!RGBAFromColorObj (fg_rgba_obj, rgba))
return RAISE (PyExc_TypeError, "Invalid foreground RGBA argument");
foreg.r = rgba[0];
foreg.g = rgba[1];
foreg.b = rgba[2];
if (bg_rgba_obj)
{
if (!RGBAFromColorObj (bg_rgba_obj, rgba))
return RAISE (PyExc_TypeError, "Invalid background RGBA argument");
backg.r = rgba[0];
backg.g = rgba[1];
backg.b = rgba[2];
backg.unused = 0;
}
else
{
backg.r = 0;
backg.g = 0;
backg.b = 0;
backg.unused = 0;
}
<snip>
While I haven't traced through all the code, it seems clear that if you pass a parameter for the background, the function will check if it's a valid RGBA argument, and raise a TypeError if it isn't.
I have found similar things in pygame before, although I can't recall the details.
In any event, if you don't want a background apramter, leave it out; None won't work whatever you do.