#4609 closed Patches (fixed)
Boost.Python: Converting from bytes object to std::string
Reported by: | Haoyu Bai | Owned by: | Ralf W. Grosse-Kunstleve |
---|---|---|---|
Milestone: | To Be Determined | Component: | python USE GITHUB |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: | blake@…, mistersheik@… |
Description
I just realized that, in Boost.Python with Python 3, there is no way to accept a Python bytes object as function argument in C++ side. Since both std::string and char* are mapped to Python unicode object (which is the default str type in Python 3). This will cause trouble when porting existing code to Python 3.
The attached patch fix this by allow both unicode string and bytes being converted to std::string.
Attachments (1)
Change History (20)
by , 12 years ago
Attachment: | bytes_to_string.patch added |
---|
comment:1 by , 12 years ago
Summary: | Converting from bytes object to std::string → Boost.Python: Converting from bytes object to std::string |
---|
comment:2 by , 12 years ago
comment:3 by , 12 years ago
Not very likely by me, sorry. But if you poke the C++-sig another maintainer might take a crack at it.
comment:4 by , 12 years ago
Cc: | added |
---|
great, thanks for commenting, I've mentioned this issue on sig-c++ just now: http://mail.python.org/pipermail/cplusplus-sig/2011-January/015856.html
comment:5 by , 11 years ago
Any chance of this being looked at? This is a very useful patch, and it is sort of a pain to have to apply it and compile boost every time I want to update. Thanks to bhy for the great patch.
comment:11 by , 10 years ago
Why has this not yet been addressed? I think that almost everybody using boost python with python 3 uses this patch, or has to deal with the bug. Any chance this patch could be accepted?
comment:12 by , 10 years ago
Same story here. Anyone on the boost team - can you at least comment on why this patch is not getting accepted?
comment:13 by , 10 years ago
Owner: | changed from | to
---|
Speaking personally, maintenance responsibility for Boost.Python has largely passed from me to others. Unfortunately, I am not sure to whom the ticket should be reassigned. Maybe Ralf knows?
comment:14 by , 10 years ago
svn rev. 79774 applies this patch to the boost trunk
if there are no problems I plan to merge to the release branch in about a week
comment:16 by , 10 years ago
Thanks for committing this rwgk, but this fix still hasn't showed up in either of the two releases since then. Is there any chance we can get this merged to the release branch?
comment:17 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I merged the change into the release branch about six days ago.
comment:19 by , 7 years ago
Emm, I'm sorry to poke this old issue, but doesn't it solve only half of the problem? How do I return bytes string? It seems that it always returns Unicode string in Python 3...
any chance of this getting looked at soon?