summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Another "if 0:" hack, this time to complain about otherwise invisibleTim Peters2001-06-281-2/+61
| | | | | | "return expr" instances in generators (which latter may be generators due to otherwise invisible "yield" stmts hiding in "if 0" blocks). This was fun the first time, but this has gotten truly ugly now.
* Revise the interface to the profiling and tracing support for theFred Drake2001-06-273-151/+183
| | | | | | | | | | | | | | | | | | Python interpreter. This change adds two new C-level APIs: PyEval_SetProfile() and PyEval_SetTrace(). These can be used to install profile and trace functions implemented in C, which can operate at much higher speeds than Python-based functions. The overhead for calling a C-based profile function is a very small fraction of a percent of the overhead involved in calling a Python-based function. The machinery required to call a Python-based profile or trace function been moved to sysmodule.c, where sys.setprofile() and sys.setprofile() simply become users of the new interface. As a side effect, SF bug #436058 is fixed; there is no longer a _PyTrace_Init() function to declare.
* use Py_UNICODE_WIDE instead of USE_UCS4_STORAGE and Py_UNICODE_SIZEFredrik Lundh2001-06-271-1/+1
| | | | tests.
* Encode surrogates in UTF-8 even for a wide Py_UNICODE.Martin v. Löwis2001-06-271-0/+4
| | | | | | | Implement sys.maxunicode. Explicitly wrap around upper/lower computations for wide Py_UNICODE. When decoding large characters with UTF-8, represent expected test results using the \U notation.
* Cosmetic changes to MvL's change to unichr():Guido van Rossum2001-06-261-4/+6
| | | | | | | | | | | | - the correct range for the error message is range(0x110000); - put the 4-byte Unicode-size code inside the same else branch as the 2-byte code, rather generating unreachable code in the 2-byte case. - Don't hide the 'else' behine the '}'. (I would prefer that in 4-byte mode, any value should be accepted, but reasonable people can argue about that, so I'll put that off.)
* gen_getattr: make the gi_running and gi_frame members discoverable (butTim Peters2001-06-261-4/+17
| | | | not writable -- too dangerous!) from Python code.
* Support using UCS-4 as the Py_UNICODE type:Martin v. Löwis2001-06-261-0/+4
| | | | | | | | | | Add configure option --enable-unicode. Add config.h macros Py_USING_UNICODE, PY_UNICODE_TYPE, Py_UNICODE_SIZE, SIZEOF_WCHAR_T. Define Py_UCS2. Encode and decode large UTF-8 characters into single Py_UNICODE values for wide Unicode types; likewise for UTF-16. Remove test whether sizeof Py_UNICODE is two.
* Add "gi_" (generator-iterator) prefix to names of genobject members.Tim Peters2001-06-261-9/+13
| | | | | Makes it much easier to find references via dumb editor search (former "frame" in particular was near-hopeless).
* more unicode tweaks: make unichr(0xdddddddd) behave like u"\Udddddddd"Fredrik Lundh2001-06-261-6/+17
| | | | wrt surrogates. (this extends the valid range from 65535 to 1114111)
* experimental UCS-4 support: don't assume that MS_WIN32 impliesFredrik Lundh2001-06-261-1/+1
| | | | HAVE_USABLE_WCHAR_T
* SF bug #436207: "if 0: yield x" is ignored.Tim Peters2001-06-261-1/+33
| | | | Not anymore <wink>. Pure hack. Doesn't fix any other "if 0:" glitches.
* Change the semantics of "return" in generators, as discussed on theTim Peters2001-06-232-25/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Iterators list and Python-Dev; e.g., these all pass now: def g1(): try: return except: yield 1 assert list(g1()) == [] def g2(): try: return finally: yield 1 assert list(g2()) == [1] def g3(): for i in range(3): yield None yield None assert list(g3()) == [None] * 4 compile.c: compile_funcdef and com_return_stmt: Just van Rossum's patch to compile the same code for "return" regardless of function type (this goes back to the previous scheme of returning Py_None). ceval.c: gen_iternext: take a return (but not a yield) of Py_None as meaning the generator is exhausted.
* gen_iternext(): Don't assume that the current thread state's frame isTim Peters2001-06-231-2/+2
| | | | | not NULL. I don't think it can be NULL from Python code, but if using generators via the C API I expect a NULL frame is possible.
* PyFrameObject: rename f_stackbottom to f_stacktop, since it points toTim Peters2001-06-231-5/+5
| | | | | | | | the next free valuestack slot, not to the base (in America, stacks push and pop at the top -- they mutate at the bottom in Australia <winK>). eval_frame(): assert that f_stacktop isn't NULL upon entry. frame_delloc(): avoid ordered pointer comparisons involving f_stacktop when f_stacktop is NULL.
* Disallow 'yield' in a 'try' block when there's a 'finally' clause.Tim Peters2001-06-231-0/+10
| | | | | Derived from Thomas Wouters's patch on the Iterators list, but doesn't try to read c->c_block[c->c_nblocks].
* Teach the UNPACK_SEQUENCE opcode how to tease an iterable object intoTim Peters2001-06-211-32/+38
| | | | | giving up the goods. NEEDS DOC CHANGES
* Try to avoid creating reference cycles involving generators. Only keep aNeil Schemenauer2001-06-211-14/+27
| | | | | | reference to f_back when its really needed. Do a little whitespace normalization as well. This whole file is a big war between tabs and spaces but now is probably not the time to reindent everything.
* gen_iternext(): repair subtle refcount problem.Tim Peters2001-06-201-0/+5
| | | | | | | | | | | | NeilS, please check! This came from staring at your genbug.py, but I'm not sure it plugs all possible holes. Without this, I caught a frameobject refcount going negative, and it was also the cause (in debug build) of _Py_ForgetReference's attempt to forget an object with already- NULL _ob_prev and _ob_next pointers -- although I'm still not entirely sure how! Part of the difficulty is that frameobjects are stored on a free list that gets recycled very quickly, so if there's a stray pointer to one of them it never looks like an insane frameobject (never goes trough the free() mangling MS debug forces, etc).
* Remove unused code.Neil Schemenauer2001-06-201-9/+0
|
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-185-924/+1156
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* Instead of initializing & interning the strings passed to the profileFred Drake2001-06-162-26/+48
| | | | | | | and trace functions lazily, which incurs extra argument pushing and checks in the C overhead for profiling/tracing, create the strings semi-lazily when the Python code first registers a profile or trace function. This simplifies the trampoline into the profile/trace functions.
* SF bug 433228: repr(list) woes when len(list) bigTim Peters2001-06-161-2/+3
| | | | | | call_object: If the object isn't callable, display its type in the error msg rather than its repr. Bugfix candidate.
* Temporarily disable the message to stderr. Jeremy will know what to doMarc-André Lemburg2001-06-131-1/+3
| | | | about this...
* SF bug 430991: wrong co_lnotabTim Peters2001-06-091-10/+54
| | | | | | | | | Armin Rigo pointed out that the way the line-# table got built didn't work for lines generating more than 255 bytes of bytecode. Fixed as he suggested, plus corresponding changes to pyassem.py, plus added some long overdue docs about this subtle table to compile.c. Bugfix candidate (line numbers may be off in tracebacks under -O).
* call_trace(): Add an additional parameter -- pointer to a PyObject*Fred Drake2001-06-081-13/+36
| | | | | | | | | | | | | | | that should be used to cache an interned version of the event string passed to the profile/trace function. call_trace() will create interned strings and cache them in using the storage specified by this additional parameter, avoiding a lot of string object creation at runtime when using the profiling or tracing functions. All call sites are modified to pass the additional parameter, and four static PyObject* variables are allocated to cache the interned string objects. This closes SF patch #431257.
* PyErr_Occurred(): Use PyThreadState_GET(), which saves a tiny function callTim Peters2001-05-301-1/+1
| | | | | | | | in release builds. Suggested by Martin v. Loewis. I'm half tempted to macroize PyErr_Occurred too, as the whole thing could collapse to just _PyThreadState_Current->curexc_type
* Change cascaded if stmts to switch stmt in vgetargs1().Jeremy Hylton2001-05-291-19/+25
| | | | | | | | In the default branch, keep three ifs that are used if level == 0, the most common case. Note that first if here is a slight optimization for the 'O' format. Second part of SF patch 426072.
* Internal refactoring of convertsimple() and friends.Jeremy Hylton2001-05-291-515/+514
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that lots of code was re-indented. Replace two-step of convertsimple() and convertsimple1() with convertsimple() and helper converterr(), which is called to format error messages when convertsimple() fails. The old code did all the real work in convertsimple1(), but deferred error message formatting to conversimple(). The result was paying the price of a second function call on every call just to format error messages in the failure cases. Factor out of the buffer-handling code in convertsimple() and package it as convertbuffer(). Add two macros to ease readability of Unicode coversions, UNICODE_DEFAULT_ENCODING() and CONV_UNICODE, an error string. The convertsimple() routine had awful indentation problems, primarily because there were two tabs between the case line and the body of the case statements. This patch reformats the entire function to have a single tab between case line and case body, which makes the code easier to read (and consistent with ceval). The introduction of converterr() exacerbated the problem and prompted this fix. Also, eliminate non-standard whitespace after opening paren and before closing paren in a few if statements. (This checkin is part of SF patch 426072.)
* Fix bug reported by Tim Peters on python-dev:Jeremy Hylton2001-05-291-6/+5
| | | | | | | | | | | | | | | Keyword arguments passed to builtin functions that don't take them are ignored. >>> {}.clear(x=2) >>> instead of >>> {}.clear(x=2) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: clear() takes no keyword arguments
* Cruft cleanup: Removed the unused last_is_sticky argument from the internalTim Peters2001-05-281-1/+1
| | | | _PyTuple_Resize().