summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Accept keyword arguments for __import__ and doc the addition of the level ↵Neal Norwitz2006-04-031-6/+11
| | | | param from PEP 328.
* Patch #1460496: round() now accepts keyword arguments.Georg Brandl2006-03-311-13/+15
|
* Change int to Py_ssize_t in several places.Martin v. Löwis2006-03-071-1/+1
| | | | | Add (int) casts to silence compiler warnings. Raise Python exceptions for overflows.
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-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.
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-1/+1
|
* Generate code to recursively copy an AST intoMartin v. Löwis2006-02-261-1/+1
| | | | a tree of Python objects. Expose this through compile().
* Fix compiler warning (int vs Py_ssize_t mismatchNeal Norwitz2006-02-191-1/+1
|
* Use Py_ssize_t to count theMartin v. Löwis2006-02-161-15/+15
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-9/+9
|
* Renamed _length_cue() to __length_hint__(). See:Armin Rigo2006-02-111-3/+3
| | | | http://mail.python.org/pipermail/python-dev/2006-February/060524.html
* Fix an int/long mismatch identified here:Neal Norwitz2005-12-151-1/+2
| | | | | | | | http://www.tortall.net/mu/blog/2005/12/01 Pointed out from SF #1365916. Backport candidate.
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-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 *.
* Fix memory leaksNeal Norwitz2005-11-271-5/+8
|
* Fix a bunch of imports to use code.h instead of compile.h.Jeremy Hylton2005-10-211-1/+0
| | | | Remove duplicate declarations from compile.h
* Merge ast-branch to headJeremy Hylton2005-10-201-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.
* Convert iterator __len__() methods to a private API.Raymond Hettinger2005-09-241-3/+3
|
* Removed a check "if (args != NULL)" which is always True and makes no sense.Armin Rigo2005-09-201-5/+3
|
* bug [ 868706 ] Calling builtin function 'eval' from C causes seg fault.Georg Brandl2005-09-151-0/+7
|
* Whitespace normalization.Georg Brandl2005-08-311-7/+7
|
* SF bug #1242657: list(obj) can swallow KeyboardInterruptRaymond Hettinger2005-08-211-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().
* Fix cleanup DECREF logic in builtin_filter function.Georg Brandl2005-07-191-6/+6
|
* Add two new functions, any() and all().Raymond Hettinger2005-03-111-0/+65
|
* Put parentheses around the assignment in the 'while' loop conditionalBrett Cannon2004-12-071-1/+1
| | | | expression in min_max() to shut gcc up.
* SF patch #1077353: add key= argument to min and maxRaymond Hettinger2004-12-031-39/+71
| | | | (First draft of patch contributed by Steven Bethard.)
* 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.