mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 04:22:16 +00:00
Make it work when Python is compiled with Unicode disabled.
[SVN r31322]
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#define BOOST_NO_STD_WSTRING
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
|
||||
@@ -85,14 +85,14 @@ BOOST_PYTHON_MODULE(builtin_converters)
|
||||
def("rewrap_value_complex_double", by_value<std::complex<double> >::rewrap);
|
||||
def("rewrap_value_complex_long_double", by_value<std::complex<long double> >::rewrap);
|
||||
def("rewrap_value_wstring",
|
||||
# ifdef BOOST_NO_STD_WSTRING
|
||||
# if defined(BOOST_NO_STD_WSTRING) || !defined(Py_USING_UNICODE)
|
||||
identity_
|
||||
# else
|
||||
by_value<std::wstring>::rewrap
|
||||
# endif
|
||||
);
|
||||
def("rewrap_value_string",
|
||||
# ifdef BOOST_NO_STD_WSTRING
|
||||
# if defined(BOOST_NO_STD_WSTRING) || !defined(Py_USING_UNICODE)
|
||||
identity_
|
||||
# else
|
||||
by_value<std::wstring>::rewrap
|
||||
|
||||
@@ -78,12 +78,23 @@ r"""
|
||||
'hello, world'
|
||||
>>> rewrap_value_string('yo, wassup?')
|
||||
'yo, wassup?'
|
||||
>>> rewrap_value_wstring(u'yo, wassup?')
|
||||
u'yo, wassup?'
|
||||
|
||||
test that overloading on unicode works:
|
||||
>>> try:
|
||||
... unicode
|
||||
... catch:
|
||||
... print "u'yo, wassup?'"
|
||||
... else:
|
||||
... eval("rewrap_value_wstring(u'yo, wassup?')")
|
||||
u'yo, wassup?'
|
||||
|
||||
>>> rewrap_value_string(u'yo, wassup?')
|
||||
test that overloading on unicode works:
|
||||
|
||||
>>> try:
|
||||
... unicode
|
||||
... catch:
|
||||
... print "u'yo, wassup?'"
|
||||
... else:
|
||||
... eval("rewrap_value_string(u'yo, wassup?')")
|
||||
u'yo, wassup?'
|
||||
|
||||
wrap strings with embedded nulls:
|
||||
|
||||
Reference in New Issue
Block a user