[Python-checkins] r50969 - in python/trunk: Include/pyerrors.h Misc/NEWS Modules/_struct.c Python/errors.c

M.-A. Lemburg mal at egenix.com
Fri Aug 4 10:58:26 CEST 2006


Thomas Heller wrote:
> neal.norwitz schrieb:
>> Author: neal.norwitz
>> Date: Sun Jul 30 08:55:48 2006
>> New Revision: 50969
>>
>> Modified:
>>    python/trunk/Include/pyerrors.h
>>    python/trunk/Misc/NEWS
>>    python/trunk/Modules/_struct.c
>>    python/trunk/Python/errors.c
>> Log:
>> Add PyErr_WarnEx() so C code can pass the stacklevel to warnings.warn().
>> This provides the proper warning for struct.pack().
>> PyErr_Warn() is now deprecated in favor of PyErr_WarnEx().
>> As mentioned by Tim Peters on python-dev.
>>
>>
>> Modified: python/trunk/Include/pyerrors.h
>> ==============================================================================
>> --- python/trunk/Include/pyerrors.h	(original)
>> +++ python/trunk/Include/pyerrors.h	Sun Jul 30 08:55:48 2006
>> @@ -225,10 +225,14 @@
>>  PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
>>  
>>  /* Issue a warning or exception */
>> -PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *);
>> +PyAPI_FUNC(int) PyErr_WarnEx(PyObject *category, const char *msg,
>> +			     Py_ssize_t stack_level);
>>  PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *,
>>  				   const char *, int, 
>>  				   const char *, PyObject *);
>> +/* PyErr_Warn is only for backwards compatability and will be removed.
>> +   Use PyErr_WarnEx instead. */
>> +#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1)
>>  
> 
> This change removed (on Windows) the PyErr_Warn *exported* function from
> the python25.dll.  As a result, extensions compiled with earlier beta versions
> of python 2.5 cannot be loaded any more; for example the win32com extensions
> from Mark Hammond - but of course any other extensions that use this function.
> 
> Btw: Shouldn't the PYTHON_API_VERSION (or how it's called) have also been changed?
> 
> I'm unsure what to do:
> - Implement PyErr_Warn as a function again (this was also done with other functions,
>   see also #1465834).  Would this require another beta ;-)?
> - Leave it as it is, and require that extensions needs to be rebuilt with 2.5b3
>   (plus change the PYTHON_API_VERSION, ...)
> 
> Anyway, it seems to me that *some* policy regarding changes to exported functions
> should be established.

In the past we've always kept a stub function around that
was exported when converting a function to a macro.

I guess this ought to happen in this case as well.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Aug 04 2006)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Python-checkins mailing list