You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, a patch for 2.6 should be provided as well. Besides,
PyExc_OverflowError is probably a better choice than PyExc_IndexError
(but I'm not sure on this one).
devdanzin commented on Feb 11, 2009
devdanzinmannequin
MannequinAuthor
More actions
Looks like both Undetected errors were corrected by Victor's patches,
which Benjamin committed around rev66693, so trunk only needs a test.
Here are the patches.
I think IndexError fits better (and matches trunk), as the issue is that
None is passed as "offset", which should be an Integral. If you
disagree, I'll modify the patch. Is PyErr_Format'ing the exception desired?
BTW, there's a warning in _struct.c:180 -> warning: ‘get_ulong’ defined
but not used, should I open a new issue?
BTW, there's a warning in _struct.c:180 -> warning: ‘get_ulong’
defined but not used, should I open a new issue?
Sure. Please could you add me to the nosy list if you do.
In my opinion, the struct module *really* needs an overhaul, especially
for py3k; there's a lot of inconsistency in the behaviour with respect
to different integer types, and there's a lot of code that seems to be
there purely for backwards compatibility that could be removed for 3.1
(and probably for 2.7 as well): for example, allowing floats when
packing integer types, and allowing overflow to wraparound rather than
raising an exception.
Would it be worth opening a general 'overhaul the struct module' issue
and marking all the current struct bugs as dependencies for this issue?
devdanzin commented on Feb 16, 2009
devdanzinmannequin
MannequinAuthor
More actions
> BTW, there's a warning in _struct.c:180 -> warning: 'get_ulong'
> defined but not used, should I open a new issue?
Sure. Please could you add me to the nosy list if you do.
OK, should do that soon.
In my opinion, the struct module *really* needs an overhaul, especially
for py3k; there's a lot of inconsistency in the behaviour with respect
to different integer types, and there's a lot of code that seems to be
there purely for backwards compatibility that could be removed for 3.1
(and probably for 2.7 as well): for example, allowing floats when
packing integer types, and allowing overflow to wraparound rather than
raising an exception.
Would it be worth opening a general 'overhaul the struct module' issue
and marking all the current struct bugs as dependencies for this issue?
I can't judge on the merit of struct's shortcomings, but I'll propose
the 'umbrella issue' idea for other targets (socket, HTMLParser,
etc.) on python-dev and can suggest one for struct too.
Activity
devdanzin commentedon Aug 27, 2008
The following code leads to XXX Undetected errors in debug builds of
trunk and 3.0:
Besides that, there's something fishy happening in non-debug builds:
Found with Fusil.
birkenfeld commentedon Aug 27, 2008
The problem is that, unlike PyInt_AsSsize_t, PyLong_AsSsize_t expects
its argument to already be a long object and else raises the SystemError.
It should probably behave like PyInt_AsSsize_t and raise the TypeError
since in 3.0 it's used in many places where PyInt_AsSsize_t was used.
birkenfeld commentedon Aug 27, 2008
The attached patches at least correct the XXX undetected error.
amauryfa commentedon Aug 27, 2008
Isn't PyNumber_AsSsize_t designed for this purpose?
pitrou commentedon Feb 10, 2009
Yes, PyNumber_AsSsize_t() should be used instead.
pitrou commentedon Feb 10, 2009
Oh, and a test should be added :)
devdanzin commentedon Feb 10, 2009
Here's a patch with test for 3.x. Erm, I have no idea if that's all that
is necessary :)
Does this have the potential to break existing code?
pitrou commentedon Feb 10, 2009
Well, a patch for 2.6 should be provided as well. Besides,
PyExc_OverflowError is probably a better choice than PyExc_IndexError
(but I'm not sure on this one).
devdanzin commentedon Feb 11, 2009
Looks like both Undetected errors were corrected by Victor's patches,
which Benjamin committed around rev66693, so trunk only needs a test.
Here are the patches.
I think IndexError fits better (and matches trunk), as the issue is that
None is passed as "offset", which should be an Integral. If you
disagree, I'll modify the patch. Is PyErr_Format'ing the exception desired?
BTW, there's a warning in _struct.c:180 -> warning: ‘get_ulong’ defined
but not used, should I open a new issue?
birkenfeld commentedon Feb 13, 2009
Applied in r69577, r69578.
mdickinson commentedon Feb 13, 2009
Sure. Please could you add me to the nosy list if you do.
In my opinion, the struct module *really* needs an overhaul, especially
for py3k; there's a lot of inconsistency in the behaviour with respect
to different integer types, and there's a lot of code that seems to be
there purely for backwards compatibility that could be removed for 3.1
(and probably for 2.7 as well): for example, allowing floats when
packing integer types, and allowing overflow to wraparound rather than
raising an exception.
Would it be worth opening a general 'overhaul the struct module' issue
and marking all the current struct bugs as dependencies for this issue?
devdanzin commentedon Feb 16, 2009
OK, should do that soon.
This one looks bad: bpo-2590.
I can't judge on the merit of struct's shortcomings, but I'll propose
the 'umbrella issue' idea for other targets (socket, HTMLParser,
etc.) on python-dev and can suggest one for struct too.