summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Continue rolling back pep-3141 changes that changed behavior from 2.5. ThisJeffrey Yasskin2008-01-051-17/+25
| | | | | | | | | | | | round included: * Revert round to its 2.6 behavior (half away from 0). * Because round, floor, and ceil always return float again, it's no longer necessary to have them delegate to __xxx___, so I've ripped that out of their implementations and the Real ABC. This also helps in implementing types that work in both 2.6 and 3.0: you return int from the __xxx__ methods, and let it get enabled by the version upgrade. * Make pow(-1, .5) raise a ValueError again.
* Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (justJeffrey Yasskin2008-01-031-23/+30
| | | | | | | the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361, r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new documentation. The only significant difference is that round(x) returns a float to preserve backward-compatibility. See http://bugs.python.org/issue1689.
* Improve performance of built-in any()/all() by avoiding PyIter_Next() --Guido van Rossum2007-12-201-8/+28
| | | | | using a trick found in ifilter(). Feel free to backport to 2.5.
* Note that open() is the preferred way to open files (issue 1510).Skip Montanaro2007-12-081-1/+2
|
* Fix Issue 1045.Raymond Hettinger2007-12-061-24/+3
| | | | | Factor-out common calling code by simplifying the length_hint API. Speed-up the function by caching the PyObject_String for the attribute lookup.
* Missing DECREFsRaymond Hettinger2007-10-251-0/+2
|
* Fixup error return and add support for intermixed ints and floats/Raymond Hettinger2007-10-241-1/+7
|
* Optimize sum() for integer and float inputs.Raymond Hettinger2007-10-241-0/+70
|
* Add a bunch more deprecation warnings for builtins that are going away in 3.0Neal Norwitz2007-05-231-0/+24
|
* Add -3 option to the interpreter to warn about features that areNeal Norwitz2007-05-231-0/+5
| | | | | | | deprecated and will be changed/removed in Python 3.0. This patch is mostly from Anthony. I tweaked some format and added a little doc.
* Patch #1444529: the builtin compile() now accepts keyword arguments.Georg Brandl2007-03-131-4/+7
| | | | (backport)
* Typo and grammar fixes.Georg Brandl2007-03-131-1/+1
|
* Backport from Py3k branch:Georg Brandl2007-03-121-9/+10
| | | | | | | Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir. Had to change a few bits of the patch because classobjs and __methods__ are still in Py2.6.
* Bug #1283491: follow docstring convention wrt. keyword-able args in sum().Georg Brandl2006-10-121-2/+3
|
* Fix SF #1552093, eval docstring typo (3 ps in mapping)Neal Norwitz2006-09-051-1/+1
|
* It's highly unlikely, though possible for PyEval_Get*() to return NULLs.Neal Norwitz2006-08-121-2/+2
| | | | | | So be safe and do an XINCREF. Klocwork # 221-222.
* Bug #1535165: fixed a segfault in input() and raw_input() whenGeorg Brandl2006-08-061-1/+1
| | | | sys.stdin is closed.
* SF #1479181: split open() and file() from being aliases for each other.Neal Norwitz2006-05-021-4/+14
|
* Replace INT_MAX with PY_SSIZE_T_MAX.Martin v. Löwis2006-04-131-3/+2
|
* 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.