@@ -17,15 +17,14 @@ namespace python
1717object BOOST_PYTHON_DECL eval (str string, object global, object local)
1818{
1919 // Set suitable default values for global and local dicts.
20- object none;
21- if (global.ptr () == none.ptr ())
20+ if (global.is_none ())
2221 {
2322 if (PyObject *g = PyEval_GetGlobals ())
2423 global = object (detail::borrowed_reference (g));
2524 else
2625 global = dict ();
2726 }
28- if (local.ptr () == none. ptr ()) local = global;
27+ if (local.is_none ()) local = global;
2928 // should be 'char const *' but older python versions don't use 'const' yet.
3029 char *s = python::extract<char *>(string);
3130 PyObject* result = PyRun_String (s, Py_eval_input, global.ptr (), local.ptr ());
@@ -36,15 +35,14 @@ object BOOST_PYTHON_DECL eval(str string, object global, object local)
3635object BOOST_PYTHON_DECL exec (str string, object global, object local)
3736{
3837 // Set suitable default values for global and local dicts.
39- object none;
40- if (global.ptr () == none.ptr ())
38+ if (global.is_none ())
4139 {
4240 if (PyObject *g = PyEval_GetGlobals ())
4341 global = object (detail::borrowed_reference (g));
4442 else
4543 global = dict ();
4644 }
47- if (local.ptr () == none. ptr ()) local = global;
45+ if (local.is_none ()) local = global;
4846 // should be 'char const *' but older python versions don't use 'const' yet.
4947 char *s = python::extract<char *>(string);
5048 PyObject* result = PyRun_String (s, Py_file_input, global.ptr (), local.ptr ());
@@ -55,15 +53,14 @@ object BOOST_PYTHON_DECL exec(str string, object global, object local)
5553object BOOST_PYTHON_DECL exec_statement (str string, object global, object local)
5654{
5755 // Set suitable default values for global and local dicts.
58- object none;
59- if (global.ptr () == none.ptr ())
56+ if (global.is_none ())
6057 {
6158 if (PyObject *g = PyEval_GetGlobals ())
6259 global = object (detail::borrowed_reference (g));
6360 else
6461 global = dict ();
6562 }
66- if (local.ptr () == none. ptr ()) local = global;
63+ if (local.is_none ()) local = global;
6764 // should be 'char const *' but older python versions don't use 'const' yet.
6865 char *s = python::extract<char *>(string);
6966 PyObject* result = PyRun_String (s, Py_single_input, global.ptr (), local.ptr ());
@@ -77,15 +74,14 @@ object BOOST_PYTHON_DECL exec_statement(str string, object global, object local)
7774object BOOST_PYTHON_DECL exec_file (str filename, object global, object local)
7875{
7976 // Set suitable default values for global and local dicts.
80- object none;
81- if (global.ptr () == none.ptr ())
77+ if (global.is_none ())
8278 {
8379 if (PyObject *g = PyEval_GetGlobals ())
8480 global = object (detail::borrowed_reference (g));
8581 else
8682 global = dict ();
8783 }
88- if (local.ptr () == none. ptr ()) local = global;
84+ if (local.is_none ()) local = global;
8985 // should be 'char const *' but older python versions don't use 'const' yet.
9086 char *f = python::extract<char *>(filename);
9187#if PY_VERSION_HEX >= 0x03000000
0 commit comments