[ python-Bugs-994255 ] Py_RETURN_NONE causes too much warnings

SourceForge.net noreply at sourceforge.net
Tue Jul 20 17:27:33 CEST 2004


Bugs item #994255, was opened at 2004-07-20 00:36
Message generated for change (Comment added) made by thiagocorrea
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=994255&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Correa (thiagocorrea)
Assigned to: Nobody/Anonymous (nobody)
Summary: Py_RETURN_NONE causes too much warnings

Initial Comment:
It will make the compiler complain on each instance
about the conditional being constant ( while (0) )

why not use something like this instead?

The compiler will be able to optimize out the function
call.

#if !defined(Py_RETURN_NONE) // New in Python 2.4
inline PyObject* doPy_RETURN_NONE()
{	Py_INCREF(Py_None); return Py_None; }
#define Py_RETURN_NONE return doPy_RETURN_NONE()
#endif

#if !defined(Py_RETURN_TRUE) // New in Python 2.4
inline PyObject* doPy_RETURN_TRUE()
{Py_INCREF(Py_True); return Py_True;}
#	define Py_RETURN_TRUE return doPy_RETURN_TRUE()
#endif

#if !defined(Py_RETURN_FALSE) // New in Python 2.4
inline PyObject* doPy_RETURN_FALSE()
{Py_INCREF(Py_False); return Py_False;}
#define Py_RETURN_FALSE return doPy_RETURN_FALSE()
#endif


----------------------------------------------------------------------

>Comment By: Correa (thiagocorrea)
Date: 2004-07-20 12:27

Message:
Logged In: YES 
user_id=111587

Visual C++ 7.0, Win32



----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-07-20 08:27

Message:
Logged In: YES 
user_id=80475

Which compiler and operating system are you using?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=994255&group_id=5470


More information about the Python-bugs-list mailing list