summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Patch #1015021: Stop claiming that coerce can return None.Martin v. Löwis2004-08-251-4/+4
| | | | Will backport to 2.3.
* Patch #1005468: Disambiguate "min() or max()" exception string.Martin v. Löwis2004-08-121-3/+4
|
* Subclasses of string can no longer be interned. The semantics ofJeremy Hylton2004-08-071-0/+5
| | | | | | | | | | | interning were not clear here -- a subclass could be mutable, for example -- and had bugs. Explicitly interning a subclass of string via intern() will raise a TypeError. Internal operations that attempt to intern a string subclass will have no effect. Added a few tests to test_builtin that includes the old buggy code and verifies that calls like PyObject_SetAttr() don't fail. Perhaps these tests should have gone in test_string.
* for some reason, the lack of adherence to Python's C whitespace rulesMichael W. Hudson2004-08-021-2/+2
| | | | must have annoyed me at some point.
* Completed the patch for Bug #215126.Raymond Hettinger2004-08-021-2/+6
| | | | | | | * Fixes an incorrect variable in a PyDict_CheckExact. * Allow general mapping locals arguments for the execfile() function and exec statement. * Add tests.
* Check the type of values returned by __int__, __float__, __long__,Neil Schemenauer2004-07-191-2/+20
| | | | | | __oct__, and __hex__. Raise TypeError if an invalid type is returned. Note that PyNumber_Int and PyNumber_Long can still return ints or longs. Fixes SF bug #966618.
* This closes patch:Michael W. Hudson2004-07-071-1/+2
| | | | | | | | | | | | | | | | | [ 960406 ] unblock signals in threads although the changes do not correspond exactly to any patch attached to that report. Non-main threads no longer have all signals masked. A different interface to readline is used. The handling of signals inside calls to PyOS_Readline is now rather different. These changes are all a bit scary! Review and cross-platform testing much appreciated.
* * Fix missing return after error message is set.Raymond Hettinger2004-07-061-1/+2
| | | | * Add a test case that would have caught it.
* SF Bug #215126: Over restricted type checking on eval() functionRaymond Hettinger2004-07-021-6/+13
| | | | | | The builtin eval() function now accepts any mapping for the locals argument. Time sensitive steps guarded by PyDict_CheckExact() to keep from slowing down the normal case. My timings so no measurable impact.
* OS/2 VACPP build updates/fixesAndrew MacIntyre2004-03-291-1/+1
|
* Fix input() builtin function to respect compiler flags.Hye-Shik Chang2004-02-021-1/+4
| | | | (SF patch 876178, patch by mwh, unittest by perky)
* Apply pre-sizing optimization to a broader class of objects.Raymond Hettinger2004-01-041-8/+4
| | | | | Formerly, the length was only fetched from sequence objects. Now, any object that reports its length can benefit from pre-sizing.
* Apply map/zip pre-sizing optimization to a broader class of objects.Raymond Hettinger2004-01-041-11/+7
| | | | | Formerly, the length was only fetched from sequence objects. Now, any object that reports its length can benefit from pre-sizing.
* Guido grants a Christmas wish:Raymond Hettinger2003-12-171-0/+45
| | | | sorted() becomes a regular function instead of a classmethod.
* Remove the PendingDeprecationWarning from apply(). apply() willFred Drake2003-12-051-4/+0
| | | | remain deprecated in the documentation.
* * Migrate set() and frozenset() from the sandbox.Raymond Hettinger2003-11-161-0/+2
| | | | | | | | * Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.
* Implement and apply PEP 322, reverse iterationRaymond Hettinger2003-11-061-0/+1
|
* regressing the performance bugfix -- Guido wants the performance bug leftAlex Martelli2003-10-251-1/+1
| | | | alone, because there can be no guarantee re the semantics of += vs + .
* Changed builtin_sum to use PyNumber_InPlaceAdd (same semantics, but fixesAlex Martelli2003-10-251-1/+1
| | | | a performance bug in sum(manylists)), same as in 2.3 maintenance branch.
* Use PyArg_UnpackTuple() where possible.Raymond Hettinger2003-10-251-1/+1
|
* Simplify and speedup uses of Py_BuildValue():Raymond Hettinger2003-10-121-4/+4
| | | | | | * 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)
* Correct check of PyUnicode_Resize() return value.Jeremy Hylton2003-09-161-1/+2
|
* Reflow long lines and reformat.Jeremy Hylton2003-09-161-13/+13
|
* Fix a crash: when sq_item failed the code continued blindly and used theWalter Dörwald2003-08-181-3/+10
| | | | | | NULL pointer. (Detected by Michael Hudson, patch provided by Neal Norwitz). Fix refcounting leak in filtertuple().
* Make filter(bool, ...) as fast as filter(None, ...).Neil Schemenauer2003-08-141-1/+1
|
* As discussed on python-dev, changed builtin.zip() to handle zero argumentsRaymond Hettinger2003-08-021-5/+3
| | | | by returning an empty list instead of raising a TypeError.
* some more error-message enhancementsAlex Martelli2003-04-231-10/+10
|
* complete and clarify some error messages for range()Alex Martelli2003-04-231-5/+5
|
* fixed a potential refcount bug (thanks Raymond!).Alex Martelli2003-04-221-1/+1
|
* Adding new built-in function sum, with docs and tests.Alex Martelli2003-04-221-0/+61
|
* Some errors from range() should be TypeError, not ValueError.Guido van Rossum2003-04-151-3/+3
|
* Prompted by Tim's comment, when handle_range_longs() sees anGuido van Rossum2003-04-141-9/+9
| | | | | unexpected type, report the actual type rather than 'float'. (It's hard to even reach this code with a float. :-)
* handle_range_longs(): refcount handling is very delicate here, andTim Peters2003-04-131-31/+50
| | | | | | | the code erroneously decrefed the istep argument in an error case. This caused a co_consts tuple to lose a float constant prematurely, which eventually caused gc to try executing static data in floatobject.c (don't ask <wink>). So reworked this extensively to ensure refcount correctness.
* Patch by Chad Netzer (with significant change):Guido van Rossum2003-04-111-5/+190
| | | | | | | - range() now works even if the arguments are longs with magnitude larger than sys.maxint, as long as the total length of the sequence fits. E.g., range(2**100, 2**101, 2**100) is the following list: [1267650600228229401496703205376L]. (SF patch #707427.)
* SF patch #701494: more apply removalsRaymond Hettinger2003-04-061-1/+4
|
* Improved new Py_TRACE_REFS gimmicks.Tim Peters2003-03-231-2/+16
| | | | | | | | | | | Arranged that all the objects exposed by __builtin__ appear in the list of all objects. I basically peed away two days tracking down a mystery leak in sys.gettotalrefcount() in a ZODB app (== tons of code), because the object leaking the references didn't appear in the sys.getobjects(0) list. The object happened to be False. Now False is in the list, along with other popular & previously missing leak candidates (like None). Alas, we still don't have a choke point covering *all* Python objects, so the list of all objects may still be incomplete.
* Fix SF bug #690435, apply fails to check if warning raises exceptionNeal Norwitz2003-02-231-3/+4
| | | | (patch provided by Greg Chapman)
* - Finally fixed the bug in compile() and exec where a string endingGuido van Rossum2003-02-131-1/+3
| | | | | | | | | with an indented code block but no newline would raise SyntaxError. This would have been a four-line change in parsetok.c... Except codeop.py depends on this behavior, so a compilation flag had to be invented that causes the tokenizer to revert to the old behavior; this required extra changes to 2 .h files, 2 .c files, and 2 .py files. (Fixes SF bug #501622.)
* Change filtertuple() to use tp_as_sequence->sq_itemWalter Dörwald2003-02-101-1/+6
| | | | | instead of PyTuple_GetItem, so an overwritten __getitem__ in a tuple subclass works. SF bug #665835.
* Squashed compiler wng about signed/unsigned clash in comparison.Tim Peters2003-02-101-1/+1
|
* Change filterstring() and filterunicode(): If theWalter Dörwald2003-02-101-43/+48
| | | | | | | | | | | | object is not a real str or unicode but an instance of a subclass, construct the output via looping over __getitem__. This guarantees that the result is the same for function==None and function==lambda x:x This doesn't happen for tuples, because filtertuple() uses PyTuple_GetItem(). (This was discussed on SF bug #665835).
* My previous checkin caused compile() to no longer accept buffers, as notedJust van Rossum2003-02-101-5/+7
| | | | | my MAL. Fixed. (Btw. eval() still doesn't take buffers, but that was so even before my patch.)
* patch #683515: "Add unicode support to compile(), eval() and exec"Just van Rossum2003-02-101-6/+40
| | | | Incorporated nnorwitz's comment re. Py__USING_UNICODE.
* Make sure filter() never returns tuple, str or unicodeWalter Dörwald2003-02-041-5/+22
| | | | subclasses. (Discussed in SF patch #665835)
* PyUnicode_Resize() doesn't free its argument in case of a failure,Walter Dörwald2003-02-041-1/+1
| | | | | so we can jump to the error handling code that does. (Spotted by Neal Norwitz)
* filterstring() and filterunicode() in Python/bltinmodule.cWalter Dörwald2003-02-041-8/+70
| | | | | | | | | | | | | blindly assumed that tp_as_sequence->sq_item always returns a str or unicode object. This might fail with str or unicode subclasses. This patch checks whether the object returned from __getitem__ is a str/unicode object and raises a TypeError if not (and the filter function returned true). Furthermore the result for __getitem__ can be more than one character long, so checks for enough memory have to be done.
* SF #661437, apply() should get PendingDeprecationNeal Norwitz2003-02-031-0/+3
|
* Patch #636005: Filter unicode into unicode.Martin v. Löwis2003-01-251-0/+62
|
* SF bug #655271: Slightly modify locals() docRaymond Hettinger2003-01-041-1/+1
| | | | Clarify the operation of locals().
* Make error message more specific for min() and max().Raymond Hettinger2002-12-291-1/+1
| | | | Suggested by MvL.