summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* Make PyDescr_IsData() a macro. It's too simple to be a function.Guido van Rossum2002-08-191-1/+1
| | | | Should save 4% on slot lookups.
* This is my patchMichael W. Hudson2002-08-151-2/+3
| | | | | | | | [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change.
* provide less mysterious error messages when seeing end-of-line inSkip Montanaro2002-08-151-0/+2
| | | | | single-quoted strings or end-of-file in triple-quoted strings. closes patch 586561.
* Added a FutureWarning for constructs that will change semantically inBarry Warsaw2002-08-141-0/+1
| | | | | the future. Changed PEP 237 hex constant warnings from DeprecationWarning to FutureWarning. Updated the documentation.
* Patch #505705: Remove eval in pickle and cPickle.Martin v. Löwis2002-08-141-0/+4
|
* Correct PyAPI_FUNC to PyAPI_DATA - sorry Jack.Mark Hammond2002-08-121-2/+2
|
* Add name mangling for new PyUnicode_FromOrdinal() and fix declarationMarc-André Lemburg2002-08-121-1/+3
| | | | to use new extern macro.
* Excise DL_EXPORT from Include.Mark Hammond2002-08-1251-673/+669
| | | | Thanks to Skip Montanaro and Kalle Svensson for the patches.
* Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.Marc-André Lemburg2002-08-111-0/+12
| | | | | | | u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. Closes SF bug #593581.
* A modest speedup of object deallocation. call_finalizer() did ratherGuido van Rossum2002-08-081-0/+1
| | | | | | | | | | | | | | | a lot of work: it had to save and restore the current exception around a call to lookup_maybe(), because that could fail in rare cases, and most objects don't have a __del__ method, so the whole exercise was usually a waste of time. Changed this to cache the __del__ method in the type object just like all other special methods, in a new slot tp_del. So now subtype_dealloc() can test whether tp_del is NULL and skip the whole exercise if it is. The new slot doesn't need a new flag bit: subtype_dealloc() is only called if the type was dynamically allocated by type_new(), so it's guaranteed to have all current slots. Types defined in C cannot fill in tp_del with a function of their own, so there's no corresponding "wrapper". (That functionality is already available through tp_dealloc.)
* Added info about the right way to leave the body of a trashcan-protectedTim Peters2002-08-071-0/+5
| | | | destructor early.
* SF patch 580331 by Oren Tirosh: make file objects their own iterator.Guido van Rossum2002-08-061-3/+6
| | | | | | | | | | | | | | | | | | | | | | For a file f, iter(f) now returns f (unless f is closed), and f.next() is similar to f.readline() when EOF is not reached; however, f.next() uses a readahead buffer that messes up the file position, so mixing f.next() and f.readline() (or other methods) doesn't work right. Calling f.seek() drops the readahead buffer, but other operations don't. The real purpose of this change is to reduce the confusion between objects and their iterators. By making a file its own iterator, it's made clearer that using the iterator modifies the file object's state (in particular the current position). A nice side effect is that this speeds up "for line in f:" by not having to use the xreadlines module. The f.xreadlines() method is still supported for backwards compatibility, though it is the same as iter(f) now. (I made some cosmetic changes to Oren's code, and added a test for "file closed" to file_iternext() and file_iter().)
* Remove function definition from cStringIO.h.Jeremy Hylton2002-08-051-23/+4
| | | | xxxPyCObject_Import() seems to be a copy of PyCObject_Import().
* Patch #534304: Implement phase 1 of PEP 263.Martin v. Löwis2002-08-042-0/+2
|
* Added one call to Py_Main(), for OSX framework builds only, that will get theJack Jansen2002-08-021-1/+3
| | | | | | | | | | | | | actual script to run in case we are running from an applet. If we are indeed running an applet we skip the normal option processing leaving it all to the applet code. This allows us to get use the normal python binary in the Python.app bundle, giving us all the normal command line options through PythonLauncher while still allowing Python.app to be used as the template for building applets. Consequently, pythonforbundle is gone, and Mac/Python/macmain.c isn't used on OSX anymore.
* Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototypeMark Hammond2002-08-021-0/+3
| | | | | | for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
* New functions for extension writers on Windows:Thomas Heller2002-07-291-0/+3
| | | | | | | | | | PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename(). Similar to PyErr_SetFromWindowsErrWithFilename() and PyErr_SetFromWindowsErr(), but they allow to specify the exception type to raise. Available on Windows. See SF patch #576458.
* Excise DL_IMPORT/EXPORT from object.h, and related files. This patchMark Hammond2002-07-295-93/+93
| | | | | also adds 'extern' to PyAPI_DATA rather than at each declaration, as discussed with Tim and Guido.
* Define _XOPEN_SOURCE and _GNU_SOURCE in pyconfig.h, to have themMartin v. Löwis2002-07-201-11/+0
| | | | available in the configure tests already.
* Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT.Mark Hammond2002-07-192-39/+93
|
* Define _XOPEN_SOURCE in configure and Python.h.Jeremy Hylton2002-07-181-6/+1
| | | | | | | | | | | | | | | | This gets compilation of posixmodule.c to succeed on Tru64 and does no harm on Linux. We may need to undefine it on some platforms, but let's wait and see. Martin says: > I think it is generally the right thing to define _XOPEN_SOURCE on > Unix, providing a negative list of systems that cannot support this > setting (or preferably solving whatever problems remain). > > I'd put an (unconditional) AC_DEFINE into configure.in early on; it > *should* go into confdefs.h as configure proceeds, and thus be active > when other tests are performed.
* staticforward bites the dust.Jeremy Hylton2002-07-171-18/+9
| | | | | | | | | | | | | | | The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
* SF patch # 580411, move frame macros from frameobject.h into ceval.cNeal Norwitz2002-07-141-20/+0
| | | | | remove unused macros use co alias instead of f->f_code in macros
* HAVE_LIMITS_H -- raise #error if not defined; limits.h is std CTim Peters2002-07-122-12/+2
| | | | | | ULONG_MAX -- removed; std C requires it in limits.h LONGLONG_MAX -- removed; never used ULONGLONGMAX -- removed; never used
* object.h special-build macro minefield: renamed all the new lexicalTim Peters2002-07-111-60/+40
| | | | | | | | | | | | | | | | | | | | | | | | | helper macros to something saner, and used them appropriately in other files too, to reduce #ifdef blocks. classobject.c, instance_dealloc(): One of my worst Python Memories is trying to fix this routine a few years ago when COUNT_ALLOCS was defined but Py_TRACE_REFS wasn't. The special-build code here is way too complicated. Now it's much simpler. Difference: in a Py_TRACE_REFS build, the instance is no longer in the doubly-linked list of live objects while its __del__ method is executing, and that may be visible via sys.getobjects() called from a __del__ method. Tough -- the object is presumed dead while its __del__ is executing anyway, and not calling _Py_NewReference() at the start allows enormous code simplification. typeobject.c, call_finalizer(): The special-build instance_dealloc() pain apparently spread to here too via cut-'n-paste, and this is much simpler now too. In addition, I didn't understand why this routine was calling _PyObject_GC_TRACK() after a resurrection, since there's no plausible way _PyObject_GC_UNTRACK() could have been called on the object by this point. I suspect it was left over from pasting the instance_delloc() code. Instead asserted that the object is still tracked. Caution: I suspect we don't have a test that actually exercises the subtype_dealloc() __del__-resurrected-me code.
* Uglified the new Py_REF_DEBUG (etc) lexical helper macro definitions soTim Peters2002-07-101-21/+25
| | | | | | | that their uses can be prettier. I've come to despise the names I picked for these things, though, and expect to change all of them -- I changed a bunch of other files to use them (replacing #ifdef blocks), but the names were so obscure out of context that I backed that all out again.
* Fix SF Bug 564931: compile() traceback must include filename.Thomas Heller2002-07-092-0/+8
|
* The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: addedTim Peters2002-07-092-28/+36
| | | | | | | | | | | | | | | | | | | | | more trivial lexical helper macros so that uses of these guys expand to nothing at all when they're not enabled. This should help sub- standard compilers that can't do a good job of optimizing away the previous "(void)0" expressions. Py_DECREF: There's only one definition of this now. Yay! That was that last one in the family defined multiple times in an #ifdef maze. Py_FatalError(): Changed the char* signature to const char*. _Py_NegativeRefcount(): New helper function for the Py_REF_DEBUG expansion of Py_DECREF. Calling an external function cuts down on the volume of generated code. The previous inline expansion of abort() didn't work as intended on Windows (the program often kept going, and the error msg scrolled off the screen unseen). _Py_NegativeRefcount calls Py_FatalError instead, which captures our best knowledge of how to abort effectively across platforms.
* Rearranged and added comments to object.h, to clarify many thingsTim Peters2002-07-071-74/+120
| | | | | | | | | | | that have taken me "too long" to reverse-engineer over the years. Vastly reduced the nesting level and redundancy of #ifdef-ery. Took a light stab at repairing comments that are no longer true. sys_gettotalrefcount(): Changed to enable under Py_REF_DEBUG. It was enabled under Py_TRACE_REFS, which was much heavier than necessary. sys.gettotalrefcount() is now available in a Py_REF_DEBUG-only build.
* Trashcan cleanup: Now that cyclic gc is always there, the trashcanTim Peters2002-07-071-50/+53
| | | | | | | | | | | | | | | | | | | mechanism is no longer evil: it no longer plays dangerous games with the type pointer or refcounts, and objects in extension modules can play along too without needing to edit the core first. Rewrote all the comments to explain this, and (I hope) give clear guidance to extension authors who do want to play along. Documented all the functions. Added more asserts (it may no longer be evil, but it's still dangerous <0.9 wink>). Rearranged the generated code to make it clearer, and to tolerate either the presence or absence of a semicolon after the macros. Rewrote _PyTrash_destroy_chain() to call tp_dealloc directly; it was doing a Py_DECREF again, and that has all sorts of obscure distorting effects in non-release builds (Py_DECREF was already called on the object!). Removed Christian's little "embedded change log" comments -- that's what checkin messages are for, and since it was impossible to correlate the comments with the code that changed, I found them merely distracting.
* Removed WITH_CYCLE_GC #ifdef-ery. Holes:Tim Peters2002-07-073-23/+8
| | | | | | + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do.
* Stop trying to cater to platforms with a broken HUGE_VAL definition. ItTim Peters2002-07-031-12/+7
| | | | | breaks other platforms (in this case, the hack for broken Cray systems in turn caused failure on a Mac system broken in a different way).
* Finished transitioning to using gc_refs to track gc objects' states.Tim Peters2002-07-021-3/+5
| | | | | | | This was mostly a matter of adding comments and light code rearrangement. Upon untracking, gc_next is still set to NULL. It's a cheap way to provoke memory faults if calling code is insane. It's also used in some way by the trashcan mechanism.
* Reserved another gc_refs value for untracked objects. Every live gcTim Peters2002-07-021-2/+10
| | | | | | | | | | | | object should now have a well-defined gc_refs value, with clear transitions among gc_refs states. As a result, none of the visit_XYZ traversal callbacks need to check IS_TRACKED() anymore, and those tests were removed. (They were already looking for objects with specific gc_refs states, and the gc_refs state of an untracked object can no longer match any other gc_refs state by accident.) Added more asserts. I expect that the gc_next == NULL indicator for an untracked object is now redundant and can also be removed, but I ran out of time for this.
* SF 569257 -- Name mangle double underscored variable names in __slots__.Raymond Hettinger2002-06-201-0/+4
|
* The opcode FOR_LOOP no longer exists.Guido van Rossum2002-06-131-1/+0
|
* This is my nearly two year old patchMichael W. Hudson2002-06-111-0/+3
| | | | | | | | | [ 400998 ] experimental support for extended slicing on lists somewhat spruced up and better tested than it was when I wrote it. Includes docs & tests. The whatsnew section needs expanding, and arrays should support extended slices -- later.
* Patch #505375: Make doc strings optional.Martin v. Löwis2002-06-091-0/+10
|
* Patch #555929: Cygwin AH_BOTTOM cleanup patch (*** version 2 ***)Jason Tishler2002-06-042-8/+18
| | | | | | | | | | | | This patch complies with the following request found near the top of configure.in: # This is for stuff that absolutely must end up in pyconfig.h. # Please use pyport.h instead, if possible. I tested this patch under Cygwin, Win32, and Red Hat Linux. Python built and ran successfully on each of these platforms.
* As discussed on python-dev, add a mechanism to indicate featuresNeal Norwitz2002-05-291-0/+1
| | | | | that are in the process of deprecation (PendingDeprecationWarning). Docs could be improved.
* Fix for bug [ 561796 ] string.find causes lazy errorMarc-André Lemburg2002-05-291-1/+2
|
* Silly typo.Michael W. Hudson2002-05-271-1/+1
|
* - A new type object, 'string', is added. This is a common base typeGuido van Rossum2002-05-241-0/+1
| | | | | | | for 'str' and 'unicode', and can be used instead of types.StringTypes, e.g. to test whether something is "a string": isinstance(x, string) is True for Unicode and 8-bit strings. This is an abstract base class and cannot be instantiated directly.
* Disambiguate the grammar for backtick.Guido van Rossum2002-05-241-0/+1
| | | | | | The old syntax suggested that a trailing comma was OK inside backticks, but in fact (due to ideosyncrasies of pgen) it was not. Fix the grammar to avoid the ambiguity. Fred: you may want to update the refman.
* Add missing \ to macro definition only used when universal newlinesGuido van Rossum2002-05-241-1/+1
| | | | are disabled.
* Back out #555929Martin v. Löwis2002-05-152-12/+3
|
* Patch #555929: Cygwin AH_BOTTOM cleanup patchJason Tishler2002-05-152-3/+12
| | | | | | | | | | | | This patch complies with the following request found near the top of configure.in: # This is for stuff that absolutely must end up in pyconfig.h. # Please use pyport.h instead, if possible. I tested this patch under Cygwin, Win32, and Red Hat Linux. Python built and ran successfully on each of these platforms.
* Patch #552433: Special-case tuples. Avoid sub-type checking for lists.Martin v. Löwis2002-05-081-0/+6
| | | | | Avoid checks for negative indices and duplicate checks for support of the sequence protocol.
* _PyGC_generation0 is now a pointerNeil Schemenauer2002-05-041-4/+4
|
* Patch #551008: DL_IMPORT PyBool_FromLong.Martin v. Löwis2002-05-021-1/+1
|