Commit Graph

42 Commits

Author SHA1 Message Date
Martin v. Löwis 73c01d4101 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-02-14 11:26:18 +00:00
Neal Norwitz ef4364f3b8 Fix unpack so it works on 64-bit platforms. 2007-04-05 05:06:49 +00:00
Raymond Hettinger b2064d7280 Fix-up error-exits on struct_unpack(). 2007-04-04 21:57:12 +00:00
Raymond Hettinger 3608f0570e Bug #1563759: struct.unpack doens't support buffer protocol objects 2007-04-04 20:32:03 +00:00
Kristján Valur Jónsson 2c8851e614 Backport the .sln and .vcproj files for PCBuild8 from the python trunk to the 2.5 maintainance branch. This fixes build problems with visual studio 2005, and cleans up profile guided optimization. 2006-10-07 14:56:30 +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
Neal Norwitz 07aadb14f3 Add PyErr_WarnEx() so C code can pass the stacklevel to warnings.warn().
This provides the proper warning for struct.pack().
PyErr_Warn() is now deprecated in favor of PyErr_WarnEx().
As mentioned by Tim Peters on python-dev.
2006-07-30 06:55:48 +00:00
Neal Norwitz 3c5431e132 Wrap some long lines
Top/Bottom factor out some common expressions
Add a XXX comment about widing offset.
2006-06-11 05:45:25 +00:00
Tim Peters 5ec2e85d0c s_methods[]: Stop compiler warnings by casting
s_unpack_from to PyCFunction.
2006-06-04 15:49:07 +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 72270c220e Repaired error in new comment. 2006-05-31 15:34:37 +00:00
Tim Peters d6a6f023c8 _range_error(): Speed and simplify (there's no real need for
loops here).  Assert that size_t is actually big enough, and
that f->size is at least one.  Wrap a long line.
2006-05-31 15:33:22 +00:00
Tim Peters c2b550e16e Trimmed trailing whitespace. 2006-05-31 14:28:07 +00:00
Neal Norwitz 971ea11e4c Calculate smallest properly (it was off by one) and use proper ssize_t types for Win64 2006-05-31 07:43:27 +00:00
Bob Ippolito 4182a75571 Change wrapping terminology to overflow masking 2006-05-30 17:37:54 +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
Armin Rigo 162997efb1 Silence a warning. 2006-05-29 17:59:47 +00:00
Bob Ippolito 28b2686260 simplify the struct code a bit (no functional changes) 2006-05-29 15:47:29 +00:00
Georg Brandl c26025c562 Fix ref-antileak in _struct.c which eventually lead to deallocating None. 2006-05-28 21:42:54 +00:00
Bob Ippolito cd51ca5b11 fix struct regression on 64-bit platforms 2006-05-27 15:53:49 +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 90bd0a554e Remove the range checking and int usage #defines from _struct and strip out the now-dead code 2006-05-27 11:47:12 +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
Tim Peters 735ae484f0 Repair Windows compiler warnings about mixing
signed and unsigned integral types in comparisons.
2006-05-26 16:49:28 +00:00
Bob Ippolito 0cbf2c5785 fix signed/unsigned mismatch in struct 2006-05-26 16:23:28 +00:00
Bob Ippolito 1d2b0e3f61 Enable PY_USE_INT_WHEN_POSSIBLE in struct 2006-05-26 14:29:35 +00:00
Bob Ippolito 685dda8b95 Fix _struct typo that broke some 64-bit platforms 2006-05-26 14:23:21 +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
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 964e02a901 fix test_float regression and 64-bit size mismatch issue 2006-05-25 21:09:45 +00:00
Bob Ippolito a99865b12e Use faster struct pack/unpack functions for the endian table that matches the host's 2006-05-25 19:56:56 +00:00
Bob Ippolito 04ab994dca Use LONG_MIN and LONG_MAX to check Python integer bounds instead of the incorrect INT_MIN and INT_MAX 2006-05-25 19:33:38 +00:00
Bob Ippolito 3b0cae9cc0 fix a struct regression where long would be returned for short unsigned integers 2006-05-25 19:15:27 +00:00
Bob Ippolito 3fc2bb9ccd Fix Cygwin compiler issue 2006-05-25 19:03:19 +00:00
Bob Ippolito 94f68ee8ba Struct now unpacks to PY_LONG_LONG directly when possible, also include #ifdef'ed out code that will return int instead of long when in bounds (not active since it's an API and doc change) 2006-05-25 18:44:50 +00:00
Bob Ippolito eb62127842 refactor unpack, add unpack_from 2006-05-24 15:32:06 +00:00
Bob Ippolito 07c023b10e fix typo in _struct 2006-05-23 19:32:25 +00:00
Bob Ippolito d3611eb3c6 forward declaration for PyStructType 2006-05-23 19:31:23 +00:00
Bob Ippolito 4de3f998bf fix linking issue, warnings, in struct 2006-05-23 19:25:52 +00:00
Bob Ippolito 232f3c91f9 patch #1493701: performance enhancements for struct module 2006-05-23 19:12:41 +00:00
Bob Ippolito 27abce5ba8 revert #1493701 2006-05-23 19:09:51 +00:00
Bob Ippolito fb8b84af54 Patch #1493701: performance enhancements for struct module. 2006-05-23 18:46:41 +00:00