summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Patch #530105: Allow file object may to be subtypedMartin v. Löwis2002-03-151-11/+0
|
* Patch #517521: Consider byte strings before Unicode stringsMartin v. Löwis2002-03-151-52/+60
| | | | in PyObject_Get/SetAttr.
* "Fix" for SF bug #520644: __slots__ are not pickled.Guido van Rossum2002-03-141-1/+37
| | | | | | | | | 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.
* Fix for SF bug #529050 - ModuleType.__new__ crash.Guido van Rossum2002-03-121-7/+19
| | | | | | | | | | 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.
* Change Windows file.truncate() to (a) restore the original file position,Tim Peters2002-03-121-27/+40
| | | | | | | | | | | | and (b) stop trying to prevent file growth. Beef up the file.truncate() docs. Change test_largefile.py to stop assuming that f.truncate() moves the file pointer to the truncation point, and to verify instead that it leaves the file position alone. Remove the test for what happens when a specified size exceeds the original file size (it's ill-defined, according to the Single Unix Spec).
* file_truncate(): provide full "large file" support on Windows, byTim Peters2002-03-111-20/+55
| | | | | | | | | | | | | | | | | | | | dropping MS's inadequate _chsize() function. This was inspired by SF patch 498109 ("fileobject truncate support for win32"), which I rejected. libstdtypes.tex: Someone who knows should update the availability blurb. For example, if it's available on Linux, it would be good to say so. test_largefile: Uncommented the file.truncate() tests, and reworked to do more. The old comment about "permission errors" in the truncation tests under Windows was almost certainly due to that the file wasn't open for *write* access at this point, so of course MS wouldn't let you truncate it. I'd be appalled if a Unixish system did. CAUTION: Someone should run this test on Linux (etc) too. The truncation part was commented out before. Note that test_largefile isn't run by default.
* Bugfix candidate.Guido van Rossum2002-03-101-1/+1
| | | | | | | 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 *.
* Patch #494047: removes 64-bit ?: to cope on plan9.Martin v. Löwis2002-03-091-2/+10
|
* SF bug 525705: [2.2] underflow raise OverflowException.Tim Peters2002-03-091-2/+2
| | | | | | | | | | | | | | | | | | | | 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.
* Fix leak of NotImplemented in previous checkin to PyNumber_Add().Jeremy Hylton2002-03-081-4/+6
| | | | | If result == Py_NotImplemented, always DECREF it before assigning a new value to result.
* Fix for SF bug 516727: MyInt(2) + "3" -> NotImplementedJeremy Hylton2002-03-081-4/+3
| | | | | | PyNumber_Add() tries the nb_add slot first, then falls back to sq_concat. However, tt didn't check the return value of sq_concat. If sq_concat returns NotImplemented, raise the standard TypeError.
* Guido pointed out that I was missing a couple decrefs.Michael W. Hudson2002-03-071-1/+7
|
* Apply (my) patch:Michael W. Hudson2002-03-061-23/+76
| | | | | | | | | | | | | | | | | [ 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.
* A fix & test forMichael W. Hudson2002-03-051-1/+30
| | | | | | | | [ 496873 ] structseqs unpicklable by adding a __reduce__ method to structseqs. Will also commit this to the 2.2.1 branch momentarily.
* Whether platform malloc(0) returns NULL has nothing to do with whetherTim Peters2002-03-021-5/+2
| | | | | | | | | | | 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.
* _PyLong_Copy(): was creating a copy of the absolute value, but shouldTim Peters2002-03-021-1/+1
| | | | | | copy the sign too. Added a test to test_descr to ensure that it does. Bugfix candidate.
* Revert the last odd change to PyNumber_Long: the problem it was tryingTim Peters2002-03-021-10/+2
| | | | to fix was almost certainly a bug in _PyLong_Copy (which I'll fix next).
* SF patch 514641 (Naofumi Honda) - Negative ob_size of LongObjectsGuido van Rossum2002-03-012-4/+18
| | | | | | | | | | Due to the bizarre definition of _PyLong_Copy(), creating an instance of a subclass of long with a negative value could cause core dumps later on. Unfortunately it looks like the behavior of _PyLong_Copy() is quite intentional, so the fix is more work than feels comfortable. This fix is almost, but not quite, the code that Naofumi Honda added; in addition, I added a test case.
* %#x/%#X format conversion cleanup (see patch #450267):Andrew MacIntyre2002-02-282-63/+74
| | | | | | Objects/ stringobject.c unicodeobject.c
* OS/2 EMX port changes (Objects part of patch #450267):Andrew MacIntyre2002-02-263-0/+23
| | | | | | | | | | | | Objects/ fileobject.c stringobject.c unicodeobject.c This commit doesn't include the cleanup patches for stringobject.c and unicodeobject.c which are shown separately in the patch manager. Those patches will be regenerated and applied in a subsequent commit, so as to preserve a fallback position (this commit to those files).
* Allow __doc__ to be of arbitrary type. Patch by James Henstridge,Martin v. Löwis2002-02-181-4/+16
| | | | fixes #504343. 2.2.1 candidate.
* Patch #508038: Do not use a type as a variable name.Martin v. Löwis2002-02-161-3/+3
|
* Declare real and imag as read-only attributes.Guido van Rossum2002-02-081-2/+2
| | | | | | | This fixes SF bug #514858 (Gregory Smith): complex not entirely immutable 2.2.1 Bugfix candidate!
* Fix to the UTF-8 encoder: it failed on 0-length input strings.Marc-André Lemburg2002-02-071-6/+17
| | | | | | | | | | | | | | Fix for the UTF-8 decoder: it will now accept isolated surrogates (previously it raised an exception which causes round-trips to fail). Added new tests for UTF-8 round-trip safety (we rely on UTF-8 for marshalling Unicode objects, so we better make sure it works for all Unicode code points, including isolated surrogates). Bumped the PYC magic in a non-standard way -- please review. This was needed because the old PYC format used illegal UTF-8 sequences for isolated high surrogates which now raise an exception.
* Cosmetics.Marc-André Lemburg2002-02-061-6/+6
|
* Whitespace fixes.Marc-André Lemburg2002-02-061-11/+11
|
* Fix for the UTF-8 memory allocation bug and the UTF-8 encodingMarc-André Lemburg2002-02-061-23/+27
| | | | bug related to lone high surrogates.
* Bugfix candidate.Guido van Rossum2002-02-011-1/+1
| | | | | | Fix SF bug #511603: Error calling str on subclass of int Explicitly fill in tp_str with the same pointer as tp_repr.
* Fix spelling mistakes. Bugfix candidates.Neal Norwitz2002-01-291-1/+1
|
* Updated patch #487906: Revise inline docs.Martin v. Löwis2002-01-161-28/+25
|
* 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
|
* SF Patch #494863, file.xreadlines() should raise ValueError if file is closedNeal Norwitz2002-01-011-0/+2
| | | | | This makes xreadlines behave like all other file methods (other than close() which just returns).
* 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.