[C++-sig] [GSoC] Boost.Python py3k support project final report

2009-08-31 Thread Haoyu Bai
merge, more tests can be done to check is there any regression, also some people may want to start to use it to make your projects run on Python 3. Then I can get some bug report and feedback, thus more improvement is expected. Thanks! -- Haoyu BAI School of Computing, National University of Si

Re: [C++-sig] Details of Boost.Python Py_Finalize issue?

2009-08-06 Thread Haoyu Bai
On Wed, Aug 5, 2009 at 10:33 AM, Ravi wrote: > On Sunday 02 August 2009 11:44:22 Haoyu Bai wrote: >> So could anyone share your experience with this issue, provide some >> test case or anymore information about this issue? I will try to solve >> it. > > I haven'

Re: [C++-sig] boost::python::str and Python's str and unicode types

2009-08-04 Thread Haoyu Bai
. This can be implemented by inherit PyString with an additional field. But, eh, this sounds a bit crazy. :p Anyway, for pointers like const wchar_t *, boost::python requires a "lvalue converter", but when we create new object in the converter, it no longer actua

[C++-sig] Details of Boost.Python Py_Finalize issue?

2009-08-02 Thread Haoyu Bai
oblems. So could anyone share your experience with this issue, provide some test case or anymore information about this issue? I will try to solve it. Thank you! -- Haoyu Bai School of Computing, National University of Singapore. ___ Cplusplus-sig mailing

Re: [C++-sig] boost::python::str and Python's str and unicode types

2009-08-01 Thread Haoyu Bai
implemented for Python 3 contains some converters for PyUnicode and C++ string types, and a boost::python::str class that conditionally call PyUnicode API in Python 3 or PyString API in Python 2. So a boost::python::unicode type would be very useful for Python 2. And for Python 3, we might need to rena

[C++-sig] Boost.Python py3k support mid-term status report

2009-07-05 Thread Haoyu Bai
extension module to py3k. Thank you! Reference: [1] http://bugs.python.org/issue6223 -- Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

[C++-sig] Py3k unicode to const char* conversion solved (Re: boost::python for Python 3.0)

2009-06-06 Thread Haoyu Bai
ost of the test cases are passed. Just some corner things remaining, and it seems there is a 2to3 bug caused some doctests syntax not fixed. I'm going to take care of these. Regards, Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@

Re: [C++-sig] boost::python for Python 3.0

2009-06-01 Thread Haoyu Bai
reading the code about call policies and type converting, hopefully I can state the problem clearer and even find out a solution when I get more understanding about BPL internal. Thanks for your interesting! :) -- Haoyu Bai ___ Cplusplus-sig mailing

Re: [C++-sig] boost python in visual c++ 2008

2009-04-20 Thread Haoyu Bai
___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > Hi, Are you compiled your module to a file with '.dll' extension? Accord to Python document, the '.dll' extension will not be recognized by Python after version 2.5. (http://docs.python.org/extending/windows.html) You should change the extension name to '.pyd'. -- Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Preliminary progress on Boost.Python py3k support

2009-04-02 Thread Haoyu Bai
is almost summarized from my SWIG py3k porting experience, provides more details: http://wiki.python.org/moin/Py3kExtensionModules Thanks! -- Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Preliminary progress on Boost.Python py3k support

2009-04-02 Thread Haoyu Bai
; Hi, The project haven't been approved yet. I just did some proof-of-concept work to have a sense of how the project will be and show the feasibility of my time estimation. It also give me more understanding of BPL code. Thanks Niall! :) -- Haoyu Bai _

[C++-sig] Preliminary progress on Boost.Python py3k support

2009-04-01 Thread Haoyu Bai
upport,” http://www.nabble.com/Some-thoughts-on-py3k-support-td22564813.html. -- Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Some thoughts on py3k support

2009-03-19 Thread Haoyu Bai
gt; your code compatible. > > Thanks! > It means though that one has to think more about runtime overhead. Sigh. > Ralf Yes unicode string can't faster than raw string. However one can use the bytes object while regarding to performance. -- Haoyu Bai ___

Re: [C++-sig] Some thoughts on py3k support

2009-03-19 Thread Haoyu Bai
On Thu, Mar 19, 2009 at 8:05 AM, Niall Douglas wrote: > On 18 Mar 2009 at 2:07, Haoyu Bai wrote: > > I'd prefer a slightly different naming convention for the eventual > case when Boost.Python itself bumps a version. How about this: > > libboost_python_py2.so > libboost_

Re: [C++-sig] Some thoughts on py3k support

2009-03-19 Thread Haoyu Bai
he result in Python 3 will be: "hello" = ['h', '\x00', 'e', '\x00', 'l', '\x00', 'l', '\x00', 'o', '\x00'] b"hello" = ['h', 'e', 'l', 'l', 'o'] and u"hello" is invalid by then. > > I have quite a few C++ functions with const char* arguments, expecting one > byte per character. > >> - convert char* and std::string to/from Python 3 unicode string. > > How would this work exactly? > Is the plan to copy the unicode data to a temporary one-byte-per-character > buffer? > Of course the default converter policy we planed is not to convert to raw data buffer from unicode object via PyUnicode_AS_DATA(). The C-API such as PyUnicode_AsUTF8String() and PyUnicode_AsEncodedString() will be used to convert unicode to bytes and then convert to char* and passed to your C++ function. By default we would use PyUnicode_AsUTF8String(), and encoding could be explicitly specified by a converter policy. That may keep most of your code compatible. Thanks! -- Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Some thoughts on py3k support

2009-03-18 Thread Haoyu Bai
default behavior should be when there is no policy set by user explicitly. The candidates are: - raise an error - convert char* and std::string to/from Python bytes - convert char* and std::string to/from Python 3 unicode string. I personally like the last one because it would keep most of the existing c

Re: [C++-sig] Some thoughts on py3k support

2009-03-18 Thread Haoyu Bai
uitable in this case. So we would like to just provide a converter and just let user to specify it if a raw buffer is required. -- Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] [boost] [Python] GSoC and Python 3.0 Support

2009-03-17 Thread Haoyu Bai
   Stefan > Hi, I'm very happy to see so much interest in this project. You are all experts on Boost.Python so I'd glad to see anyone of you to mentor this. I'm looking forward for this summer! I'll post more questions and proposals etc. to Python c++-sig mailling list

[C++-sig] Some thoughts on py3k support

2009-03-17 Thread Haoyu Bai
de string in Python 3, that would keep most of existing code compatible. Anyway there will be code really need a single byte string returned, a new converter can be explicitly specified for this. There are more issues similar to this. I'll figure out more and write a

Re: [C++-sig] [boost] [Python] GSoC and Python 3.0 Support

2009-03-12 Thread Haoyu Bai
On Thu, Mar 12, 2009 at 4:50 AM, Niall Douglas wrote: > On 11 Mar 2009 at 13:42, Ravi wrote: > >> On Wednesday 11 March 2009 12:38:55 Haoyu Bai wrote: >> > > 1. Thread safety >> > > 2. PyFinalize support >> > > 3. Easier methods to write to_py

Re: [C++-sig] GSoC and py3k support for Boost.Python

2009-03-12 Thread Haoyu Bai
le for this project. [1] http://socghop.appspot.com/document/show/program/google/gsoc2009/faqs Thanks! -- Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

[C++-sig] GSoC and py3k support for Boost.Python

2009-03-11 Thread Haoyu Bai
this project if possible. Any comment is welcome. And it would be great if you are willing to mentor this project. Thanks! -- Haoyu Bai ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig