This project is archived and is in readonly mode.
Review binary typecasters in Py3
Reported by Daniele Varrazzo | February 1st, 2011 @ 11:08 AM | in python3 (closed)
In current Py3 implementation the typecaster receive a decoded string. This means that is basically impossible to have a binary typecaster in python.
Idea: add a "binary" flag (or a "type", currently only "text" and "binary" would be meaningful) to the typecaster type. It would default to text on Python 3 and either default to binary in Python 2 or not available at all. The create_type would grow an optional parameter with the proper default. Use the value to decide whether to pass a binary or a decoded text to the typecaster function.
Comments and changes to this ticket
-
Daniele Varrazzo February 6th, 2011 @ 01:52 PM
- State changed from new to resolved
Added optional "binary" parameter to create_type and to the typecaster type. If true, the python typecaster will receive a bytes object, otherwise will receive a string decoded in the connection encoding. The parameter is used only in Python 3: in Python 2 only strings are used.
-
Daniele Varrazzo February 8th, 2011 @ 11:48 PM
- State changed from resolved to invalid
- Tag set to binary, python3, typecaster
We eventually decided to not include this patch. I attach it here as documentation in case the need to do something arises.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.