Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Review binary typecasters in Py3

#38

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.

Reported by Daniele Varrazzo · February 1st, 2011 @ 11:08 AM

State: invalid
Milestone: python3
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo
    • 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.

    February 6th, 2011 @ 01:52 PM

  2. Daniele Varrazzo
    Daniele Varrazzo
    • 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.

    February 8th, 2011 @ 11:48 PM