[Python-Dev] C code: %s vs %U

Ethan Furman ethan at stoneleaf.us
Wed Mar 26 14:06:28 CET 2014


On 03/26/2014 03:48 AM, Antoine Pitrou wrote:
> On Tue, 25 Mar 2014 18:43:30 -0700
> Ethan Furman <ethan at stoneleaf.us> wrote:
>> %s is a string.
>>
>> %U is unicode?
>
> What is the context?

A patch I'm adapting has these lines:

   static PyObject*
   module_getattr(PyObject *m, PyObject *name)
   {
       char *mod_name_str;
       ...
       PyErr_Format(PyExc_AttributeError,
                   "module '%s' has no attribute '%U'", mod_name_str, name);

So it looks like %s is referring to a simple string, and %U is referring to a PyObject, but I was hoping for verification.

--
~Ethan~


More information about the Python-Dev mailing list