STINNER Victor added the comment:

New patch version 5 without the "format_converter".


Serhiy Storchaka: I said not about the converter that converts format to bytes 
(it is needed only in Struct.__init__),

For me, it makes sense to check format type earlier than Struct.__init__(), but 
since you like the current code, I'm also ok to leave this part of the code 
unchanged :-)


Serhiy: but about the converter that converts format to the Struct object. It 
is used in all module-level functions.

Sorry, but I dislike this change. Even if multiple functions do the same, for 
me creating a Struct object is not something part of the argument parsing. I 
prefer to keep the following 3 lines in each C function *body* to ease 
debugging:

    PyObject *s_object = cache_struct(format);
    if (s_object == NULL)
        return NULL;

IMHO my struct_fastcall-5.patch is already big enough. I prefer incremental 
changes.

I have no strong opinion on cache_struct(), just a matter of taste :-) And 
others may like your change!

Feel free to write your own patch on top of mine, once mine is merged ;-)

----------
Added file: http://bugs.python.org/file46434/struct_fastcall-5.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29300>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to