summaryrefslogtreecommitdiff
path: root/Python/bltinmodule.c
AgeCommit message (Collapse)AuthorLines
2005-09-15backport bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.Georg Brandl-0/+7
2005-08-21SF bug #1242657: list(obj) can swallow KeyboardInterruptRaymond Hettinger-0/+12
Fix over-aggressive PyErr_Clear(). The same code fragment appears in various guises in list.extend(), map(), filter(), zip(), and internally in PySequence_Tuple().
2005-07-19Backport: fix cleanup DECREF logic in builtin_filter function.Georg Brandl-6/+6
2004-08-25Patch #1015021: Stop claiming that coerce can return None.Martin v. Löwis-4/+4
Will backport to 2.3.
2004-08-12Patch #1005468: Disambiguate "min() or max()" exception string.Martin v. Löwis-3/+4
2004-08-07Subclasses of string can no longer be interned. The semantics ofJeremy Hylton-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.
2004-08-02for some reason, the lack of adherence to Python's C whitespace rulesMichael W. Hudson-2/+2
must have annoyed me at some point.
2004-08-02Completed the patch for Bug #215126.Raymond Hettinger-2/+6
* Fixes an incorrect variable in a PyDict_CheckExact. * Allow general mapping locals arguments for the execfile() function and exec statement. * Add tests.
2004-07-19Check the type of values returned by __int__, __float__, __long__,Neil Schemenauer-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.
2004-07-07This closes patch:Michael W. Hudson-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.
2004-07-06* Fix missing return after error message is set.Raymond Hettinger-1/+2
* Add a test case that would have caught it.
2004-07-02SF Bug #215126: Over restricted type checking on eval() functionRaymond Hettinger-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.
2004-03-29OS/2 VACPP build updates/fixesAndrew MacIntyre-1/+1
2004-02-02Fix input() builtin function to respect compiler flags.Hye-Shik Chang-1/+4
(SF patch 876178, patch by mwh, unittest by perky)
2004-01-04Apply pre-sizing optimization to a broader class of objects.Raymond Hettinger-8/+4
Formerly, the length was only fetched from sequence objects. Now, any object that reports its length can benefit from pre-sizing.
2004-01-04Apply map/zip pre-sizing optimization to a broader class of objects.Raymond Hettinger-11/+7
Formerly, the length was only fetched from sequence objects. Now, any object that reports its length can benefit from pre-sizing.
2003-12-17Guido grants a Christmas wish:Raymond Hettinger-0/+45
sorted() becomes a regular function instead of a classmethod.
2003-12-05Remove the PendingDeprecationWarning from apply(). apply() willFred Drake-4/+0
remain deprecated in the documentation.
2003-11-16* Migrate set() and frozenset() from the sandbox.Raymond Hettinger-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.
2003-11-06Implement and apply PEP 322, reverse iterationRaymond Hettinger-0/+1
2003-10-25regressing the performance bugfix -- Guido wants the performance bug leftAlex Martelli-1/+1
alone, because there can be no guarantee re the semantics of += vs + .
2003-10-25Changed builtin_sum to use PyNumber_InPlaceAdd (same semantics, but fixesAlex Martelli-1/+1
a performance bug in sum(manylists)), same as in 2.3 maintenance branch.
2003-10-25Use PyArg_UnpackTuple() where possible.Raymond Hettinger-1/+1
2003-10-12Simplify and speedup uses of Py_BuildValue():Raymond Hettinger-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)
2003-09-16Correct check of PyUnicode_Resize() return value.Jeremy Hylton-1/+2
2003-09-16Reflow long lines and reformat.Jeremy Hylton-13/+13
2003-08-18Fix a crash: when sq_item failed the code continued blindly and used theWalter Dörwald-3/+10
NULL pointer. (Detected by Michael Hudson, patch provided by Neal Norwitz). Fix refcounting leak in filtertuple().
2003-08-14Make filter(bool, ...) as fast as filter(None, ...).Neil Schemenauer-1/+1
2003-08-02As discussed on python-dev, changed builtin.zip() to handle zero argumentsRaymond Hettinger-5/+3
by returning an empty list instead of raising a TypeError.
2003-04-23some more error-message enhancementsAlex Martelli-10/+10
2003-04-23complete and clarify some error messages for range()Alex Martelli-5/+5
2003-04-22fixed a potential refcount bug (thanks Raymond!).Alex Martelli-1/+1
2003-04-22Adding new built-in function sum, with docs and tests.Alex Martelli-0/+61
2003-04-15Some errors from range() should be TypeError, not ValueError.Guido van Rossum-3/+3
2003-04-14Prompted by Tim's comment, when handle_range_longs() sees anGuido van Rossum-9/+9
unexpected type, report the actual type rather than 'float'. (It's hard to even reach this code with a float. :-)
2003-04-13handle_range_longs(): refcount handling is very delicate here, andTim Peters-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.
2003-04-11Patch by Chad Netzer (with significant change):Guido van Rossum-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.)
2003-04-06SF patch #701494: more apply removalsRaymond Hettinger-1/+4
2003-03-23Improved new Py_TRACE_REFS gimmicks.Tim Peters-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.
2003-02-23Fix SF bug #690435, apply fails to check if warning raises exceptionNeal Norwitz-3/+4
(patch provided by Greg Chapman)
2003-02-13- Finally fixed the bug in compile() and exec where a string endingGuido van Rossum-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.)
2003-02-10Change filtertuple() to use tp_as_sequence->sq_itemWalter Dörwald-1/+6
instead of PyTuple_GetItem, so an overwritten __getitem__ in a tuple subclass works. SF bug #665835.
2003-02-10Squashed compiler wng about signed/unsigned clash in comparison.Tim Peters-1/+1
2003-02-10Change filterstring() and filterunicode(): If theWalter Dörwald-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).
2003-02-10My previous checkin caused compile() to no longer accept buffers, as notedJust van Rossum-5/+7
my MAL. Fixed. (Btw. eval() still doesn't take buffers, but that was so even before my patch.)
2003-02-10patch #683515: "Add unicode support to compile(), eval() and exec"Just van Rossum-6/+40
Incorporated nnorwitz's comment re. Py__USING_UNICODE.
2003-02-04Make sure filter() never returns tuple, str or unicodeWalter Dörwald-5/+22
subclasses. (Discussed in SF patch #665835)
2003-02-04PyUnicode_Resize() doesn't free its argument in case of a failure,Walter Dörwald-1/+1
so we can jump to the error handling code that does. (Spotted by Neal Norwitz)
2003-02-04filterstring() and filterunicode() in Python/bltinmodule.cWalter Dörwald-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.
2003-02-03SF #661437, apply() should get PendingDeprecationNeal Norwitz-0/+3