[issue14897] struct.pack raises unexpected error message

2012-10-30 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Matti Mäki wrote:
> I filled up the contributor form and gave it to Petri Lehtinen 2012-10-22

Yeah, and I posted it (along with 14 other contributor forms received
at PyCon Finland) to the PSF last week. They just seem to be a bit
slow to process them.

--

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-30 Thread Matti Mäki

Matti Mäki added the comment:

I filled up the contributor form and gave it to Petri Lehtinen 2012-10-22

--

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-30 Thread Petri Lehtinen

Petri Lehtinen added the comment:

> You probably should have used the word 'fix' rather than 'enhance' here:  
> else it smells like you're putting new features into a maintenance release. 
> :-)

Ah, true. But unfixable now :(

--

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-30 Thread Mark Dickinson

Mark Dickinson added the comment:

> "Enhance error messages of struct.pack and struct.pack_into"

You probably should have used the word 'fix' rather than 'enhance' here:  else 
it smells like you're putting new features into a maintenance release. :-)

--

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Matti Mäki, can you please submit a contributor form?

http://python.org/psf/contrib/contrib-form/
http://python.org/psf/contrib/

--

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-29 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Applied, thanks!

--
nosy: +petri.lehtinen
resolution:  -> fixed
stage: commit review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 626ed0e06fd6 by Petri Lehtinen in branch '2.7':
#14897: Enhance error messages of struct.pack and struct.pack_into
http://hg.python.org/cpython/rev/626ed0e06fd6

New changeset a555bd4026b0 by Petri Lehtinen in branch '3.2':
#14897: Enhance error messages of struct.pack and struct.pack_into
http://hg.python.org/cpython/rev/a555bd4026b0

New changeset 70d5906e0461 by Petri Lehtinen in branch '3.3':
#14897: Enhance error messages of struct.pack and struct.pack_into
http://hg.python.org/cpython/rev/70d5906e0461

New changeset ebc588a3db51 by Petri Lehtinen in branch 'default':
#14897: Enhance error messages of struct.pack and struct.pack_into
http://hg.python.org/cpython/rev/ebc588a3db51

--
nosy: +python-dev

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-24 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
components: +Extension Modules
stage:  -> commit review
versions: +Python 3.4

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-23 Thread Matti Mäki

Matti Mäki added the comment:

A second try, now taking into account buffer and offset params in pack_into.

--
Added file: http://bugs.python.org/file27689/issue14897-2.patch

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-10-23 Thread Matti Mäki

Matti Mäki added the comment:

Changed the error message as suggested by 
http://bugs.python.org/issue14897#msg161493

Also made similar change to struct.pack_into

--
keywords: +patch
nosy: +makimat
Added file: http://bugs.python.org/file27679/issue14897.patch

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-05-25 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe :


--
nosy: +tshepang

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-05-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> It might help if the error message also stated how many arguments were 
> actually received, like the TypeError message already does for bad function / 
> method calls.  E.g., 
> 
> "struct.error: pack expected 2 items for packing (got 1)"

Yes, this would be useful. But seldom implemented.

Traceback (most recent call last):
  File "", line 1, in 
TypeError: not enough arguments for format string
>>> '%s %s'%(123,456,789)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: not all arguments converted during string formatting

struct.pack also inconsistent in other error messages.

Traceback (most recent call last):
  File "", line 1, in 
struct.error: argument for 's' must be a bytes object
>>> struct.pack('i', '123')
Traceback (most recent call last):
  File "", line 1, in 
struct.error: required argument is not an integer

For "s" is mentioned format, and for "i" no. It would be helpful to
mention also the number of the item.

--

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-05-24 Thread Mark Dickinson

Mark Dickinson  added the comment:

It might help if the error message also stated how many arguments were actually 
received, like the TypeError message already does for bad function / method 
calls.  E.g., 

"struct.error: pack expected 2 items for packing (got 1)"

--

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-05-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Funny. struct.pack(fmt, args...) is just an alias to 
struct.Struct(fmt).pack(args...). The error message should be changed to 
explicitly state that we are talking about the data for packing, and not about 
the arguments of function. Or should remove mention of the number of arguments 
at all (leave only "too much" or "too little").

--
nosy: +storchaka

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-05-24 Thread Mark Dickinson

Mark Dickinson  added the comment:

Hmm.  Yes, that's not very clear.  The same message is used both for 
struct.pack and for Struct.pack (which struct.pack is really just a convenient 
alias for);  it makes a bit more sense for the latter:

>>> struct.Struct('1s1s').pack('33')
Traceback (most recent call last):
  File "", line 1, in 
struct.error: pack requires exactly 2 arguments

--
nosy: +mark.dickinson
versions: +Python 3.3

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-05-23 Thread mesheb82

mesheb82  added the comment:

Also, I tested this on Windows in Python 3.2.3 and Windows in Python 2.7.2

--

___
Python tracker 

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



[issue14897] struct.pack raises unexpected error message

2012-05-23 Thread mesheb82

New submission from mesheb82 :

I found some unexpected behavior while working with the struct module.
>>> import struct

This works as expected:
>>> struct.pack('1s1s','3','4')
'34'

In this case, with bad input, the error message says I need 2 arguments, when I 
provide 2 arguments.
>>> struct.pack('1s1s','33')
Traceback (most recent call last):
  File "", line 1, in 
struct.error: pack requires exactly 2 arguments

--
components: IO
messages: 161481
nosy: mesheb82
priority: normal
severity: normal
status: open
title: struct.pack raises unexpected error message
type: behavior
versions: Python 2.7, Python 3.2

___
Python tracker 

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