Re: [Python-Dev] PyRange_New() alternative?

2006-06-24 Thread Martin v. Löwis
Scott David Daniels wrote: I am not sure about your compiler, but if I remember the standard correctly, the following code shouldn't complain: PyObject_CallFunction((PyObject*) (void *) PyRange_Type, lll, start, start+len*step, step) You remember the standard

Re: [Python-Dev] PyRange_New() alternative?

2006-06-24 Thread Martin v. Löwis
Ralf W. Grosse-Kunstleve wrote: I am not an expert of the C/C++ language details, but the intermediate cast seems to be a great local alternative to the global -fno-strict-aliasing flag. Depends on what you want to achieve. If you just want to make the warning go away, the cast works fine. If

Re: [Python-Dev] PyRange_New() alternative?

2006-06-24 Thread Ralf W. Grosse-Kunstleve
--- Martin v. Löwis [EMAIL PROTECTED] wrote: Scott David Daniels wrote: I am not sure about your compiler, but if I remember the standard correctly, the following code shouldn't complain: PyObject_CallFunction((PyObject*) (void *) PyRange_Type, lll,

Re: [Python-Dev] PyRange_New() alternative?

2006-06-24 Thread Martin v. Löwis
Ralf W. Grosse-Kunstleve wrote: You remember the standard incorrectly. There are three standards to consider: C89/90, C99, C++97/98. Here you can find the opinion of one of the authors of the C++ standard in this matter: http://mail.python.org/pipermail/c++-sig/2005-December/009869.html

Re: [Python-Dev] PyRange_New() alternative?

2006-06-24 Thread Scott David Daniels
Martin v. Löwis wrote: Scott David Daniels wrote: ... if I remember the standard correctly, the following code shouldn't complain: PyObject_CallFunction((PyObject*) (void *) PyRange_Type, lll, start, start+len*step, step) You remember the standard

Re: [Python-Dev] PyRange_New() alternative?

2006-06-23 Thread Ralf W. Grosse-Kunstleve
--- Tim Peters [EMAIL PROTECTED] wrote: [Ralf W. Grosse-Kunstleve] Thanks! This does the trick for me: #if PY_VERSION_HEX = 0x0203 PyObject_CallFunction( (PyObject*) PyRange_Type, lll, start, start+len*step, step) Note that this is extremely lax about possible

Re: [Python-Dev] PyRange_New() alternative?

2006-06-23 Thread Scott David Daniels
Ralf W. Grosse-Kunstleve wrote: Thanks! This does the trick for me: #if PY_VERSION_HEX = 0x0203 PyObject_CallFunction( (PyObject*) PyRange_Type, lll, start, start+len*step, step) #else PyRange_New(start, len, step, 1) #endif I am compiling the code above

Re: [Python-Dev] PyRange_New() alternative?

2006-06-23 Thread Ralf W. Grosse-Kunstleve
--- Scott David Daniels [EMAIL PROTECTED] wrote: Ralf W. Grosse-Kunstleve wrote: Thanks! This does the trick for me: #if PY_VERSION_HEX = 0x0203 PyObject_CallFunction( (PyObject*) PyRange_Type, lll, start, start+len*step, step) #else

Re: [Python-Dev] PyRange_New() alternative?

2006-06-22 Thread Georg Brandl
Ralf W. Grosse-Kunstleve wrote: http://docs.python.org/dev/whatsnew/ports.html says: The PyRange_New() function was removed. It was never documented, never used in the core code, and had dangerously lax error checking. I use this function (don't remember how I found it; this was years

Re: [Python-Dev] PyRange_New() alternative?

2006-06-22 Thread Ralf W. Grosse-Kunstleve
--- Georg Brandl [EMAIL PROTECTED] wrote: Ralf W. Grosse-Kunstleve wrote: http://docs.python.org/dev/whatsnew/ports.html says: The PyRange_New() function was removed. It was never documented, never used in the core code, and had dangerously lax error checking. I use this

Re: [Python-Dev] PyRange_New() alternative?

2006-06-22 Thread Georg Brandl
Ralf W. Grosse-Kunstleve wrote: --- Georg Brandl [EMAIL PROTECTED] wrote: Ralf W. Grosse-Kunstleve wrote: http://docs.python.org/dev/whatsnew/ports.html says: The PyRange_New() function was removed. It was never documented, never used in the core code, and had dangerously lax error

Re: [Python-Dev] PyRange_New() alternative?

2006-06-22 Thread Bob Ippolito
On Jun 22, 2006, at 11:55 AM, Ralf W. Grosse-Kunstleve wrote: --- Georg Brandl [EMAIL PROTECTED] wrote: Ralf W. Grosse-Kunstleve wrote: http://docs.python.org/dev/whatsnew/ports.html says: The PyRange_New() function was removed. It was never documented, never used in the core code,

Re: [Python-Dev] PyRange_New() alternative?

2006-06-22 Thread Ralf W. Grosse-Kunstleve
--- Georg Brandl [EMAIL PROTECTED] wrote: Well, PyRange_New *was* undocumented, Yes, that was clear. However, it would perhaps be helpful to add a note to the whatsnew document for users like yourself. Andrew, does that make sense? I am worried about using an alternative that is *again* not

Re: [Python-Dev] PyRange_New() alternative?

2006-06-22 Thread Ralf W. Grosse-Kunstleve
--- Bob Ippolito [EMAIL PROTECTED] wrote: I am sure I can get this to work with some digging, but I am posting here to highlight a communication problem. I feel if a function is removed the alternative should be made obvious in the associated documentation; in particular if there is