Benjamin Peterson
86ac22e338
Merged revisions 82637 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82637 | benjamin.peterson | 2010-07-07 17:45:06 -0500 (Wed, 07 Jul 2010) | 1 line
ValueError in this case is also acceptable
........
2010-07-07 23:26:57 +00:00
Benjamin Peterson
489113fd5f
Merged revisions 82628,82630 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82628 | benjamin.peterson | 2010-07-07 13:44:05 -0500 (Wed, 07 Jul 2010) | 1 line
this needn't be in the loop
........
r82630 | benjamin.peterson | 2010-07-07 13:54:59 -0500 (Wed, 07 Jul 2010) | 1 line
don't ignore exceptions from PyObject_IsTrue
........
2010-07-07 19:03:36 +00:00
Mark Dickinson
40228912c8
Fix possible undefined behaviour from signed overflow in struct module.
...
Backport of revisions 81897, 81898 and 81902 from py3k.
2010-06-11 20:27:05 +00:00
Mark Dickinson
fdaaa9c9d8
Issue #8300 (__index__ handling in struct.pack): Remove redundant check
...
and improve test coverage. Thanks Meador Inge for the patch.
2010-04-04 08:43:04 +00:00
Ezio Melotti
a28eb1c429
Use more specific assert* methods in test_struct.
2010-04-04 07:00:02 +00:00
Mark Dickinson
4846a8e828
Issue #8300 : Let struct.pack use __index__ to convert and pack non-integers.
...
Based on a patch by Meador Inge.
2010-04-03 14:05:10 +00:00
Florent Xicluna
db4a321fea
Cleanup test_struct using check_warnings.
2010-03-20 22:21:02 +00:00
Mark Dickinson
154b7ad07e
Issue #1530559 : When packing a non-integer with any integer conversion
...
code using struct.pack, attempt to convert to an integer first using
the argument's __int__ method (if present). Also raise a
DeprecationWarning for any such usage of __int__.
This fixes a regression from 2.6, where some (but not all) integer
conversion codes already used __int__.
2010-03-07 16:24:45 +00:00
Mark Dickinson
1c0c78c61f
Fix incorrect stacklevel for DeprecationWarnings originating from the struct module.
...
Also clean up related tests in test_struct.
The stacklevel fix should be backported to 2.6 once that branch is unfrozen.
2010-03-05 14:36:20 +00:00
Georg Brandl
a4f46e1292
Remove unused imports in test modules.
2010-02-07 17:03:15 +00:00
Senthil Kumaran
ce8e33a095
Reverting the Revision: 77368. I committed Flox's big patch for tests by
...
mistake. ( It may come in for sure tough)
2010-01-08 19:04:16 +00:00
Senthil Kumaran
3ddc435af6
Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox
2010-01-08 18:41:40 +00:00
Mark Dickinson
5fd3af24a2
Issue #1523 : Remove deprecated overflow masking in struct module, and
...
make sure that out-of-range values consistently raise struct.error.
2009-07-07 15:08:28 +00:00
Mark Dickinson
bb3895cfc6
Expand test coverage for struct.pack with native integer packing;
...
reorganize the test_struct module to remove duplicated code and tests.
2009-07-07 14:15:45 +00:00
Mark Dickinson
ca6b5f36f4
Add skipping to struct test that only applies when overflow masking is in effect
2009-07-07 11:08:23 +00:00
Mark Dickinson
463dc4bf26
Issues #1530559 , #1741130 : Fix various inconsistencies in struct.pack
...
integer packing, and reenable some previously broken tests.
2009-07-05 10:01:24 +00:00
Benjamin Peterson
5c8da86f3a
convert usage of fail* to assert*
2009-06-30 22:57:08 +00:00
Gregory P. Smith
2839985c7e
The unittest.TestCase.assertEqual() now displays the differences in lists,
...
tuples, dicts and sets on failure.
Many new handy type and comparison specific assert* methods have been added
that fail with error messages actually useful for debugging. Contributed in
by Google and completed with help from mfoord and GvR at PyCon 2009 sprints.
Discussion lives in http://bugs.python.org/issue2578 .
2009-03-31 16:54:10 +00:00
Georg Brandl
0638a08a4b
#3694 : add test for fix committed in r66693.
2009-02-13 11:03:59 +00:00
Mark Dickinson
4015f62e39
Issue #5175 : PyLong_AsUnsignedLongLong now raises OverflowError for
...
negative arguments. Previously, it raised TypeError.
Thanks Lisandro Dalcin.
2009-02-10 15:46:50 +00:00
Georg Brandl
6269fec171
#4228 : Pack negative values the same way as 2.4
...
in struct's L format.
2009-01-01 12:15:31 +00:00
Brett Cannon
672237dc6c
warnings.catch_warnings() now returns a list or None instead of the custom
...
WarningsRecorder object. This makes the API simpler to use as no special object
must be learned.
Closes issue 3781.
Review by Benjamin Peterson.
2008-09-09 00:49:16 +00:00
Mark Hammond
69ed524045
Fix bug 3625: test issues on 64bit windows. r=pitrou
2008-08-23 00:59:14 +00:00
Nick Coghlan
38469e2719
Make test.test_support.catch_warnings more robust as discussed on python-dev. Also add explicit tests for itto test_warnings.
2008-07-13 12:23:47 +00:00
Gregory P. Smith
a0205d0a46
silence the test when it is skipped on some platforms. should fix a
...
buildbot.
2008-06-14 17:34:09 +00:00
Gregory P. Smith
9d53457e59
Merge in release25-maint r60793:
...
Added checks for integer overflows, contributed by Google. Some are
only available if asserts are left in the code, in cases where they
can't be triggered from Python code.
2008-06-11 07:41:16 +00:00
Benjamin Peterson
d5299866f9
convert test_struct to a unittest thanks to Giampaolo Rodola
...
I had to disable one test because it was functioning incorrectly, see #1530559
I also removed the debugging prints
2008-06-11 01:31:28 +00:00
Mark Dickinson
c23b8a7af9
Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
...
across platforms: it should now raise OverflowError on all
platforms. (Previously it raised OverflowError only on
non IEEE 754 platforms.)
Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
2008-03-14 14:23:37 +00:00
Thomas Heller
f3c0559b5e
Issue 1872: Changed the struct module typecode from 't' to '?', for
...
compatibility with PEP3118.
2008-03-05 15:34:29 +00:00
Brett Cannon
2ee4128e9b
Remove test.test_support.guard_warnings_filter.
...
test.test_support.catch_warning is more full-featured and provides the same
functionality.
Since guard_warnings_filter was added in 2.6 there is no
backwards-compatibility issues.
2007-08-14 05:51:06 +00:00
Raymond Hettinger
7a3d41f4ca
Bug #1563759 : struct.unpack doens't support buffer protocol objects
2007-04-05 18:00:03 +00:00
Tim Peters
f733abb783
Whitespace normalization.
2007-01-30 03:03:46 +00:00
Martin v. Löwis
aef4c6bc00
Patch #1610575 : Add support for _Bool to struct.
2007-01-21 09:33:07 +00:00
Brett Cannon
6d9520c4f0
Add test.test_support.guard_warnings_filter . This function returns a context
...
manager that protects warnings.filter from being modified once the context is
exited.
2006-12-13 23:09:53 +00:00
Bob Ippolito
e6c9f982a0
Fix #1530559 , struct.pack raises TypeError where it used to convert.
...
Passing float arguments to struct.pack when integers are expected
now triggers a DeprecationWarning.
2006-08-04 23:59:21 +00:00
Tim Peters
852eae1bc1
Access _struct attributes directly instead of mucking with getattr.
...
string_reverse(): Simplify.
assertRaises(): Raise TestFailed on failure.
test_unpack_from(), test_pack_into(), test_pack_into_fn(): never
use `assert` to test for an expected result (it doesn't test anything
when Python is run with -O).
2006-06-05 20:48:49 +00:00
Martin Blais
af2ae72cb2
Fixes in struct and socket from merge reviews.
...
- Following Guido's comments, renamed
* pack_to -> pack_into
* recv_buf -> recv_into
* recvfrom_buf -> recvfrom_into
- Made fixes to _struct.c according to Neal Norwitz comments on the checkins
list.
- Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
2006-06-04 13:49:49 +00:00
Tim Peters
c65a13f53b
Whitespace normalization.
2006-06-04 01:22:53 +00:00
Martin Blais
7f7386cfd2
Fixed struct test to not use unittest.
2006-06-02 13:03:43 +00:00
Neal Norwitz
9f16dd026c
On 64-bit platforms running test_struct after test_tarfile would fail
...
since the deprecation warning wouldn't be raised.
2006-05-31 09:02:44 +00:00
Bob Ippolito
4182a75571
Change wrapping terminology to overflow masking
2006-05-30 17:37:54 +00:00
Tim Peters
aba19bc45f
deprecated_err(): Stop bizarre warning messages when the tests
...
are run in the order:
test_genexps (or any other doctest-based test)
test_struct
test_doctest
The `warnings` module needs an advertised way to save/restore
its internal filter list.
2006-05-30 02:25:25 +00:00
Bob Ippolito
2fd3977a9d
struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly)
2006-05-29 22:55:48 +00:00
Bob Ippolito
1fcdc232db
Fix up struct docstrings, add struct.pack_to function for symmetry
2006-05-27 12:11:36 +00:00
Bob Ippolito
aa70a17e13
enable all of the struct tests, use ssize_t, fix some whitespace
2006-05-26 20:25:23 +00:00
Bob Ippolito
e27337b5d0
fix #1229380 No struct.pack exception for some out of range integers
2006-05-26 13:15:44 +00:00
Tim Peters
fe98f9613b
Whitespace normalization.
2006-05-26 12:26:21 +00:00
Martin Blais
2856e5f390
Support for buffer protocol for socket and struct.
...
* Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer
protocol (send and sendto already did).
* Added struct.pack_to(), that is the corresponding buffer compatible method to
unpack_from().
* Fixed minor typos in arraymodule.
2006-05-26 12:03:27 +00:00
Bob Ippolito
eb62127842
refactor unpack, add unpack_from
2006-05-24 15:32:06 +00:00
Armin Rigo
9f90439817
Patch #1011240 : SystemError generated by struct.pack('P', 'foo').
2004-09-27 19:27:51 +00:00