[Python-Dev] Split unicodeobject.c into subfiles?

Andrew Svetlov andrew.svetlov at gmail.com
Thu Oct 4 22:47:00 CEST 2012


I like the idea. From my perspective better to use subdirectory to
sake of easy finding in grep style.

On Thu, Oct 4, 2012 at 11:30 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> Hi,
>
> I would like to split the huge unicodeobject.c file into smaller
> files. It's just the longest C file of CPython: 14,849 lines.
>
> I don't know exactly how to split it, but first I would like to know
> if you would agree with the idea.
>
> Example:
>  - Objects/unicode/codecs.c
>  - Objects/unicode/mod_format.c
>  - Objects/unicode/methods.c
>  - Objects/unicode/operators.c
>  - etc.
>
> I don't know if it's better to use a subdirectory, or use a prefix for
> new files: Objects/unicode_methods.c, Objects/unicode_codecs.c, etc.
> There is already a Python/codecs.c file for example (same filename).
>
> I would like to split the unicodeobject.c because it's hard to
> navigate in this huge file between all functions, variables, types,
> macros, etc. It's hard to add new code and to fix bugs. For example,
> the implementation of str%args takes 1000 lines, 2 types and 10
> functions (since my refactor yesterday, in Python 3.3 the main
> function is 500 lines long :-)).
>
> I only see one argument against such refactoring: it will be harder to
> backport/forwardport bugfixes.
>
> Victor
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com



-- 
Thanks,
Andrew Svetlov


More information about the Python-Dev mailing list