[issue19985] Not so correct error message when initializing Struct with ill argument

2017-09-13 Thread Xiang Zhang

Changes by Xiang Zhang :


--
versions: +Python 3.6, Python 3.7 -Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2017-09-13 Thread Xiang Zhang

Changes by Xiang Zhang :


--
dependencies: +fix several error messages in struct -Document whether it's safe 
to use bytes for struct format string
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2017-09-13 Thread Martin Panter

Martin Panter added the comment:

For Python 2.7, this change doesn’t seem important enough for a bug fix.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2016-04-14 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +Document whether it's safe to use bytes for struct format string 
-Not so correct error message when initializing Struct with ill argument

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2016-04-14 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +Not so correct error message when initializing Struct with ill 
argument

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2015-02-16 Thread Martin Panter

Martin Panter added the comment:

Closely related:

* Issue 16349: document byte string format argument support
* Issue 21071: should the Struct.format property be bytes or text?

--
nosy: +vadmium

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19985
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2013-12-15 Thread Vajrasky Kok

Vajrasky Kok added the comment:

And here is the patch to better error message in Python 2.7.

--
Added file: 
http://bugs.python.org/file33144/better_error_message_struct_python_27.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19985
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2013-12-15 Thread Vajrasky Kok

New submission from Vajrasky Kok:

Python 3.4 (3.3 is also afflicted:

 import struct
 struct.Struct(3)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: Struct() argument 1 must be a bytes object, not int
 struct.Struct('b')
Struct object at 0x7fec04763180

Python 2.7:

 import struct
 struct.Struct(3)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: Struct() argument 1 must be string, not int
 struct.Struct(u'b')
Struct object at 0x17993e8

Here is the patch to better error message for Python 3.4 and 3.3.

--
components: Extension Modules
files: better_error_message_struct_python_34_and_33.patch
keywords: patch
messages: 206218
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Not so correct error message when initializing Struct with ill argument
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: 
http://bugs.python.org/file33143/better_error_message_struct_python_34_and_33.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19985
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2013-12-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think that error message in 2.7 is correct. String means both str and 
unicode.

As for 3.x, agree, it should be corrected. But I prefer str or bytes or 
string or bytes object.

--
nosy: +serhiy.storchaka
versions:  -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19985
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2013-12-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +mark.dickinson, meador.inge

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19985
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19985] Not so correct error message when initializing Struct with ill argument

2013-12-15 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the patch to address Serhiy's request.

Hmmm, if string means both string and unicode in Python 2.7, should we fix 
these behaviours?

 import _csv
 _csv.register_dialect(2)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: dialect name must be a string or unicode
 ' cute cat '.strip(3)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: strip arg must be None, str or unicode
 import sqlite3
 conn = sqlite3.connect(':memory:')
 c = conn.cursor()
 c.execute(3)
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: operation parameter must be str or unicode

--
Added file: 
http://bugs.python.org/file33148/better_error_message_struct_python_34_and_33_v2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19985
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com