Commit Graph

2817 Commits

Author SHA1 Message Date
Thomas Wouters a97744c9d9 Use the right (portable) definition of the max of a Py_ssize_t. 2008-01-25 21:09:34 +00:00
Guido van Rossum 8d5cf4ed57 Rewrite the list_inline_repeat overflow check slightly differently. 2008-01-25 19:50:26 +00:00
Raymond Hettinger 3dbd4c536d Changes 54857 and 54840 broke code and were reverted in Py2.5 just before
it was released, but that reversion never made it to the Py2.6 head.
2008-01-25 19:24:46 +00:00
Christian Heimes 7f39c9fcbb Backport of several functions from Python 3.0 to 2.6 including PyUnicode_FromString, PyUnicode_Format and PyLong_From/AsSsize_t. The functions are partly required for the backport of the bytearray type and _fileio module. They should also make it easier to port C to 3.0.
First chapter of the Python 3.0 io framework back port: _fileio
The next step depends on a working bytearray type which itself depends on a backport of the nwe buffer API.
2008-01-25 12:18:43 +00:00
Neal Norwitz 5f95a79b2b Add prototypes to get the mathmodule.c to compile on OSF1 5.1 (Tru64)
and eliminate a compiler warning in floatobject.c.  There might be
a better way to go about this, but it should be good enough for now.
2008-01-25 08:04:16 +00:00
Guido van Rossum 37edeab778 Fix test67.py from issue #1303614. 2008-01-24 17:58:05 +00:00
Georg Brandl 96f2184de6 Indentation normalization. 2008-01-19 10:18:07 +00:00
Guido van Rossum 9ff1a44973 Fix an edge case whereby the __del__() method of a classic class could
create a new weakref to the object.
2008-01-18 20:56:30 +00:00
Christian Heimes 4956d2b889 Silence Coverity false alerts with CIDs #172, #183, #184 2008-01-18 19:12:56 +00:00
Raymond Hettinger cbf8f6cffb Temporarily revert 59967 until GC can be added. 2008-01-15 05:39:59 +00:00
Raymond Hettinger c216df9288 Issue 1820: structseq objects did not work with the % formatting operator or isinstance(t, tuple).
Orignal patch (without tests) by Leif Walsh.
2008-01-15 03:02:37 +00:00
Christian Heimes c3b2a4afe8 Added more comments to the new structseq repr code and implemented several of Neal's suggestions. 2008-01-14 06:06:19 +00:00
Christian Heimes c94e2b5c12 Now that I've learnt about structseq objects I felt like converting sys.float_info to a structseq. It's
readonly and help(sys.float_info) explains the attributes nicely.
2008-01-14 04:13:37 +00:00
Christian Heimes 620fbe6632 I missed the most important file 2008-01-14 03:35:38 +00:00
Amaury Forgeot d'Arc e4c270c2a8 Re-apply patch #1700288 (first applied in r59931, rolled back in r59940)
now that ctypes uses a more supported method to create types:

Method cache optimization, by Armin Rigo, ported to 2.6 by Kevin Jacobs.
2008-01-14 00:29:41 +00:00
Georg Brandl d1c131a6e3 Back out r59931 - test_ctypes fails with it. 2008-01-13 15:04:05 +00:00
Georg Brandl 27e26ec418 Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
2008-01-12 13:47:57 +00:00
Georg Brandl dfe5dc8455 Make Python compile with --disable-unicode. 2008-01-07 18:16:36 +00:00
Jeffrey Yasskin 9871d8fe22 Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
 * Revert round to its 2.6 behavior (half away from 0).
 * Because round, floor, and ceil always return float again, it's no
   longer necessary to have them delegate to __xxx___, so I've ripped
   that out of their implementations and the Real ABC. This also helps
   in implementing types that work in both 2.6 and 3.0: you return int
   from the __xxx__ methods, and let it get enabled by the version
   upgrade.
 * Make pow(-1, .5) raise a ValueError again.
2008-01-05 08:47:13 +00:00
Jeffrey Yasskin 737c73f96f Make math.{floor,ceil}({int,long}) return float again for backwards
compatibility after r59671 made them return integral types.
2008-01-04 08:01:23 +00:00
Christian Heimes 8267d1dfe5 Bug #1481296: Fixed long(float('nan'))!=0L. 2008-01-04 00:37:34 +00:00
Christian Heimes 000a074c95 Modified PyImport_Import and PyImport_ImportModule to always use absolute imports by calling __import__ with an explicit level of 0
Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
2008-01-03 22:16:32 +00:00
Jeffrey Yasskin 2f3c16be73 Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (just
the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361,
r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new
documentation. The only significant difference is that round(x) returns a float
to preserve backward-compatibility. See http://bugs.python.org/issue1689.
2008-01-03 02:21:52 +00:00
Neal Norwitz 59a65facf2 Fix refleak 2007-12-31 23:48:47 +00:00
Georg Brandl 30b78048a6 Fix refleak introduced in r59576. 2007-12-20 21:03:02 +00:00
Guido van Rossum 0b7b6fdff3 Patch #1549 by Thomas Herve.
This changes the rules for when __hash__ is inherited slightly,
by allowing it to be inherited when one or more of __lt__, __le__,
__gt__, __ge__ are overridden, as long as __eq__ and __ne__ aren't.
2007-12-19 22:51:13 +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
Christian Heimes 0a8143f646 Applied patch #1635: Float patch for inf and nan on Windows (and other platforms).
The patch unifies float("inf") and repr(float("inf")) on all platforms.
2007-12-18 23:22:54 +00:00
Raymond Hettinger fd7ed407d7 Give meaning to the oparg for BUILD_MAP: estimated size of the dictionary.
Allows dictionaries to be pre-sized (upto 255 elements) saving time lost
to re-sizes with their attendant mallocs and re-insertions.

Has zero effect on small dictionaries (5 elements or fewer), a slight
benefit for dicts upto 22 elements (because they had to resize once
anyway), and more benefit for dicts upto 255 elements (saving multiple
resizes during the build-up and reducing the number of collisions on
the first insertions).  Beyond 255 elements, there is no addional benefit.
2007-12-18 21:24:09 +00:00
Raymond Hettinger 6c87af5d87 Optimize PyList_AsTuple(). Improve cache performance by doing the
pointer copy and object increment in one pass.  For small lists,
save the overhead of the call to memcpy() -- this comes up in
calls like f(*listcomp).
2007-12-15 00:07:25 +00:00
Christian Heimes 90e10e79ea Fixed bug #1620: New @spam.getter property syntax modifies the property in place.
I added also the feature that a @prop.getter decorator does not overwrite the doc string of the property if it was given as an argument to property().
2007-12-14 02:35:23 +00:00
Christian Heimes f15c66e143 The new float repr causes too much trouble and pain. I'm disabling the feature until we have sorted out the issues on all machines. 64bit machines seem to have issues and Guido has reported even worse.
Guido: It's pretty bad actually -- repr(1e5) comes out as '1.0'... Ditto for
repr(1eN) for most N... Both in 2.6 and in 3.0...
2007-12-11 00:54:34 +00:00
Christian Heimes 284d927625 Backport of r59456:59458 from py3k to trunk
Issue #1580: New free format floating point representation based on "Floating-Point Printer Sample Code", by Robert G. Burger. For example repr(11./5) now returns '2.2' instead of '2.2000000000000002'.

Thanks to noam for the patch! I had to modify doubledigits.c slightly to support X64 and IA64 machines on Windows. I also added the new file to the three project files.
2007-12-10 22:28:56 +00:00
Skip Montanaro 26015494f2 When splitting, avoid making a copy of the string if the split doesn't find
anything (issue 1538).
2007-12-08 15:33:24 +00:00
Skip Montanaro 4e3ebe0bae Note that open() is the preferred way to open files (issue 1510). 2007-12-08 14:37:43 +00:00
Raymond Hettinger 4e2f714031 Fix Issue 1045.
Factor-out common calling code by simplifying the length_hint API.
Speed-up the function by caching the PyObject_String for the attribute lookup.
2007-12-06 00:56:53 +00:00
Christian Heimes fe4826f6ac merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError 2007-12-05 12:49:14 +00:00
Guido van Rossum e227263a6c Shut up a compiler warning. 2007-12-03 22:02:10 +00:00
Christian Heimes 44eeaec173 Patch #1537 from Chad Austin
Change GeneratorExit's base class from Exception to BaseException
(This time I'm applying the patch to the correct sandbox.)
2007-12-03 20:01:02 +00:00
Nick Coghlan ef01d822aa Implement PEP 366 2007-12-03 12:55:17 +00:00
Christian Heimes dfdfaab1c5 Feature #1534
Added PyFloat_GetMax(), PyFloat_GetMin() and PyFloat_GetInfo() to the float API.
Added a dictionary sys.float_info with information about the internal floating point type to the sys module.
2007-12-01 11:20:10 +00:00
Georg Brandl ede3a3218e Spaces vs. Tabs. 2007-11-29 18:33:01 +00:00
Guido van Rossum 31645ba4a0 Fix bug #1517, a segfault in lookdict(). 2007-11-29 18:25:12 +00:00
Guido van Rossum 715ec1818d Patch # 1507 by Mark Dickinson. Make complex(x, -0) retain the sign of
the imaginary part (as long as it's not complex).
Backport candidate?
2007-11-27 22:38:36 +00:00
Amaury Forgeot d'Arc ce7d10ccc4 Issue #1445: Fix a SystemError when accessing the ``cell_contents``
attribute of an empty cell object.  Now a ValueError is raised.
2007-11-24 13:44:17 +00:00
Christian Heimes e8954f8ce7 Backport of the PCbuild9 directory from the py3k branch.
I've finished the last task for the PCbuild9 directory today. I don't think there is much left to do. Now you can all play around with the shiny new VS 2008 and try the PGO builds. I was able to get a speed improvement of about 10% on py3k.
Have fun! :)
2007-11-22 11:21:16 +00:00
Guido van Rossum 64c06e327d Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
With some changes of my own thrown in (e.g. backport of r58107).
2007-11-22 00:55:51 +00:00
Amaury Forgeot d'Arc 5087980c1e The incremental decoder for utf-7 must preserve its state between calls.
Solves issue1460.

Might not be a backport candidate: a new API function was added,
and some code may rely on details in utf-7.py.
2007-11-20 23:31:27 +00:00
Facundo Batista 6f7e6fb7a2 Made _ParseTupleFinds only defined to unicodeobject.c 2007-11-16 19:16:15 +00:00
Facundo Batista 292a069b88 Fix for stupid error (I need to remember to do a full 'make clean + make'
cycle before the tests...). Sorry.
2007-11-16 18:41:24 +00:00