Skip to content

Commit

Permalink
Made SbkChar_Check macro safer with parenthesis.
Browse files Browse the repository at this point in the history
Reviewed by Lauro Moura <[email protected]>
Reviewed by Luciano Wolf <[email protected]>
  • Loading branch information
Marcelo Lira committed Oct 11, 2011
1 parent 74cdaf8 commit 60807a3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions libshiboken/conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
// When the user adds a function with an argument unknown for the typesystem, the generator writes type checks as
// TYPENAME_Check, so this macro allows users to add PyObject arguments to their added functions.
#define PyObject_Check(X) true
#define SbkChar_Check(X) (SbkNumber_Check(X) || Shiboken::String::checkChar(X))
#include "autodecref.h"

namespace Shiboken
Expand Down Expand Up @@ -345,11 +346,6 @@ struct Converter_PyULongInt : Converter_PyInt<T>
static inline PyObject* toPython(const T& cppobj) { return PyLong_FromUnsignedLong(cppobj); }
};

#define SbkChar_Check(X) \
SbkNumber_Check(X) || \
Shiboken::String::checkChar(X)


/// Specialization to convert char and unsigned char, it accepts Python numbers and strings with just one character.
template <typename CharType>
struct CharConverter
Expand Down

0 comments on commit 60807a3

Please sign in to comment.