Serhiy Storchaka
b8285d96f4
Issue #22113 : struct.pack_into() now supports new buffer protocol (in
...
particular accepts writable memoryview).
2015-02-21 19:51:17 +02:00
Serhiy Storchaka
5493d5ea2a
Issue #19099 : The struct module now supports Unicode format strings.
2013-12-08 17:44:50 +02:00
Benjamin Peterson
17feac7c6e
fix issue reference
2013-03-20 13:11:04 -05:00
Benjamin Peterson
b2c57a9142
this obviously is not going to raise any -3 warnings
2013-03-20 13:10:41 -05:00
Kristján Valur Jónsson
9795ca44fb
Issue #10212 : Support new buffer interface for struct.unpack and
...
cStringIO
2013-03-19 17:17:47 -07:00
Martin v. Löwis
c02e1e65c4
Issue #15467 : Move helpers for __sizeof__ tests into test_support.
...
Patch by Serhiy Storchaka.
2012-07-29 16:30:50 +02:00
Meador Inge
6812346808
Issue #15402 : Simplify Struct.__sizeof__ and make tests more precise.
2012-07-28 21:58:44 -05:00
Jesus Cea
fde7890f48
Better test for Issue #15402 : Add a __sizeof__ method to struct.Struct
2012-07-23 18:14:45 +02:00
Meador Inge
87c5b94c39
Issue #15402 : Add a __sizeof__ method to struct.Struct.
...
Initial patch by Serhiy Storchaka.
2012-07-23 09:27:00 -05:00
Benjamin Peterson
9d8c456696
Merged revisions 82777 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82777 | benjamin.peterson | 2010-07-10 10:14:45 -0500 (Sat, 10 Jul 2010) | 1 line
ValueError is eventually what we want to move to, I suppose
........
2010-07-10 15:17:08 +00:00
Benjamin Peterson
8e93f4e791
this makes checking for warnings less error prone
2010-07-09 18:15:28 +00:00
Benjamin Peterson
0b00b6b987
Merged revisions 82739,82741 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82739 | benjamin.peterson | 2010-07-09 08:28:42 -0500 (Fri, 09 Jul 2010) | 1 line
allow more exceptions
........
r82741 | benjamin.peterson | 2010-07-09 08:31:11 -0500 (Fri, 09 Jul 2010) | 1 line
wrap
........
2010-07-09 13:33:03 +00:00
Benjamin Peterson
306d88fc76
Merged revisions 82735 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82735 | benjamin.peterson | 2010-07-09 08:20:40 -0500 (Fri, 09 Jul 2010) | 1 line
OverflowError is fine
........
2010-07-09 13:21:35 +00:00
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