|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53693 - in sandbox-branches/bhy/py3k: boost/python libs/python/src/converter
From: divinekid_at_[hidden]
Date: 2009-06-06 10:51:36
Author: bhy
Date: 2009-06-06 10:51:35 EDT (Sat, 06 Jun 2009)
New Revision: 53693
URL: http://svn.boost.org/trac/boost/changeset/53693
Log:
clean other attempts for making unicode -> const char* conversion work, since now we have the right way in previous commit.
Text files modified:
sandbox-branches/bhy/py3k/boost/python/arg_from_python.hpp | 29 -----------------------------
sandbox-branches/bhy/py3k/libs/python/src/converter/builtin_converters.cpp | 22 ----------------------
2 files changed, 0 insertions(+), 51 deletions(-)
Modified: sandbox-branches/bhy/py3k/boost/python/arg_from_python.hpp
==============================================================================
--- sandbox-branches/bhy/py3k/boost/python/arg_from_python.hpp (original)
+++ sandbox-branches/bhy/py3k/boost/python/arg_from_python.hpp 2009-06-06 10:51:35 EDT (Sat, 06 Jun 2009)
@@ -62,35 +62,6 @@
PyObject* m_source;
};
-#if PY_VERSION_HEX >= 0x03000000
-// specialization for const char *, experimenting
-template <>
-struct arg_from_python<const char*>
-{
- typedef const char* result_type;
-
- arg_from_python(PyObject* p) : m_source(p), intermediate(0) {}
- bool convertible() const
- {
- return PyUnicode_Check(m_source);
- }
- const char* operator()()
- {
- const char* result;
- intermediate = PyUnicode_AsUTF8String(m_source);
- result = PyBytes_AsString(intermediate);
- return result;
- }
- ~arg_from_python()
- {
- Py_DECREF(intermediate);
- }
- private:
- PyObject* m_source;
- PyObject* intermediate;
-};
-#endif
-
//
// implementations
//
Modified: sandbox-branches/bhy/py3k/libs/python/src/converter/builtin_converters.cpp
==============================================================================
--- sandbox-branches/bhy/py3k/libs/python/src/converter/builtin_converters.cpp (original)
+++ sandbox-branches/bhy/py3k/libs/python/src/converter/builtin_converters.cpp 2009-06-06 10:51:35 EDT (Sat, 06 Jun 2009)
@@ -370,24 +370,6 @@
#endif
};
-#if PY_VERSION_HEX >= 0x03000000
- // A SlotPolicy for extracting C char* string from Python 3 unicode string.
- struct char_rvalue_from_python
- {
- static unaryfunc* get_slot(PyObject *obj)
- {
- printf("*********CALLED*************\n");
- return PyUnicode_Check(obj) ? &py_unicode_as_string_unaryfunc : 0;
- }
-
- static const char* extract(PyObject* intermediate)
- {
- return PyBytes_AsString(intermediate);
- }
- static PyTypeObject const* get_pytype() { return &PyUnicode_Type;}
- };
-#endif
-
#if defined(Py_USING_UNICODE) && !defined(BOOST_NO_STD_WSTRING)
// encode_string_unaryfunc/py_encode_string -- manufacture a unaryfunc
// "slot" which encodes a Python string using the default encoding
@@ -541,10 +523,6 @@
registry::insert(convert_to_cstring,type_id<char>(),&converter::wrap_pytype<&PyString_Type>::get_pytype);
#else
registry::insert(convert_to_cstring,type_id<char>(),&converter::wrap_pytype<&PyUnicode_Type>::get_pytype);
- //TODO(bhy) This doesn't work because for const char* a lvalue converter is
- // always expected. (See select_extract in extract.hpp for detail)
- // So we should figure out a workaround.
- //slot_rvalue_from_python<const char*, char_rvalue_from_python>();
#endif
// Register by-value converters to std::string, std::wstring
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk