summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Moving pymalloc along.Tim Peters2002-04-282-112/+131
| | | | | | | | | | As threatened, PyMem_{Free, FREE} also invoke the object deallocator now when pymalloc is enabled (well, it does when pymalloc isn't enabled too, but in that case "the object deallocator" is plain free()). This is maximally backward-compatible, but it leaves a bitter aftertaste. Also massive reworking of comments.
* - New builtin function enumerate(x), from PEP 279. Example:Guido van Rossum2002-04-262-0/+17
| | | | | enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object.
* Apply patch diff.txt from SF feature requestWalter Dörwald2002-04-221-0/+7
| | | | | | | | | http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument.
* Moving pymalloc along.Tim Peters2002-04-222-30/+10
| | | | | | | | | | | | | | | | | | + Redirect PyMem_{Del, DEL} to the object allocator's free() when pymalloc is enabled. Needed so old extensions can continue to mix PyObject_New with PyMem_DEL. + This implies that pgen needs to be able to see the PyObject_XYZ declarations too. pgenheaders.h now includes Python.h. An implication is that I expect obmalloc.o needs to get linked into pgen on non-Windows boxes. + When PYMALLOC_DEBUG is defined, *all* Py memory API functions now funnel through the debug allocator wrapper around pymalloc. This is the default in a debug build. + That caused compile.c to fail: it indirectly mixed PyMem_Malloc with raw platform free() in one place. This is verbotten.
* Py_UniversalNewlineFread(): Many changes.Tim Peters2002-04-211-5/+5
| | | | | | | | | | | | | | | | | | | | + Continued looping until n bytes in the buffer have been filled, not just when n bytes have been read from the file. This repairs the bug that f.readlines() only sucked up the first 8192 bytes of the file on Windows when universal newlines was enabled and f was opened in U mode (see Python-Dev -- this was the ultimate cause of the test_inspect.py failure). + Changed prototye to take a char* buffer (void* doesn't make much sense). + Squashed size_t vs int mismatches (in particular, besides the unsigned vs signed distinction, size_t may be larger than int). + Gets out under all error conditions now (it's possible for fread() to suffer an error even if it returns a number larger than 0 -- any "short read" is an error or EOF condition). + Rearranged and simplified declarations.
* Mass checkin of universal newline support.Jack Jansen2002-04-141-1/+19
| | | | | | | | Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details.
* _PyObject_DebugDumpStats: renamed to _PyObject_DebugMallocStats.Tim Peters2002-04-131-1/+1
| | | | | | Added code to call this when PYMALLOC_DEBUG is enabled, and envar PYTHONMALLOCSTATS is set, whenever a new arena is obtained and once late in the Python shutdown process.
* First stab at rationalizing the PyMem_ API. Mixing PyObject_xyz withTim Peters2002-04-122-62/+55
| | | | | | | | | | | | | | | | | | | | | | | | PyMem_{Del, DEL} doesn't work yet (compilation problems). pyport.h: _PyMem_EXTRA is gone. pmem.h: Repaired comments. PyMem_{Malloc, MALLOC} and PyMem_{Realloc, REALLOC} now make the same x-platform guarantees when asking for 0 bytes, and when passing a NULL pointer to the latter. object.c: PyMem_{Malloc, Realloc} just call their macro versions now, since the latter take care of the x-platform 0 and NULL stuff by themselves now. pypcre.c, grow_stack(): So sue me. On two lines, this called PyMem_RESIZE to grow a "const" area. It's not legit to realloc a const area, so the compiler warned given the new expansion of PyMem_RESIZE. It would have gotten the same warning before if it had used PyMem_Resize() instead; the older macro version, but not the function version, silently cast away the constness. IMO that was a wrong thing to do, and the docs say the macro versions of PyMem_xyz are deprecated anyway. If somebody else is resizing const areas with the macro spelling, they'll get a warning when they recompile now too.
* First cut at repairing out-of-date comments; make alignment of macro defsTim Peters2002-04-121-15/+24
| | | | all the same within the #ifdef WITH_PYMALLOC block.
* Remove PyMalloc_* symbols. PyObject_Malloc now uses pymalloc ifNeil Schemenauer2002-04-121-30/+0
| | | | it's enabled.
* Remove PyMalloc_* symbols. PyObject_Malloc now uses pymalloc ifNeil Schemenauer2002-04-121-38/+44
| | | | | | | | | | it's enabled. Allow PyObject_Del, PyObject_Free, and PyObject_GC_Del to be used as function designators. Provide source compatibility macros. Make PyObject_GC_Track and PyObject_GC_UnTrack functions instead of trivial macros wrapping functions.
* Change the type of the tp_free from 'destructor' to 'freefunc'.Neil Schemenauer2002-04-121-1/+2
|
* Removed more hair in support of future-generator stmts.Tim Peters2002-04-122-3/+3
|
* Got rid of ifdefs for long-obsolete GUSI versions.Jack Jansen2002-04-111-7/+0
|
* Get rid of USE_CACHE_ALIGNED. It has no function anymore.Jack Jansen2002-04-111-3/+0
|
* Add standard header preamble and footer, a-la intobject.h. Main purpose is ↵Mark Hammond2002-04-061-0/+12
| | | | extern "C" for C++ programs.