summaryrefslogtreecommitdiff
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Check return result for errorNeal Norwitz2005-12-181-0/+2
|
* Bug #1379994: Fix *unicode_escape codecs to encode r'\' as r'\\'Hye-Shik Chang2005-12-171-3/+3
| | | | just like string codecs.
* Revert r41662 and the part of 41552 that originally caused the problemNeal Norwitz2005-12-151-7/+0
| | | | | (calling ftell(stdin) doesn't seem defined). So we won't test errors from ftell unless we can do it portably.
* Add a workaround for file.ftell() to raise IOError for ttys.Hye-Shik Chang2005-12-131-0/+7
| | | | | ftell(3) on BSD doesn't set errno even for ttys and returns useless values.
* en_sit will be freed when en is DECREF'd. Don't double free.Neal Norwitz2005-12-111-1/+0
|
* Add const to several API functions that take char *.Jeremy Hylton2005-12-1020-39/+45
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* Fix bugMichael W. Hudson2005-12-051-5/+13
| | | | | | | | [ 1346144 ] Segfaults from unaligned loads in floatobject.c by using memcpy and not just blinding casting char* to double*. Thanks to Rune Holm for the report.
* Fix leaked reference to None.Walter Dörwald2005-11-281-0/+1
|
* Do a better job of not inlining Py_ADDRESS_IN_RANGE() for newer gcc's.Neal Norwitz2005-11-131-2/+9
| | | | Perhaps Py_NO_INLINE should be moved to pyport.h or some other header?
* Prevent name pollution by making lots of internal functions static.Neal Norwitz2005-11-131-1/+1
|
* Added proper reflection on instances of <type 'method-wrapper'>, e.g.Armin Rigo2005-11-071-13/+46
| | | | | | | | '[].__add__', to match what the other internal descriptor types provide: '__objclass__' attribute, '__self__' member, and reasonable repr and comparison. Added a test.
* Another comment typo fixAndrew M. Kuchling2005-11-021-1/+1
|
* Fix typo in comment.Walter Dörwald2005-11-021-1/+1
|
* Remove .cvsignore files, as they live in svn:ignoreMartin v. Löwis2005-10-301-2/+0
| | | | properties now.
* fix typos, mostly in commentsFred Drake2005-10-281-2/+2
|
* Fix a bunch of imports to use code.h instead of compile.h.Jeremy Hylton2005-10-211-1/+0
| | | | Remove duplicate declarations from compile.h
* Fix bug:Michael W. Hudson2005-10-212-8/+0
| | | | | | | | [ 1327110 ] wrong TypeError traceback in generator expressions by removing the code that can stomp on the users' TypeError raised by the iterable argument to ''.join() -- PySequence_Fast (now?) gives a perfectly reasonable message itself. Also, a couple of tests.
* Merge ast-branch to headJeremy Hylton2005-10-204-11/+461
| | | | | | | | | | This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
* Enhance the performance of two important Unicode characterMarc-André Lemburg2005-10-201-10/+52
| | | | | | | | type lookups: whitespace and linebreak. These lookup tables are from the Python 1.6 version with the addition of the 205F code point which was added as whitespace code point to Unicode since then.
* SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. ↵Neal Norwitz2005-10-201-0/+2
| | | | Will backport
* Whitespace corrections.Marc-André Lemburg2005-10-191-19/+19
|
* Bug fix for [ 1331062 ] utf 7 codec broken.Marc-André Lemburg2005-10-191-8/+16
| | | | Backport candidate.
* Part of SF patch #1313939: Speedup charmap decoding by extendingWalter Dörwald2005-10-061-75/+107
| | | | | | | PyUnicode_DecodeCharmap() the accept a unicode string as the mapping argument which is used as a mapping table. This code isn't used by any of the codecs yet.
* Fix PyString_Format so that the "%s" format works again when Unicode is notGeorg Brandl2005-10-011-0/+2
| | | | enabled.
* (pedronis, arigo)Armin Rigo2005-09-241-1/+1
| | | | | segfault when a class contain a non-list value in the (undocumented) special attribute __slotnames__.
* Convert iterator __len__() methods to a private API.Raymond Hettinger2005-09-248-75/+111
|
* The key to the various sort columns got lost. Pulled fromSkip Montanaro2005-09-231-0/+10
| | | | http://mail.python.org/pipermail/python-dev/2002-July/026876.html
* - On 64-bit platforms, when __len__() returns a value that cannot beGuido van Rossum2005-09-202-2/+12
| | | | | | | represented as a C int, raise OverflowError. (Forward port from 2.4.2; the patch to classobject.c was already in but needed a correction in the error message text.)
* A minor fix for 64-bit platforms: when __len__() returns Python intGuido van Rossum2005-09-191-1/+11
| | | | | | containing a value that doesn't fit in a C int, raise OverflowError rather than truncating silently (and having 50% chance of hitting the "it should be >= 0" error).
* No longer ignore exceptions raised by comparisons during key lookup.Raymond Hettinger2005-09-161-48/+44
| | | | Inspired by Armin Rigo's suggestion to do the same with dictionaries.
* patch [ 1118729 ] Error in representation of complex numbers(again)Georg Brandl2005-09-161-6/+3
|
* Fix bug in last checkin (2.231). To match previous behavior, unicodeNeil Schemenauer2005-08-311-0/+5
| | | | | subclasses should be substituted as-is and not have tp_str called on them.
* SF bug #1251300: On UCS-4 builds the "unicode-internal" codec will now complainWalter Dörwald2005-08-301-0/+75
| | | | | about illegal code points. The codec now supports PEP 293 style error handlers. (This is a variant of the Nik Haldimann's patch that detects truncated data)
* Disallow keyword arguments for type constructors that don't use them.Georg Brandl2005-08-264-1/+16
| | | | (fixes bug #1119418)
* * Add a fast equality check path for frozensets where the hash value hasRaymond Hettinger2005-08-241-5/+8
| | | | | already been computed. * Apply a GET_SIZE macro().
* SF bug #1242657: list(obj) can swallow KeyboardInterruptRaymond Hettinger2005-08-212-0/+10
| | | | | | Fix over-aggressive PyErr_Clear(). The same code fragment appears in various guises in list.extend(), map(), filter(), zip(), and internally in PySequence_Tuple().
* Add shortcuts for a|a and a&a.Raymond Hettinger2005-08-171-8/+9
|
* Fix nits.Raymond Hettinger2005-08-171-2/+2
|
* Results of a line-by-line comparison back to dictobject.c.Raymond Hettinger2005-08-171-127/+121
| | | | | | | | | | | | * set_merge() cannot assume that the table doesn't resize during iteration. * convert some unnecessary tests to asserts -- they were necessary in dictobject.c because PyDict_Next() is a public function. The same is not true for set_next(). * re-arrange the order of functions to more closely match the order in dictobject.c. This makes it must easier to compare the two and ought to simplify any issues of maintaining both.
* Numerous fix-ups to C API and docs. Added tests for C API.Raymond Hettinger2005-08-161-9/+120
|
* DECREF --> XDECREFRaymond Hettinger2005-08-161-1/+1
|
* Add a C API for sets and frozensets.Raymond Hettinger2005-08-161-8/+72
|
* More function re-ordering (placing like functions together).Raymond Hettinger2005-08-131-86/+86
|
* * Bring lookkey() and lookkey_string() closer to dict version.Raymond Hettinger2005-08-131-93/+77
| | | | | * Use set_next() for looping in issubset() and frozenset_hash(). * Re-order the presentation of cmp and hash functions.
* Fix a too-aggressive assert (see SF#1257960). Previously, gen_iternextPhillip J. Eby2005-08-131-1/+1
| | | | | | | | | was never called during interpreter shutdown GC, so the f_back!=NULL assertion was correct. Now that generators get close()d during GC, the assertion was being triggered because the generator close() was being called as the top-level frame. However, nothing actually is broken by this; it's just that the condition was unexpected in previous Python versions.
* * Fix SF #1257731. Make __contains__(), remove(), and discard() only doRaymond Hettinger2005-08-121-26/+30
| | | | | | | a frozenset conversion when the initial search attempt fails with a TypeError and the key is some type of set. Add a testcase. * Eliminate a duplicate if-stmt.
* Change the %s format specifier for str objects so that it returns aNeil Schemenauer2005-08-122-17/+33
| | | | | unicode instance if the argument is not an instance of basestring and calling __str__ on the argument returns a unicode instance.
* * Add short-circuit code for in-place operations with self (such asRaymond Hettinger2005-08-111-89/+153
| | | | | | | | | | | | | | | | | | | | | s|=s, s&=s, s-=s, or s^=s). Add related tests. * Improve names for several variables and functions. * Provide alternate table access functions (next, contains, add, and discard) that work with an entry argument instead of just a key. This improves set-vs-set operations because we already have a hash value for each key and can avoid unnecessary calls to PyObject_Hash(). Provides a 5% to 20% speed-up for quick hashing elements like strings and integers. Provides much more substantial improvements for slow hashing elements like tuples or objects defining a custom __hash__() function. * Have difference operations resize() when 1/5 of the elements are dummies. Formerly, it was 1/6. The new ratio triggers less frequently and only in cases that it can resize quicker and with greater benefit. The right answer is probably either 1/4, 1/5, or 1/6. Picked the middle value for an even trade-off between resize time and the space/time costs of dummy entries.
* * Bring in INIT_NONZERO_SET_SLOTS macro from dictionary code.Raymond Hettinger2005-08-071-18/+51
| | | | | | | | * Bring in free list from dictionary code. * Improve several comments. * Differencing can leave many dummy entries. If more than 1/6 are dummies, then resize them away. * Factor-out common code with new macro, PyAnySet_CheckExact.
* * Removed checked_error flag which no longer provides any benefit.Raymond Hettinger2005-08-061-15/+12
| | | | * Have issubset() control its own loop instead of using set_next_internal().