Commit Graph

48 Commits

Author SHA1 Message Date
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