summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Add list.sorted() classmethod.Raymond Hettinger2003-10-291-0/+37
|
* Deleting cyclic object comparison.Armin Rigo2003-10-282-186/+12
| | | | | SF patch 825639 http://mail.python.org/pipermail/python-dev/2003-October/039445.html
* Fix Greg Ward's error message nit: PyObject_SetItem and PySequenceSetItemRaymond Hettinger2003-10-271-1/+1
| | | | had slightly different error messages.
* Fix a bug in the memory reallocation code of PyUnicode_TranslateCharmap().Walter Dörwald2003-10-241-19/+20
| | | | | | | charmaptranslate_makespace() allocated more memory than required for the next replacement but didn't remember that fact, so memory size was growing exponentially every time a replacement string is longer that one character. This fixes SF bug #828737.
* Avoid confusing name for the 3rd argument to str.replace().Fred Drake2003-10-221-3/+3
| | | | This closes SF bug #827260.
* Removing bogus Py_DECREF() reported by Armin Rigo (SF bug 812353).Jeremy Hylton2003-10-211-1/+0
| | | | | Even if a new dict is generated for locals, it is stored in f->f_locals.
* Fix indentation.Jeremy Hylton2003-10-211-1/+1
|
* Fix a bunch of typos in documentation, docstrings and comments.Walter Dörwald2003-10-201-1/+1
| | | | (From SF patch #810751)
* Make CObjects mutable. Fixes #477441.Martin v. Löwis2003-10-191-0/+14
|
* Patch #825679: Clarify semantics of .isfoo on empty strings.Martin v. Löwis2003-10-182-22/+24
| | | | Backported to 2.3.
* Patch #809535: Mention behaviour of seek on text files. Backported to 2.3.Martin v. Löwis2003-10-181-1/+3
|
* Fix typo found by Neal Norwitz.Raymond Hettinger2003-10-161-1/+1
|
* * list.sort() now supports three keyword arguments: cmp, key, and reverse.Raymond Hettinger2003-10-161-5/+228
| | | | | | | key provides C support for the decorate-sort-undecorate pattern. reverse provide a stable sort of the list with the comparisions reversed. * Amended the docs to guarantee sort stability.
* Simplify and speedup uses of Py_BuildValue():Raymond Hettinger2003-10-124-29/+28
| | | | | | * Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
* Extended tuple's C API to include a new function, PyTuple_Pack() that isRaymond Hettinger2003-10-121-0/+22
| | | | | useful for rapidly building argument tuples without having to invoke the more sophisticated machinery of Py_BuildValue().
* Use the simpler and faster PyArg_UnpackTuple() instead ofRaymond Hettinger2003-10-111-24/+24
| | | | PyArg_ParseTuple() where possible.
* SF bug #820397: __nonzero__() returns 1/0Raymond Hettinger2003-10-111-1/+15
| | | | | | Altered to return a PyBool instead of a PyInt. Backport candidate.
* Return a bool rather than an int from proxy_has_key().Guido van Rossum2003-10-091-1/+4
|
* Fix leak introduced by previous typeobject.c checkin.Guido van Rossum2003-10-091-4/+3
|
* SF patch #820195 by Wojtek Walczak (gminick at users.sourceforge.net):Guido van Rossum2003-10-081-2/+4
| | | | make obj.__contains__() returns True/False instead of 1/0.
* Fix for SF bug [ 817156 ] invalid \U escape gives 0=length unistr.Jeremy Hylton2003-10-061-1/+1
|
* On c.l.py, Martin v. Löwis said that Py_UNICODE could be of a signed type,Tim Peters2003-09-161-137/+145
| | | | | | | so fiddle Jeremy's fix to live with that. Also added more comments. Bugfix candidate (this bug is in all versions of Python, at least since 2.1).
* Double-fix of crash in Unicode freelist handling.Jeremy Hylton2003-09-161-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | If a length-1 Unicode string was in the freelist and it was uninitialized or pointed to a very large (magnitude) negative number, the check unicode_latin1[unicode->str[0]] == unicode could cause a segmentation violation, e.g. unicode->str[0] is 0xcbcbcbcb. Fix this in two ways: 1. Change guard befor unicode_latin1[] to test against 256U. If I understand correctly, the unsigned long used to store UCS4 on my box was getting converted to a signed long to compare with the signed constant 256. 2. Change _PyUnicode_New() to make sure the first element of str is always initialized to zero. There are several places in the code where the caller can exit with an error before initializing any of str, which would leave junk in str[0]. Also, silence a compiler warning on pointer vs. int arithmetic. Bug fix candidate.
* Fix leak in classobject.c. The leak surfaced on the error exit whenRaymond Hettinger2003-09-161-0/+1
| | | | | hashing a class that does not define __hash__ but does define a comparison.
* Change checks of PyUnicode_Resize() return value for clarity.Jeremy Hylton2003-09-161-18/+17
| | | | | | | The unicode_resize() family only returns -1 or 0 so simply checking for != 0 is sufficient, but somewhat unclear. Many Python API functions return < 0 on error, reserving the right to return 0 or 1 on success. Change the call sites for consistency with these calls.
* Only release buffer after file has been closed. Fixes #800824.Martin v. Löwis2003-09-071-1/+1
| | | | Will backport to 2.2.
* SF bug 801631: file.truncate fault on windows.Tim Peters2003-09-071-74/+66
| | | | | | | | | | | | | | | | | file_truncate(): C doesn't define what fflush(fp) does if fp is open for update, and the preceding I/O operation on fp was input. On Windows, fflush() actually changes the current file position then. Because Windows doesn't support ftruncate() directly, this not only caused Python's file.truncate() to change the file position (contra our docs), it also caused the file not to change size. Repaired by getting the initial file position at the start, restoring it at the end, and tossing all the complicated micro-efficiency checks trying to avoid "provably unnecessary" seeks. file.truncate() can't be a frequent operation, and seeking to the current file position has got to be cheap anyway. Bugfix candidate.
* SF bug #800796: Difference between hash() and __hash__()Raymond Hettinger2003-09-051-1/+8
| | | | slice(5).__hash__() now raises a TypeError.
* Patch #788249: Pass an explicit buffer to setvbuf in PyFile_SetBufSize().Martin v. Löwis2003-09-041-5/+19
| | | | Fixes #603724. Will backport to 2.3.
* SF patch #798467: Update docstring of has_key for bool changesRaymond Hettinger2003-09-012-2/+2
| | | | (Contributed by George Yoshida.)
* Remove 'e.g.' from error messageRaymond Hettinger2003-08-301-3/+3
|
* SF bug #795506: Wrong handling of string format code for float values.Raymond Hettinger2003-08-272-0/+6
| | | | | | Adding missing support for '%F'. Will backport to 2.3.1.
* Fix SF #789402, Memory leak on open()Neal Norwitz2003-08-151-0/+1
| | | | If opening a directory, the exception would leak.
* Fix refcounting leak in charmaptranslate_lookup()Walter Dörwald2003-08-151-0/+1
|
* Fix another refcounting leak in PyUnicode_EncodeCharmap().Walter Dörwald2003-08-151-1/+3
|
* Fix another refcounting leak (in PyUnicode_DecodeUnicodeEscape()).Walter Dörwald2003-08-151-0/+2
|
* Fix forMichael W. Hudson2003-08-152-5/+17
| | | | | | | | | [ 784825 ] fix obscure crash in descriptor handling Should be applied to release23-maint and in all likelyhood release22-maint, too. Certainly doesn't apply to release21-maint.
* My last fix left n used unitialized in tha a==b case.Michael W. Hudson2003-08-151-1/+1
| | | | | | Fix, by not using n at all in that case. Needs to be applied to release23-maint, too.
* complex_new(): This could leak when the argument was neither string norTim Peters2003-08-151-0/+3
| | | | | | number. This accounts for the 2 refcount leaks per test_complex run Michael Hudson discovered (I figured only I would have the stomach to look for leaks in floating-point code <wink>).
* Fix refcount leak in PyUnicode_EncodeCharmap(). The bug surfacesWalter Dörwald2003-08-141-3/+3
| | | | | | | | | | when an encoding error occurs and the callback name is unknown, i.e. when the callback has to be called. The problem was that the fact that the callback has already been looked up was only recorded in a local variable in charmap_encoding_error(), because charmap_encoding_error() got it's own copy of the errorHandler pointer instead of a pointer to the pointer in PyUnicode_EncodeCharmap().
* Fix reference leak noted in test_types:Michael W. Hudson2003-08-141-9/+9
| | | | | | Check for a[:] = a _before_ calling PySequence_Fast on a. release23-maint candidate Reference leak doesn't happen with head of release22-maint.
* Add a couple of decrefs to error paths.Michael W. Hudson2003-08-111-2/+4
| | | | | | | Now test_descr only appears to leak two references & I think this are in fact illusory (it's to do with things getting resurrected in __del__ methods & it's easy to be believe confusion occurs when that happens <wink>). Woohoo!
* Fix silly typo in comment.Michael W. Hudson2003-08-111-1/+1
|
* /* XXX From here until type is allocated, "return NULL" leaks bases! */Michael W. Hudson2003-08-081-2/+9
| | | | | | | | | | | | Sure looks like it to me! <wink> When I run the leak2.py script I posted to python-dev, I only see three reference leaks in all of test_descr. When I run test_descr.test_main, I still see 46 leaks. This clearly demands posting a yelp to python-dev :-) This certainly should be applied to release23-maint, and in all likelyhood release22-maint as well.
* Repair refcounting on error return from type_set_bases.Michael W. Hudson2003-08-071-3/+6
| | | | Include a test case that failed for one of my efforts to repair this.
* Remove code that tried to warn about shadowing builtin names after aNeil Schemenauer2003-07-161-66/+1
| | | | module had been compiled. It gives too many spurious warnings.
* Remove stray comments.Jeremy Hylton2003-07-161-1/+0
|
* Remove unnecessary check in tests for slots allowed.Jeremy Hylton2003-07-161-1/+1
| | | | | | | The !PyType_Check(base) check snuck in as part of rev 2.215, but was unrelated to the SF patch that is mentioned in the checkin comment. The test is currently unnecessary because base is set to the return value of best_bases(), which returns a type or NULL.
* Remove proxy_print(), since that caused an inconsistency betweenFred Drake2003-07-141-10/+2
| | | | | "print repr(proxy(a))" and "proxy(a)" at an interactive prompt. Closes SF bug #722763.
* Add whitespace.Jeremy Hylton2003-07-111-3/+3
|