summaryrefslogtreecommitdiffstats
path: root/Include/pyport.h
Commit message (Collapse)AuthorAgeFilesLines
* First stab at rationalizing the PyMem_ API. Mixing PyObject_xyz withTim Peters2002-04-121-22/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Got rid of ifdefs for long-obsolete GUSI versions.Jack Jansen2002-04-111-7/+0
|
* SF bug 525705: [2.2] underflow raise OverflowException.Tim Peters2002-03-091-0/+35
| | | | | | | | | | | | | | | | | | | | Another year in the quest to out-guess random C behavior. Added macros Py_ADJUST_ERANGE1(X) and Py_ADJUST_ERANGE2(X, Y). The latter is useful for functions with complex results. Two corrections to errno- after-libm-call are attempted: 1. If the platform set errno to ERANGE due to underflow, clear errno. Some unknown subset of libm versions and link options do this. It's allowed by C89, but I never figured anyone would do it. 2. If the platform did not set errno but overflow occurred, force errno to ERANGE. C89 required setting errno to ERANGE, but C99 doesn't. Some unknown subset of libm versions and link options do it the C99 way now. Bugfix candidate, but hold off until some Linux people actually try it, with and without -lieee. I'll send a help plea to Python-Dev.
* Whether platform malloc(0) returns NULL has nothing to do with whetherTim Peters2002-03-021-2/+10
| | | | | | | | | | | platform realloc(p, 0) returns NULL, so MALLOC_ZERO_RETURNS_NULL can be correctly undefined yet realloc(p, 0) can return NULL anyway. Prevent realloc(p, 0) doing free(p) and returning NULL via a different hack. Would probably be better to get rid of MALLOC_ZERO_RETURNS_NULL entirely. Bugfix candidate.
* OS/2 EMX port changes (Include part of patch #450267):Andrew MacIntyre2002-02-261-0/+3
| | | | | | Include/ osdefs.h // EMX promotes Un*x path separators pyport.h
* Got rid of a few more NeXT ifdefs. The last, I think.Jack Jansen2002-02-011-2/+1
|
* SF bug #495548: troublesome #define in pyport.hTim Peters2001-12-251-1/+0
| | | | | | | | | Removed the ancient "#define ANY void". Bugfix candidate? Hard call. The bug report claims the existence of this #define creates conflicts with other packages, which is easy to believe. OTOH, some extension authors may still be relying on its presence. I'm afraid you can't win on this one.
* SF patch #475657 (Dietmar Schwertberger)Guido van Rossum2001-10-271-3/+4
| | | | | | | | | | | | RISCOS/Makefile: include structseq and weakrefobject; changes to keep command line length below 2048 RISCOS/Modules/riscosmodule.c: typos from the stat structseq patch Include/pyport.h: don't re-#define __attribute__(__x) on RISC OS as it is already defined in c library
* SF patch #474590 -- RISC OS supportGuido van Rossum2001-10-241-0/+4
|
* Hide GCC attributes fom compilers that don't support them.Neil Schemenauer2001-10-231-0/+9
|
* SF patch [#466353] Py_HUGE_VAL on BeOS for Intel.Tim Peters2001-10-011-1/+5
| | | | | | The patch repaired internal gcc compiler errors on BeOS. This checkin repairs them in a simpler way, by explicitly casting the platform INFINITY to double.
* Rework the way we try to check for libm overflow, given that C99 no longerTim Peters2001-09-051-3/+30
| | | | | | | | | | | | | | | requires that errno ever get set, and it looks like glibc is already playing that game. New rules: + Never use HUGE_VAL. Use the new Py_HUGE_VAL instead. + Never believe errno. If overflow is the only thing you're interested in, use the new Py_OVERFLOWED(x) macro. If you're interested in any libm errors, use the new Py_SET_ERANGE_IF_OVERFLOW(x) macro, which attempts to set errno the way C89 said it worked. Unfortunately, none of these are reliable, but they work on Windows and I *expect* under glibc too.
* Repair indentation.Tim Peters2001-09-051-5/+5
|
* Try to recover from that glibc's ldexp apparently doesn't set errno onTim Peters2001-09-051-0/+20
| | | | | overflow. Needs testing on Linux (test_long.py and test_long_future.py especially).
* SF bug [#456252] Python should never stomp on [u]intptr_t.Tim Peters2001-08-291-5/+14
| | | | | | | | | | | pyport.h: typedef a new Py_intptr_t type. DELICATE ASSUMPTION: That HAVE_UINTPTR_T implies intptr_t is available as well as uintptr_t. If that turns out not to be true, things must get uglier (C99 wants both, so I think it's an assumption we're *likely* to get away with). thread_nt.h, PyThread_start_new_thread: MS _beginthread is documented as returning unsigned long; no idea why uintptr_t was being used. Others: Always use Py_[u]intptr_t, never [u]intptr_t directly.
* Remove 6-year old hack to worm around a bug in "NextSpec/Sparc 3.3Tim Peters2001-08-081-12/+0
| | | | pre-release limits.h".
* Put conditional S_ISDIR definition(s) into pyport.h.Martin v. Löwis2001-08-081-0/+13
|
* Got rid of (hopefully) the last 68k-mac related ifdefs.Jack Jansen2001-08-071-62/+0
|
* Repair more now-obsolete references to config.h.Tim Peters2001-07-261-1/+1
|
* Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774.Martin v. Löwis2001-07-261-1/+1
|
* SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen.Tim Peters2001-05-141-0/+9
|
* Remove include-file-dependant half-prototype of clnt_create().Thomas Wouters2001-01-221-3/+0
|
* Move declaration of 'clnt_create()' NIS function to pyport.h, as it'sThomas Wouters2001-01-211-0/+3
| | | | | | supposed to be declared in system include files (with a proper prototype.) Should be moved to a platform-specific block if anyone finds out which broken platforms need it :-)
* Move distributed and duplicated config for stat() and fstat() into pyport.h.Tim Peters2001-01-181-2/+34
|
* Change LONG_BIT error warning to mention glibc, too, since this is reallyAndrew M. Kuchling2001-01-121-1/+1
| | | | a glibc, not a gcc, problem.
* Added Py_FPROTO macro which was available in Python 1.5.x and below.Marc-André Lemburg2000-10-051-0/+3
| | | | | | | This should not be used for new code, but will probably make porting old extensions to 2.0 a lot easier. Also see Bug #116011.
* Move LONG_BIT from intobject.c to pyport.h. #error if it's already beenTim Peters2000-10-051-0/+13
| | | | | | #define'd to an unreasonable value (several recent gcc systems have misdefined it, causing bogus overflows in integer multiplication). Nuke CHAR_BIT entirely.
* Rationalize use of limits.h, moving the inclusion to Python.h.Fred Drake2000-09-261-0/+32
| | | | | | | | Add definitions of INT_MAX and LONG_MAX to pyport.h. Remove includes of limits.h and conditional definitions of INT_MAX and LONG_MAX elsewhere. This closes SourceForge patch #101659 and bug #115323.
* Close SF bug 110826: a complaint about the way Python #define'd NULL.Tim Peters2000-09-101-4/+0
| | | | | | | | | | | | | | | It's hard to sort out what the bug was, exactly. So, Big Hammer: 1. Python shouldn't be in the business of #define'ing NULL, period. 2. Users of the Python C API shouldn't be in the business of not including Python.h, period. Hence: 1. Removed all #define's of NULL in Python source code (pyport.h and object.h). 2. Since we're *relying* on stdio.h defining NULL, put an #error in Python.h after its #include of stdio.h if NULL isn't defined then.
* A #define didn't start in column 1. Closes SF bug 113888.Tim Peters2000-09-081-1/+1
|
* Add missing Py_PROTO macro for backward compatibility with old extensionsVladimir Marangozov2000-09-081-1/+7
| | | | | (sources) which may still use it and now fail to compile. Reported by M-A Lemburg. Closes [ Bug #113576 ].
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-8/+0
| | | | This should match the situation in the 1.6b1 tree.
* Moved LONG_LONG #define from longobject.h to here, since it's neededBarry Warsaw2000-08-181-0/+43
| | | | | | | | | | by the following. typedef in a portable way the Python name for the C9X uintptr_t type. This latter is the most portable way to spell an integral type to which a void* can be cast to and back again without losing information. Parallel checkin hacks configure to check if the platform/compiler supports the C9X name.
* Fix for http://sourceforge.net/bugs/?func=detailbug&bug_id=111866&group_id=5470.Tim Peters2000-08-151-1/+9
| | | | | | | | | | | This was a misleading bug -- the true "bug" was that hash(x) gave an error return when x is an infinity. Fixed that. Added new Py_IS_INFINITY macro to pyport.h. Rearranged code to reduce growing duplication in hashing of float and complex numbers, pushing Trent's earlier stab at that to a logical conclusion. Fixed exceedingly rare bug where hashing of floats could return -1 even if there wasn't an error (didn't waste time trying to construct a test case, it was simply obvious from the code that it *could* happen). Improved complex hash so that hash(complex(x, y)) doesn't systematically equal hash(complex(y, x)) anymore.
* #include reordering so that extern "C" does not interfere withVladimir Marangozov2000-08-111-38/+40
| | | | | | standard C++ specific includes. Closes patch 101061.
* remove all occurence of math.rint() from the sourcesPeter Schneider-Kamp2000-08-101-2/+0
| | | | (and yes, "Currintly" also counts <0.5 wink>)
* Of course, you meant "#if 0" and not "#ifdef 0". :)Guido van Rossum2000-08-011-1/+1
|
* Guido said this is food for the beta-testers<wink>Peter Schneider-Kamp2000-08-011-0/+5
|
* patch from Vladimir (move Py_Mem* interface to Include/pymem.h)Peter Schneider-Kamp2000-07-311-154/+5
|
* merge Include/my*.h into Include/pyport.hPeter Schneider-Kamp2000-07-311-0/+317
| | | | marked my*.h as obsolete
* Make mode_t available for the declaration of _getpty().Sjoerd Mullender2000-07-261-1/+1
|
* Create a new section of pyport.h to hold all external function declarationsThomas Wouters2000-07-241-0/+62
| | | | | | | | | | | | | | for systems that are missing those declarations from system include files. Start by moving a pointy-haired ones from their previous locations to the new section. (The gethostname() one, for instance, breaks on several systems, because some define it as (char *, size_t) and some as (char *, int).) I purposely decided not to include the summary of used #defines like Tim did in the first section of pyport.h. In my opinion, the number of #defines likedly to be used by this section would make such an overview unwieldy. I would suggest documenting the non-obvious ones, though.
* Removed all instances of RETSIGTYPE from the source code: signalTim Peters2000-07-231-17/+0
| | | | | | | handlers "return void", according to ANSI C. Removed the new Py_RETURN_FROM_SIGNAL_HANDLER macro. Left RETSIGTYPE in the config stuff, because it's not clear to me that others aren't relying on it (e.g., extension modules).
* Included assert.h in Python.h -- it's absurd that this basic tool ofTim Peters2000-07-231-0/+17
| | | | | | | | good C practice hasn't been available to everything all along. Added Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) macro to pyport.h; this just casts VALUE from type WIDE to type NARROW, but assert-fails if Py_DEBUG is defined and info is lost due to casting. Replaced a line in Fredrik's fix to marshal.c to use the new macro.
* Recent ANSIfication introduced a couple instances ofTim Peters2000-07-231-1/+25
| | | | | | | | | | | #if RETSIGTYPE != void That isn't C, and MSVC properly refuses to compile it. Introduced new Py_RETURN_FROM_SIGNAL_HANDLER macro in pyport.h to expand to the correct thing based on RETSIGTYPE. However, only void is ANSI! Do we still have platforms that return int? The Unix config mess appears to #define RETSIGTYPE by magic without being asked to, so I assume it's "a problem" across Unices still.
* Remove the "1" that Tim sticked to the preprocessor symbol for unknown reasonsVladimir Marangozov2000-07-101-1/+1
| | | | (cf. the rest of the headers in the distribution)
* Cray J90 fixes for long ints.Tim Peters2000-07-081-0/+57
This was a convenient excuse to create the pyport.h file recently discussed! Please use new Py_ARITHMETIC_RIGHT_SHIFT when right-shifting a signed int and you *need* sign-extension. This is #define'd in pyport.h, keying off new config symbol SIGNED_RIGHT_SHIFT_ZERO_FILLS. If you're running on a platform that needs that symbol #define'd, the std tests never would have worked for you (in particular, at least test_long would have failed). The autoconfig stuff got added to Python after my Unix days, so I don't know how that works. Would someone please look into doing & testing an auto-config of the SIGNED_RIGHT_SHIFT_ZERO_FILLS symbol? It needs to be defined if & only if, e.g., (-1) >> 3 is not -1.