Louie Lu added the comment:

> 1. Using global variable doesn't look good to me.

That's true, but I'm not sure if there have other methods to do this.

If not using global variable, we will need to change a bunch of the
function arguments. Since the arguments didn't contain the
information about which item is in the process and raise the error.


> 2. "at offset 1" looks confusing to me. What is offset?

Make the change to: 
>>> struct.pack('hh', , 0x7FFFF, 0x8FFFF)
struct.error: 'h' format requires -32768 <= number <= 32767, got bad value at 
item 2

(or probably, "got bad value at index 2")

> 3. It is not safe to use the fixed length array for formatting error message. 
> Once the underlying error message can be changed and will overflow the buffer.

Change to snprintf.

> The "%zd" format in sprintf() is not portable.

Change to "%ld"

----------

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

Reply via email to