summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,Jeffrey Yasskin2008-02-281-0/+103
| | | | | | | | which forbids constructing types that have it set. The effect is to speed ./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()' up from 2.5us to 0.201us. This fixes issue 1762.
* Corrected assert to check for correct type in py3k.Eric Smith2008-02-241-1/+1
|
* Use PY_FORMAT_SIZE_T instead of z for string formatting. Thanks Neal.Christian Heimes2008-02-242-4/+8
|
* Issue 1742669. Now %d accepts very big float numbers.Facundo Batista2008-02-242-29/+88
| | | | Thanks Gabriel Genellina.
* #2067: file.__exit__() now calls subclasses' close() method.Georg Brandl2008-02-231-2/+2
|
* Now that PyOS_ascii_formatd supports the 'n' format, simplify the float ↵Eric Smith2008-02-201-40/+15
| | | | formatting code to just call it.
* Added code to correct combining str and unicode in ''.format(). Added test ↵Eric Smith2008-02-181-0/+16
| | | | case.
* Backport of PEP 3101, Advanced String Formatting, from py3k.Eric Smith2008-02-1711-23/+2606
| | | | | | | | | | | | | | | Highlights: - Adding PyObject_Format. - Adding string.Format class. - Adding __format__ for str, unicode, int, long, float, datetime. - Adding builtin format. - Adding ''.format and u''.format. - str/unicode fixups for formatters. The files in Objects/stringlib that implement PEP 3101 (stringdefs.h, unicodedefs.h, formatter.h, string_format.h) are identical in trunk and py3k. Any changes from here on should be made to trunk, and changes will propogate to py3k).
* Prevent a crash with nested scopes, again caused by calling Py_DECREF when ↵Amaury Forgeot d'Arc2008-02-161-1/+3
| | | | | | the pointer is still present in the containing structure.
* Issue #2115: __slot__ attributes setting was 10x slower.Amaury Forgeot d'Arc2008-02-151-1/+1
| | | | | | | | Also correct a possible crash using ABCs. This change is exactly the same as an optimisation done 5 years ago, but on slot *access*: http://svn.python.org/view?view=rev&rev=28297
* In PyNumber_ToBase, changed from an assert to returning an error when ↵Eric Smith2008-02-151-1/+5
| | | | PyObject_Index() returns something other than an int or long. It should never be possible to trigger this, as PyObject_Index checks to make sure it returns an int or long.
* Fixed repr() and str() of complex numbers. Complex suffered from the same ↵Christian Heimes2008-02-151-7/+40
| | | | problem as floats but I forgot to test and fix them.
* Use a static and interned string for __subclasscheck__ and __instancecheck__ ↵Christian Heimes2008-02-141-2/+16
| | | | as suggested by Thomas Heller in #2115
* Implemented Martin's suggestion to clear the free lists during the garbage ↵Christian Heimes2008-02-145-25/+73
| | | | collection of the highest generation.
* dict.copy() rises from the ashes. Revert r60687.Raymond Hettinger2008-02-122-19/+1
|
* Added PyNumber_ToBase and supporting routines _PyInt_Format andEric Smith2008-02-103-33/+113
| | | | | | | | | | | | | | | | | _PyLong_Format. In longobject.c, changed long_format to _PyLong_Format. In intobject.c, changed uses of PyOS_snprintf to _PyInt_Format instead. _PyLong_Format is similar to py3k's routine of the same name, except it has 2 additional parameters: addL and newstyle. addL was existing in long_format, and controls adding the trailing "L". This is unneeded in py3k. newstyle is used to control whether octal prepends "0" (the pre-2.6 style), or "0o" (the 3.0 sytle). PyNumber_ToBase is needed for PEP 3127 (Integer Literal Support and Syntax) and PEP 3101 (Advanced String Formatting). This changeset does not need merging into py3k.
* Add -3 warnings that set.copy(), dict.copy(), and defaultdict.copy() will go ↵Raymond Hettinger2008-02-092-1/+19
| | | | away in Py3.x
* Remove unnecessary modulo division.Raymond Hettinger2008-02-081-1/+1
| | | | The preceding test guarantees that 0 <= i < len.
* Use prefix decrementChristian Heimes2008-02-082-4/+3
|
* Deallocate content of the dict free list on interpreter shutdownChristian Heimes2008-02-081-0/+12
|
* Added some statistics code to dict and list object code. I wanted to test ↵Christian Heimes2008-02-072-0/+54
| | | | how a larger freelist affects the reusage of freed objects. Contrary to my gut feelings 80 objects is more than fine for small apps. I haven't profiled a large app yet.
* Return ints instead of longs for tuple.count() and tuple.index().Raymond Hettinger2008-02-071-2/+2
|
* Issue 2025: Add tuple.count() and tuple.index() to follow the ABC in ↵Raymond Hettinger2008-02-071-0/+54
| | | | collections.Sequence.
* Unified naming convention for free lists and their limits. All free listsChristian Heimes2008-02-068-84/+95
| | | | | | | | in Object/ are named ``free_list``, the counter ``numfree`` and the upper limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block. The chances should make it easier to adjust Python for platforms with less memory, e.g. mobile phones.
* Limit free list of method and builtin function objects to 256 entries each.Christian Heimes2008-02-062-8/+35
|
* Patch #1953Christian Heimes2008-02-042-25/+57
| | | | | I implemented the function sys._compact_freelists() and C API functions PyInt_/PyFloat_CompactFreeList() to compact the pre-allocated blocks of ints and floats. They allow the user to reduce the memory usage of a Python process that deals with lots of numbers. The patch also renames sys._cleartypecache to sys._clear_type_cache
* Make int() and long() fall back to __trunc__(). See issue 2002.Jeffrey Yasskin2008-02-042-1/+117
|
* Ensure that PySet_Add() operates on a newly created frozenset, like ↵Amaury Forgeot d'Arc2008-02-031-1/+6
| | | | | | | | PyTuple_SetItem does. Add PyFrozenSet_Check(), which was not needed before; The list of Py*Set_Check* macros seems to be complete now. Add missing NEWS entries about all this.
* Simpler solution to handling non-IEEE 754 environments.Raymond Hettinger2008-02-021-13/+3
|
* Add protection from weirdness while scaling the mantissa to an integer.Raymond Hettinger2008-02-011-5/+10
|
* Fix int/long typecase. Add check for non-binary floating point.Raymond Hettinger2008-02-011-2/+9
|
* labs() takes a long for an input.Raymond Hettinger2008-02-011-1/+1
|
* Integer ratio should return ints instead of longs whereever possible.Raymond Hettinger2008-02-011-2/+8
|
* Issue #1996: float.as_integer_ratio() should return fraction in lowest terms.Raymond Hettinger2008-02-011-85/+18
|
* The previous change was causing a segfault after multiple calls to ↵Christian Heimes2008-01-301-9/+5
| | | | Py_Initialize() and Py_Finalize().
* Fixed some references leaks in sys.Christian Heimes2008-01-301-1/+0
|
* Patch #1970 by Antoine Pitrou: Speedup unicode whitespace and linebreak ↵Christian Heimes2008-01-301-18/+81
| | | | detection. The speedup is about 25% for split() (571 / 457 usec) and 35% (175 / 127 usec )for splitlines()
* Factor-out common code with a new macroRaymond Hettinger2008-01-281-4/+4
|
* Make PySet_Add() work with frozensets.Raymond Hettinger2008-01-281-15/+4
| | | | | Works like PyTuple_SetItem() to build-up values in a brand new frozenset. Also, PyFrozenSet_New() is now guaranteed to produce a distinct new frozenset.
* static PyObject* variables should use PyString_InternFromString() instead of ↵Christian Heimes2008-01-283-9/+10
| | | | PyObject_FromString() to store a python string in a function level static var.
* Added clear cache methods to clear the internal type lookup cache for ref ↵Christian Heimes2008-01-271-0/+18
| | | | leak test runs.
* Moved Rational._binary_float_to_ratio() to float.as_integer_ratio() becauseJeffrey Yasskin2008-01-271-0/+159
| | | | | | | it's useful outside of rational numbers. This is my first C code that had to do anything significant. Please be more careful when looking over it.
* Whitespace cleanupNeal Norwitz2008-01-271-5/+5
|
* #1473257: add generator.gi_code attribute that refers toGeorg Brandl2008-01-261-0/+5
| | | | the original code object backing the generator. Patch by Collin Winter.
* Revert PySet_Add() changes.Raymond Hettinger2008-01-261-0/+5
|
* Update test code for change to PySet_Add().Raymond Hettinger2008-01-261-1/+0
|
* Make PySet_Add() work with frozensets. Works like PyTuple_SetItem() to ↵Raymond Hettinger2008-01-261-4/+0
| | | | build-up values in a brand new frozenset.
* Use the right (portable) definition of the max of a Py_ssize_t.Thomas Wouters2008-01-251-1/+1
|
* Rewrite the list_inline_repeat overflow check slightly differently.Guido van Rossum2008-01-251-6/+7
|
* Changes 54857 and 54840 broke code and were reverted in Py2.5 just beforeRaymond Hettinger2008-01-252-8/+8
| | | | it was released, but that reversion never made it to the Py2.6 head.