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
Amaury Forgeot d'Arc
588ff93f13
Crashers of the day: Py_CLEAR must be used when there is a chance that the
...
function can be called recursively.
This was discussed in issue1020188.
In python codebase, all occurrences of Py_[X]DECREF(xxx->yyy) are suspect,
except when they appear in tp_new or tp_dealloc functions, or when
the member cannot be of a user-defined class.
Note that tp_init is not safe.
I do have a (crashing) example for every changed line.
Is it worth adding them to the test suite?
Example:
class SpecialStr(str):
def __del__(self):
s.close()
import cStringIO
s = cStringIO.StringIO(SpecialStr("text"))
s.close() # Segfault
2008-02-16 14:34:57 +00:00
Raymond Hettinger
18e08e5e61
clearcache() needs to remove the dict as well as clear it.
2008-01-18 00:10:42 +00:00
Christian Heimes
76d19f68e4
Added _struct._clearcache() for regression tests
2008-01-04 02:54:42 +00:00
Raymond Hettinger
2f6621cce7
Finish-up the struct module optimizations started at the Iceland NFS sprint.
2008-01-04 00:01:15 +00:00
Christian Heimes
e93237dfcc
#1629 : Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available.
2007-12-19 02:37:44 +00:00
Martin v. Löwis
6819210b9e
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
...
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Neal Norwitz
a84dcd7546
Stop using METH_OLDARGS implicitly
2007-05-22 07:16:44 +00:00
Kristján Valur Jónsson
67387fb4aa
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
2007-04-25 00:17:39 +00:00
Raymond Hettinger
7a3d41f4ca
Bug #1563759 : struct.unpack doens't support buffer protocol objects
2007-04-05 18:00:03 +00:00
Martin v. Löwis
aef4c6bc00
Patch #1610575 : Add support for _Bool to struct.
2007-01-21 09:33:07 +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