[New-bugs-announce] [issue24939] Remove unicode_fornat.h from stringlib

Eric V. Smith report at bugs.python.org
Tue Aug 25 23:30:11 CEST 2015


New submission from Eric V. Smith:

Objects/stringlib/unicode_format.h does not belong in stringlib. Back when it was originally written for 2.x, it used stringlib to provide the str and unicode versions of str.format, str.__format__, int.__format__, etc.

However, in 3.x, and especially with PEP 393 (Flexible String Representation), not only is the stringlib functionality no longer needed, it's not used at all.

My suggestion is to just copy the source into Objects/unicodeobject.c, which is the only place it's used. Then delete the stringlib file.

The only downside of including it in unicodeobject.c is that it makes our largest C file about 8% larger:

wc -l says:
1284  Objects/stringlib/unicode_format.h
15414 Objects/unicodeobject.c

There's some argument to be made to separate out the int.__format__, float.__format__ etc. code, and move them to some other library. I don't think they're a huge part of unicode_format.h. And to separate them out would require creating some _Py_* functions to do their work. But it's probably the right thing to do. I'll investigate.

----------
assignee: eric.smith
components: Interpreter Core
messages: 249160
nosy: eric.smith
priority: normal
severity: normal
status: open
title: Remove unicode_fornat.h from stringlib
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24939>
_______________________________________


More information about the New-bugs-announce mailing list