Extend PyUnicode_FromFormat() · Issue #98836 · python/cpython (original) (raw)

PyUnicode_FromFormat() and several other functions like PyErr_Format() support a subset of printf-like formatting with some extensions to support Python objects. It is a very limited subset, for example %x is supported, but %lx and %X are not.

I propose to add support of more printf features:

The following standard features are intentionally not implemented:

Unlike to printf, unsupported modifiers (like %lc or %10c) raise SystemError instead of be silently ignored. It will allow to add new features without breaking accidentally working code.