@@ -197,7 +197,7 @@ class object, used to create cursors (keyword only)
197
197
198
198
db = proxy (self )
199
199
def _get_string_literal ():
200
- # Note: string_literal() is called for bytes object on Python 3 (via bytes_literal)
200
+ # Note: string_literal() is called for bytes object on Python 3.
201
201
def string_literal (obj , dummy = None ):
202
202
return db .string_literal (obj )
203
203
return string_literal
@@ -213,19 +213,13 @@ def unicode_literal(u, dummy=None):
213
213
return db .literal (str (u ).encode (unicode_literal .charset ))
214
214
return unicode_literal
215
215
216
- def _get_bytes_literal ():
217
- def bytes_literal (obj , dummy = None ):
218
- return b'_binary' + db .string_literal (obj )
219
- return bytes_literal
220
-
221
216
def _get_string_decoder ():
222
217
def string_decoder (s ):
223
218
return s .decode (string_decoder .charset )
224
219
return string_decoder
225
220
226
221
string_literal = _get_string_literal ()
227
222
self .unicode_literal = unicode_literal = _get_unicode_literal ()
228
- bytes_literal = _get_bytes_literal ()
229
223
self .string_decoder = string_decoder = _get_string_decoder ()
230
224
if not charset :
231
225
charset = self .character_set_name ()
@@ -240,8 +234,7 @@ def string_decoder(s):
240
234
self .converter [FIELD_TYPE .VARCHAR ].append ((None , string_decoder ))
241
235
self .converter [FIELD_TYPE .BLOB ].append ((None , string_decoder ))
242
236
243
- self .encoders [bytes ] = string_literal if PY2 else bytes_literal
244
- self .encoders [bytearray ] = bytes_literal
237
+ self .encoders [bytes ] = string_literal
245
238
self .encoders [unicode ] = unicode_literal
246
239
self ._transactional = self .server_capabilities & CLIENT .TRANSACTIONS
247
240
if self ._transactional :
0 commit comments