Buck Golemon
2014-05-01 21:32:52 UTC
My below message didn't seem to get through.
Is there a moderation issue?
Is there a moderation issue?
We're working on porting MySQLdb, and run up against a hard wall in %s in
bytestrings.
SQL queries are truly bytes (they can contain arbitrary binary blobs for
insertion), but also need substition operations. The substition scheme in
MySQLdb is %s. This was handy when we could do query_bytesring % params,
but makes things very tough in python3.
A) Somehow decode arbitrary bytes to str, do the substitution, and encode
back to bytes. I can use the 'sorrogateescape' erorr handler to do this in
python3, but since this doesn't existing in 2.6 or 2.7, it doesn't jive
with my goals of 2+3 support.
B) Implement modulo substitution for bytes in python3. I see that this
operation is making a reappearance in python3.5, so this seems fairly
http://legacy.python.org/dev/peps/pep-0461/
I'm using the `future` package <http://python-future.org/> to do the
port, and am very pleased with the result, but it doesn't handle this one
rough spot. Can I request a 2+3 implementation of bytes.__mod__? Or, has
anyone seen a currently-existing implementation of this function?
bytestrings.
SQL queries are truly bytes (they can contain arbitrary binary blobs for
insertion), but also need substition operations. The substition scheme in
MySQLdb is %s. This was handy when we could do query_bytesring % params,
but makes things very tough in python3.
A) Somehow decode arbitrary bytes to str, do the substitution, and encode
back to bytes. I can use the 'sorrogateescape' erorr handler to do this in
python3, but since this doesn't existing in 2.6 or 2.7, it doesn't jive
with my goals of 2+3 support.
B) Implement modulo substitution for bytes in python3. I see that this
operation is making a reappearance in python3.5, so this seems fairly
http://legacy.python.org/dev/peps/pep-0461/
I'm using the `future` package <http://python-future.org/> to do the
port, and am very pleased with the result, but it doesn't handle this one
rough spot. Can I request a 2+3 implementation of bytes.__mod__? Or, has
anyone seen a currently-existing implementation of this function?