summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Martin's fix forMichael W. Hudson2002-03-181-14/+24
| | | | | | | | [ 529104 ] broken error handling in unicode-escape I presume this will need to be fixed on the trunk, too. Later.
* FixMichael W. Hudson2002-03-181-7/+9
| | | | | | | | [ 531306 ] ucs4 build horked. Classic C mistake, I think. Also squashed a couple of warnings in the ucs4 build.
* Fix for SF bug 528132 (Armin Rigo): classmethod().__get__() segfaultGuido van Rossum2002-03-181-0/+2
| | | | | | | | | | | The proper fix is not quite what was submitted; it's really better to take the class of the object passed rather than calling PyMethod_New with NULL pointer args, because that can then cause other core dumps later. I also added a testcase for the fix to classmethods() in test_descr.py. I'll apply this to 2.3 too.
* SF patch 530070: pydoc regression, from Martin and Guido.Tim Peters2002-03-171-3/+19
| | | | | Change the way __doc__ is handled, to avoid blowing up on non-string __doc__ values.
* Take Tim's work on file.truncate out of 2.2.1 again.Michael W. Hudson2002-03-171-66/+18
|
* Backport Tim's work on getting file.truncate working better on Win32.Michael W. Hudson2002-03-161-18/+66
| | | | | "cvs diff | patch" managed to stick the NEWS item in the 2.2 final section! I wonder which silly man wrote patch <wink>.
* backport gvanrossum's checkin ofMichael W. Hudson2002-03-161-1/+37
| | | | | | | | | | | | | revision 2.129 of typeobject.c "Fix" for SF bug #520644: __slots__ are not pickled. As promised in my response to the bug report, I'm not really fixing it; in fact, one could argule over what the proper fix should do. Instead, I'm adding a little magic that raises TypeError if you try to pickle an instance of a class that has __slots__ but doesn't define or override __getstate__. This is done by adding a bozo __getstate__ that always raises TypeError.
* backport gvanrossum's checkin ofMichael W. Hudson2002-03-151-7/+19
| | | | | | | | | | | | | | revision 2.41 of moduleobject.c Fix for SF bug #529050 - ModuleType.__new__ crash. There were several places that assumed the md_dict field was always set, but it needn't be. Fixed these to be more careful. I changed PyModule_GetDict() to initialize md_dict to a new dictionary if it's NULL. Bugfix candidate.
* Move to zlib 1.1.4 on Windows (the new version that squashes the "doubleTim Peters2002-03-131-2/+2
| | | | | | | | | | | free" glitch). unicodeobject.c: squash compiler warnings. Noting that test_pyclbr currently fails in 2.2.1: test_others (__main__.PyclbrTest) ... ??? HTTP11 FAIL
* backport gvanrossum's checkin ofMichael W. Hudson2002-03-111-1/+1
| | | | | | | | | | revision 2.128 of typeobject.c Bugfix candidate. Adapter from SF patch 528038; fixes SF bug 527816. The wrapper for __nonzero__ should be wrap_inquiry rather than wrap_unaryfunc, since the slot returns an int, not a PyObject *.
* backport tim_one's checkin ofMichael W. Hudson2002-03-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | revision 2.111 of floatobject.c SF bug 525705: [2.2] underflow raise OverflowException. Another year in the quest to out-guess random C behavior. Added macros Py_ADJUST_ERANGE1(X) and Py_ADJUST_ERANGE2(X, Y). The latter is useful for functions with complex results. Two corrections to errno- after-libm-call are attempted: 1. If the platform set errno to ERANGE due to underflow, clear errno. Some unknown subset of libm versions and link options do this. It's allowed by C89, but I never figured anyone would do it. 2. If the platform did not set errno but overflow occurred, force errno to ERANGE. C89 required setting errno to ERANGE, but C99 doesn't. Some unknown subset of libm versions and link options do it the C99 way now. Bugfix candidate, but hold off until some Linux people actually try it, with and without -lieee. I'll send a help plea to Python-Dev.
* Probably should have merged the two checkins to this file (oh well).Michael W. Hudson2002-03-111-4/+6
| | | | | | | | | | backport jhylton's checkin of revision 2.98 of abstract.c Fix leak of NotImplemented in previous checkin to PyNumber_Add(). If result == Py_NotImplemented, always DECREF it before assigning a new value to result.
* backport jhylton's checkin ofMichael W. Hudson2002-03-111-4/+3
| | | | | | | | | | revision 2.97 of abstract.c Fix for SF bug 516727: MyInt(2) + "3" -> NotImplemented PyNumber_Add() tries the nb_add slot first, then falls back to sq_concat. However, it didn't check the return value of sq_concat. If sq_concat returns NotImplemented, raise the standard TypeError.
* backport my checkin ofMichael W. Hudson2002-03-071-1/+7
| | | | | | revision 1.6 of structseq.c Guido pointed out that I was missing a couple decrefs.
* After some thinking, I decided to move all of this across ontoMichael W. Hudson2002-03-071-23/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | the branch. I don't think it can break code, so the only risk is introducing new bugs. In that vein, can I ask -checkins readers who have time to carefully look this over, check my refcounts &c? TIA. backport my checkin of revision 1.5 of structseq.c Apply (my) patch: [ 526072 ] pickling os.stat results round II structseq's constructors can now take "invisible" fields in a dict. Gave the constructors better error messages. their __reduce__ method puts these fields in a dict. (this is all in aid of getting os.stat_result's to pickle portably) Also fixes [ 526039 ] devious code can crash structseqs Thought needed about how much of this counts as a bugfix. Certainly #526039 needs to be fixed.
* backport tim_one's checkin ofMichael W. Hudson2002-03-051-1/+1
| | | | | | | | | revision 1.114 of longobject.c _PyLong_Copy(): was creating a copy of the absolute value, but should copy the sign too. Added a test to test_descr to ensure that it does. Bugfix candidate.
* Backport the bits of Guido's fix forMichael W. Hudson2002-03-051-2/+8
| | | | | | SF patch 514641 (Naofumi Honda) - Negative ob_size of LongObjects that Tim didn't later back out.
* backport tim_one's checkin ofMichael W. Hudson2002-03-051-5/+2
| | | | | | | | | | | | | | revision 2.164 of object.c Whether platform malloc(0) returns NULL has nothing to do with whether platform realloc(p, 0) returns NULL, so MALLOC_ZERO_RETURNS_NULL can be correctly undefined yet realloc(p, 0) can return NULL anyway. Prevent realloc(p, 0) doing free(p) and returning NULL via a different hack. Would probably be better to get rid of MALLOC_ZERO_RETURNS_NULL entirely. Bugfix candidate.
* backport my checkin ofMichael W. Hudson2002-03-051-1/+30
| | | | | | | | | | | | revision 1.4 of structseq.c A fix & test for [ 496873 ] structseqs unpicklable by adding a __reduce__ method to structseqs. Will also commit this to the 2.2.1 branch momentarily.
* Whitespace normalization and minor cosmetics.Marc-André Lemburg2002-02-251-22/+24
|
* Fix UTF-8 encoder pointer arithmetic and restore 2.2 behaviour.Marc-André Lemburg2002-02-251-13/+10
|
* Fix the problem reported inMichael W. Hudson2002-02-221-3/+10
| | | | | | [ #495401 ] Build troubles: --with-pymalloc in a slightly different manner to the trunk, as discussed on python-dev.
* backport loewis' checkin ofMichael W. Hudson2002-02-221-4/+16
| | | | | | | revision 2.127 of typeobject.c Allow __doc__ to be of arbitrary type. Patch by James Henstridge, fixes #504343. 2.2.1 candidate.
* backport gvanrossum's checkin ofMichael W. Hudson2002-02-221-2/+2
| | | | | | | | | | | revision 2.54 of complexobject.c Declare real and imag as read-only attributes. This fixes SF bug #514858 (Gregory Smith): complex not entirely immutable 2.2.1 Bugfix candidate!
* Backport gvanrossum's checkin of revision 2.80:Michael W. Hudson2002-02-191-1/+1
| | | | | | | | Bugfix candidate. Fix SF bug #511603: Error calling str on subclass of int Explicitly fill in tp_str with the same pointer as tp_repr.
* Patch #508038: Do not use a type as a variable name.Martin v. Löwis2002-02-161-3/+3
|
* Fix a bunch of typos found by nnorwitz.Michael W. Hudson2002-02-061-1/+1
|
* Include <unistd.h> in Python.h. Fixes #500924.Martin v. Löwis2002-01-121-4/+0
|
* Implement PyObject_DelItemString. Fixes #498915.Martin v. Löwis2002-01-051-0/+18
|
* proxy_compare(): Make sure that we unwrap both objects being compared ifFred Drake2001-12-191-6/+13
| | | | both are proxy objects.
* - PyType_Ready(): Initialize the ob_type field to &PyType_Type if it'sGuido van Rossum2001-12-171-0/+16
| | | | | | | | NULL, so that you can call PyType_Ready() to initialize a type that is to be separately compiled with C on Windows. inherit_special(): Add a long comment explaining that you have to set tp_new if your base class is PyBaseObject_Type.
* Portability fix: Not every compiler implements the extension ofSjoerd Mullender2001-12-171-1/+1
| | | | unescaped newlines in strings.
* SF patch #493452: docstrings for staticmethod/classmethod (SkipGuido van Rossum2001-12-171-2/+41
| | | | | | Montanaro) (With minor adjustments.)
* SF bug #493561: incorrect format string descrobject.c (Neal Norwitz)Guido van Rossum2001-12-151-2/+2
| | | | %300s should be %.300s, twice.
* (Merge into trunk.)Guido van Rossum2001-12-141-1/+3
| | | | | | | | | | | | | | | | | Fix for SF bug #492345. (I could've sworn I checked this in, but apparently I didn't!) This code: class Classic: pass class New(Classic): __metaclass__ = type attempts to create a new-style class with only classic bases -- but it doesn't work right. Attempts to fix it so it works caused problems elsewhere, so I'm now raising a TypeError in this case.
* Ensure that complex() only accepts a string argument as the first arg,Fred Drake2001-12-131-1/+13
| | | | | and only if there is no second arg. This closes SF patch #479551.
* float_floor_div: An expression like 3.//1j crashed the interpreter, orTim Peters2001-12-111-9/+12
| | | | | | | delivered bizarre results. Check float_divmod for a Py_NotImplemented return and pass it along (instead of treating Py_NotImplemented as a 2-tuple). CONVERT_TO_DOUBLE: Added comments; this macro is obscure.
* float_int_div(): For clarity, move this closer to the other floatTim Peters2001-12-111-16/+16
| | | | division functions, and rename to float_floor_div.
* SF bug #491415 PyDict_UpdateFromSeq2() unusedTim Peters2001-12-111-8/+2
| | | | | | | PyDict_UpdateFromSeq2(): removed it. PyDict_MergeFromSeq2(): made it public and documented it. PyDict_Merge() docs: updated to reveal <wink> that the second argument can be any mapping object.
* Make sure that when we invoke callback functions associated with weakFred Drake2001-12-101-20/+24
| | | | | | references, we do not allow any outstanding exceptions "leak" into the callback's execution state. This closes SF bug #478534.
* Well what do you know. The Python implementation contained the sameGuido van Rossum2001-12-101-2/+2
| | | | bug as the C code. :-(
* Fix the Python property class in a comment right.Guido van Rossum2001-12-101-22/+23
|
* property_descr_get(): Fix a curious bug in the property() type: whenGuido van Rossum2001-12-101-5/+5
| | | | | | | | | | no get function was defined, the property's doc string was inaccessible. This was because the test for prop_get was made *before* the test for a NULL/None object argument. Also changed the property class defined in Python in a comment to test for NULL to decide between get and delete; this makes it less Python but then, assigning None to a property doesn't delete it!
* SF patch #491049 (David Jacobs): Small PyString_FromString optimizationGuido van Rossum2001-12-101-1/+1
| | | | | | PyString_FromString(): Since the length of the string is already being stored in size, changed the strcpy() to a memcpy() for a small speed improvement.
* _PyTuple_Resize(): this dumped core on tuple(globals()) for me. TurnsGuido van Rossum2001-12-071-6/+8
| | | | | | | | | | | out the for loop at the end intended to zero out new items wasn't doing anything, because sv->ob_size was already equal to newsize. The fix slightly refactors the function, introducing a variable oldsize and doing away with sizediff (which was used only once), and using oldsize and newsize consistently. I also added comments explaining what the two for loops do. (Looking at the CVS annotation of this function, it's no miracle a bug crept in -- this has been patched by many different folks! :-)
* PyString_FromString: this requires its argument be non-NULL, but doesn'tTim Peters2001-12-061-1/+4
| | | | check it. Added an assert() to that effect.
* Fix for #489669 (Neil Norwitz): memory leak in test_descr (unicode).Guido van Rossum2001-12-061-6/+3
| | | | | | | | | | | | | | This is best reproduced by while 1: class U(unicode): pass U(u"xxxxxx") The unicode_dealloc() code wasn't properly freeing the str and defenc fields of the Unicode object when freeing a subtype instance. Fixed this by a subtle refactoring that actually reduces the amount of code slightly.
* Fix memory leak in dict_to_map(), SF bug [ #485152 ] memory leak in test_scope.Jeremy Hylton2001-12-061-8/+11
| | | | | | | | | | | | PyCell_Set() incremenets the reference count, so the earlier XINCREF causes a leak. Also make a number of small performance improvements to the code on the assumption that most of the time variables are not rebound across a FastToLocals() / LocalsToFast() pair. Replace uses of PyCell_Set() and PyCell_Get() with PyCell_SET() and PyCell_GET(), since the frame is guaranteed to contain cells.
* Little stuff.Jeremy Hylton2001-12-061-8/+9
| | | | | | | | | | | Add a missing DECREF in an obscure corner. If the str() or repr() of an object passed to a string interpolation -- e.g. "%s" % obj -- returns a non-string, the returned object was leaked. Repair an indentation glitch. Replace a bunch of PyString_AsString() calls (and their ilk) with macros.
* The previous checkin to clear __slots__ variables did a little bit ofGuido van Rossum2001-12-061-20/+20
| | | | | the work each time it found another base class. All the work is contiguous, so we might as well do it all at once at the end.