summaryrefslogtreecommitdiff
path: root/Python/bltinmodule.c
AgeCommit message (Collapse)AuthorLines
2006-09-05Fix SF #1552093, eval docstring typo (3 ps in mapping)Neal Norwitz-1/+1
2006-08-12It's highly unlikely, though possible for PyEval_Get*() to return NULLs.Neal Norwitz-2/+2
So be safe and do an XINCREF. Klocwork # 221-222.
2006-08-06Bug #1535165: fixed a segfault in input() and raw_input() whenGeorg Brandl-1/+1
sys.stdin is closed.
2006-05-02SF #1479181: split open() and file() from being aliases for each other.Neal Norwitz-4/+14
2006-04-13Replace INT_MAX with PY_SSIZE_T_MAX.Martin v. Löwis-3/+2
2006-04-03Accept keyword arguments for __import__ and doc the addition of the level ↵Neal Norwitz-6/+11
param from PEP 328.
2006-03-31Patch #1460496: round() now accepts keyword arguments.Georg Brandl-13/+15
2006-03-07Change int to Py_ssize_t in several places.Martin v. Löwis-1/+1
Add (int) casts to silence compiler warnings. Raise Python exceptions for overflows.
2006-02-28SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters-3/+5
- IMPORT_NAME takes an extra argument from the stack: the relativeness of the import. Only passed to __import__ when it's not -1. - __import__() takes an optional 5th argument for the same thing; it __defaults to -1 (old semantics: try relative, then absolute) - 'from . import name' imports name (be it module or regular attribute) from the current module's *package*. Likewise, 'from .module import name' will import name from a sibling to the current module. - Importing from outside a package is not allowed; 'from . import sys' in a toplevel module will not work, nor will 'from .. import sys' in a (single-level) package. - 'from __future__ import absolute_import' will turn on the new semantics for import and from-import: imports will be absolute, except for from-import with dots. Includes tests for regular imports and importhooks, parser changes and a NEWS item, but no compiler-package changes or documentation changes.
2006-02-27Revert backwards-incompatible const changes.Martin v. Löwis-1/+1
2006-02-26Generate code to recursively copy an AST intoMartin v. Löwis-1/+1
a tree of Python objects. Expose this through compile().
2006-02-19Fix compiler warning (int vs Py_ssize_t mismatchNeal Norwitz-1/+1
2006-02-16Use Py_ssize_t to count theMartin v. Löwis-15/+15
2006-02-15Merge ssize_t branch.Martin v. Löwis-9/+9
2006-02-11Renamed _length_cue() to __length_hint__(). See:Armin Rigo-3/+3
http://mail.python.org/pipermail/python-dev/2006-February/060524.html
2005-12-15Fix an int/long mismatch identified here:Neal Norwitz-1/+2
http://www.tortall.net/mu/blog/2005/12/01 Pointed out from SF #1365916. Backport candidate.
2005-12-10Add const to several API functions that take char *.Jeremy Hylton-1/+1
In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
2005-11-27Fix memory leaksNeal Norwitz-5/+8
2005-10-21Fix a bunch of imports to use code.h instead of compile.h.Jeremy Hylton-1/+0
Remove duplicate declarations from compile.h
2005-10-20Merge ast-branch to headJeremy Hylton-1/+1
This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
2005-09-24Convert iterator __len__() methods to a private API.Raymond Hettinger-3/+3
2005-09-20Removed a check "if (args != NULL)" which is always True and makes no sense.Armin Rigo-5/+3
2005-09-15bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.Georg Brandl-0/+7
2005-08-31Whitespace normalization.Georg Brandl-7/+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-19Fix cleanup DECREF logic in builtin_filter function.Georg Brandl-6/+6
2005-03-11Add two new functions, any() and all().Raymond Hettinger-0/+65
2004-12-07Put parentheses around the assignment in the 'while' loop conditionalBrett Cannon-1/+1
expression in min_max() to shut gcc up.
2004-12-03SF patch #1077353: add key= argument to min and maxRaymond Hettinger-39/+71
(First draft of patch contributed by Steven Bethard.)
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)