summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Fix SF bug [ #450909 ] __future__.division fails at promptJeremy Hylton2001-08-141-2/+6
| | | | | | When code is compiled and compiler flags are passed in, be sure to update cf_flags with any features defined by future statements in the compiled code.
* Fixed typo in comment leading up to _PyImport_FixupExtension().Barry Warsaw2001-08-131-1/+1
|
* Py_Initialize(): Apply patch by Jürgen Hermann to callBarry Warsaw2001-08-131-0/+1
| | | | | | | | _PyImport_FixupExtension() on the exceptions module. Now reload(exceptions) acts just like reload(sys) instead of raising an ImportError. This closes SF bug #422004.
* Remove much dead code from ceval.cJeremy Hylton2001-08-121-220/+18
| | | | | | | | | | | | | | The descr changes moved the dispatch for calling objects from call_object() in ceval.c to PyObject_Call() in abstract.c. call_object() and the many functions it used in ceval.c were no longer used, but were not removed. Rename meth_call() as PyCFunction_Call() so that it can be called by the CALL_FUNCTION opcode in ceval.c. Also, fix error message that referred to PyEval_EvalCodeEx() by its old name eval_code2(). (I'll probably refer to it by its old name, too.)
* SF Patch [ 429024 ] deal with some unary ops at compile timeJeremy Hylton2001-08-121-3/+66
| | | | | | | | | | | | | Revised version of Fred's patch, including support for ~ operator. If the unary +, -, or ~ operator is applied to a constant, don't generate a UNARY_xxx opcode. Just store the approriate value as a constant. If the value is negative, extend the string containing the constant and insert a negative in the 0th position. For ~, compute the inverse of int and longs and use them directly, but be prepared to generate code for all other possibilities (invalid numbers, floats, complex).
* Patch by Jonathan Wight (slightly reformatted) to forestall loading theJack Jansen2001-08-111-3/+7
| | | | | | | | same module twice, which apparently crashes Python. I could not test the error condition, but in normal life it seems to have no adverse effects. Also removed an unsued variable, and corrected 2 glaring errors (missing 'case' in front of a label).
* Remove st_nested_scopes from struct symtable,Jeremy Hylton2001-08-111-130/+46
| | | | | | | because nested scopes are always enabled. (Accidentally checked in one small change along this path yesterday, wreaking havoc in the Windows build.)
* st_nested_scopes was uninitialized trash. Jeremy should fix in a betterTim Peters2001-08-111-0/+6
| | | | way; see code comments.
* Refactor future feature handlingJeremy Hylton2001-08-104-52/+17
| | | | | | | | | | | Replace uses of PyCF_xxx with CO_xxx. Replace individual feature slots in PyFutureFeatures with single bitmask ff_features. When flags must be transfered among the three parts of the interpreter that care about them -- the pythonrun layer, the compiler, and the future feature parser -- can simply or (|) the definitions.
* Apply SF patch #424554: check for PYTHONDUMPREFS to be set instead ofGuido van Rossum2001-08-091-5/+1
| | | | asking to print the references.
* Got rid of unused includes.Jack Jansen2001-08-081-22/+2
|
* Split macglue.c into two: a new mactoolboxglue.c (in ./Python)Jack Jansen2001-08-081-0/+430
| | | | | | | | | | | | with functionality needed for both unix-Python and MacPython and a new smaller ./Mac/Python/macglue.c which contains MacPython stuff only. pymactoolbox.h has moved to ./Include from ./Mac/Include and now also contains the relevant stuff from macglue.h. The net effect of this is that the ./Mac subdirectory is not needed anymore for building the unix-Python core on MacOSX (it is needed for building the extension modules).
* Put conditional S_IFMT definition into pyport.h.Martin v. Löwis2001-08-081-5/+0
|
* Put conditional S_ISDIR definition(s) into pyport.h.Martin v. Löwis2001-08-082-5/+1
|
* Repair the Windows build (S_ISDIR() macro doesn't exist).Tim Peters2001-08-081-1/+1
| | | | | Somebody else should feel free to repair this a different way; see Python- Dev for discussion.
* Patch #448227: Raise an exception when a directory is passed to execfile.Martin v. Löwis2001-08-081-4/+23
|
* Implement PEP 238 in its (almost) full glory.Guido van Rossum2001-08-084-196/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | This introduces: - A new operator // that means floor division (the kind of division where 1/2 is 0). - The "future division" statement ("from __future__ import division) which changes the meaning of the / operator to implement "true division" (where 1/2 is 0.5). - New overloadable operators __truediv__ and __floordiv__. - New slots in the PyNumberMethods struct for true and floor division, new abstract APIs for them, new opcodes, and so on. I emphasize that without the future division statement, the semantics of / will remain unchanged until Python 3.0. Not yet implemented are warnings (default off) when / is used with int or long arguments. This has been on display since 7/31 as SF patch #443474. Flames to /dev/null.
* - Rename PyType_InitDict() to PyType_Ready().Guido van Rossum2001-08-071-1/+4
| | | | | | - Add an explicit call to PyType_Ready(&PyList_Type) to pythonrun.c (just for the heck of it, really -- we should either explicitly ready all types, or none).
* Another bug fix for recent import * warning (caught by Thomas Wouters)Jeremy Hylton2001-08-061-3/+3
| | | | | Only return if symtable_warn() returns -1, indicating that the warning was turned into an error.
* Fix error message for import * in function/class scopeJeremy Hylton2001-08-061-1/+1
|
* Fix SF bug [ #445474 ] warn about import * inside functionsJeremy Hylton2001-08-061-0/+5
| | | | Reported by the Man himself.
* Derived from SF patch #446899 Permit import of .pyw under Windows, fromTim Peters2001-08-041-5/+14
| | | | David Bolen.
* Plug a memory leak in Py_InitModule4(): when PyDict_SetItemString() failed,Fred Drake2001-08-041-2/+6
| | | | | | the object being inserted was not being DECREFed. This closes SF bug #444486.
* Merge of descr-branch back into trunk.Tim Peters2001-08-025-563/+128
|
* Add mysnprintf.c to Windows build, + squash compiler wngs in mysnprintf.c.Tim Peters2001-07-311-2/+3
|
* This patch turns the Python API mismatch notice into a standardMarc-André Lemburg2001-07-312-5/+107
| | | | | | | | | | | | Python warning which can be catched by means of the Python warning framework. It also adds two new APIs which hopefully make it easier for Python to switch to buffer overflow safe [v]snprintf() APIs for error reporting et al. The two new APIs are PyOS_snprintf() and PyOS_vsnprintf() and work just like the standard ones in many C libs. On platforms which have snprintf(), the native APIs are used, on all other an emulation with snprintf() tries to do its best.
* Do for hasattr() what was done for getattr()Jeremy Hylton2001-07-301-0/+11
| | | | | Namely, an exception is raised if the second arg to hasattr() is not a string or Unicode.
* Fix for SF byg [ #420304 ] getattr function w/ defaultJeremy Hylton2001-07-301-0/+11
| | | | | | | Fix suggested by Michael Hudson: Raise TypeError if attribute name passed to getattr() is not a string or Unicode. There is some unfortunate duplication of code between builtin_getattr() and PyObject_GetAttr(), but it appears to be unavoidable.
* Add _PyUnicode_AsDefaultEncodedString to unicodeobject.h.Jeremy Hylton2001-07-301-5/+0
| | | | | | | And remove all the extern decls in the middle of .c files. Apparently, it was excluded from the header file because it is intended for internal use by the interpreter. It's still intended for internal use and documented as such in the header file.
* Fix for SF bug [ #443866 ] Evaluating func_code causing core dumpJeremy Hylton2001-07-301-1/+7
| | | | If the code object has free variables, raise TypeError.
* Repair more now-obsolete references to config.h.Tim Peters2001-07-261-1/+1
|
* Undoing the UCS-4 patch addition which caused unichr() to returnMarc-André Lemburg2001-07-261-1/+11
| | | | | surrogates for Unicode code points outside range(0x10000) on narrow Python builds.
* Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774.Martin v. Löwis2001-07-267-7/+7
|
* Add -E command line switch (ignore environment variables like PYTHONHOMENeil Schemenauer2001-07-233-12/+13
| | | | and PYTHONPATH).
* Patch number #422106 by Greg Ball, to fix segmentationMoshe Zadka2001-07-231-0/+5
| | | | | | | fault in sys.displayhook. Please check this in on the 2.2a1 branch (or whatever is necessary to get it working next release)
* SF Patch #441791, with changes: when "import foo.bar" fails with anGuido van Rossum2001-07-231-4/+16
| | | | | | | exception in the execution of bar, ensure that foo.bar exists. (Previously, while sys.modules['foo.bar'] would exist, foo.bar would only be created upon successful execution of bar. This is inconvenient; some would say wrong. :-)
* Add a low-level API to access interpreters, for David Beazley.Guido van Rossum2001-07-191-0/+25
| | | | SF patch #436376.
* Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.Martin v. Löwis2001-07-183-13/+76
| | | | Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
* Deleting zombiesGuido van Rossum2001-07-171-211/+0
|
* jcompile(): inherit the CO_GENERATOR_ALLOWED flag from the 'base'Guido van Rossum2001-07-161-0/+1
| | | | compiling struct.
* PyRun_StringFlags(): forgot to pass the flags on toGuido van Rossum2001-07-161-1/+4
| | | | | PyParser_SimpleParseString(). Now calls PyParser_SimpleParseStringFlags() with the correct flag.
* Ugly. A pile of new xxxFlags() functions, to communicate to the parserTim Peters2001-07-161-9/+30
| | | | | | | | | | | | | | | | | | | | | | | that 'yield' is a keyword. This doesn't help test_generators at all! I don't know why not. These things do work now (and didn't before this patch): 1. "from __future__ import generators" now works in a native shell. 2. Similarly "python -i xxx.py" now has generators enabled in the shell if xxx.py had them enabled. 3. This program (which was my doctest proxy) works fine: from __future__ import generators source = """\ def f(): yield 1 """ exec compile(source, "", "single") in globals() print type(f())
* future.c: insert a cosmetic space.Tim Peters2001-07-162-2/+2
| | | | | pythonrun.c, run_pyc_file(): repair semantic error wrt CO_GENERATOR vs CO_GENERATOR_ALLOWED.
* Part way to allowing "from __future__ import generators" to communicateTim Peters2001-07-165-29/+54
| | | | | | | | | | that info to code dynamically compiled *by* code compiled with generators enabled. Doesn't yet work because there's still no way to tell the parser that "yield" is OK (unlike nested_scopes, the parser has its fingers in this too). Replaced PyEval_GetNestedScopes by a more-general PyEval_MergeCompilerFlags. Perhaps I should not have? I doubted it was *intended* to be part of the public API, so just did.
* Preliminary support for "from __future__ import generators" to enableGuido van Rossum2001-07-151-0/+2
| | | | | | | | the yield statement. I figure we have to have this in before I can release 2.2a1 on Wednesday. Note: test_generators is currently broken, I'm counting on Tim to fix this.
* GC for generator objects.Neil Schemenauer2001-07-121-4/+12
|
* Re-add 'advanced' xrange features, adding DeprecationWarnings as discussedThomas Wouters2001-07-091-1/+1
| | | | | on python-dev. The features will still vanish, however, just one release later.
* Complete the xrange-simplification checkins: call PyRange_New() withGuido van Rossum2001-07-051-1/+1
| | | | fewer arguments.
* SF bug #438295: [Windows] __init__.py cause strange behaviorTim Peters2001-07-051-11/+28
| | | | | | | | | | Probable fix (the bug report doesn't have enough info to say for sure). find_init_module(): Insist on a case-sensitive match for __init__ files. Given __INIT__.PY instead, find_init_module() thought that was fine, but the later attempt to do find_module("__INIT__.PY") didn't and its caller silently suppressed the resulting ImportError. Now find_init_module() refuses to accept __INIT__.PY to begin with. Bugfix candidate; specific to platforms with case-insensitive filesystems.
* This change adjusts the profiling/tracing support so that the commonFred Drake2001-07-032-47/+66
| | | | | | | | | | | | | | | | path (with no profile/trace function) through eval_code2() and eval_frame() avoids several checks. In the common cases of calls, returns, and exception propogation, eval_code2() and eval_frame() used to test two values in the thread-state: the profiling function and the tracing function. With this change, a flag is set in the thread-state if either of these is active, allowing a single check to suffice when both are NULL. This also simplifies the code needed when either function is in use but is already active (to avoid profiling/tracing the profiler/tracer); the flag is set to 0 when the profile/trace code is entered, allowing the same check to suffice for "already in the tracer" for call/return/ exception events.