[Python-3000] How to override io.BytesIO and io.StringIO with their optimized C version?

Alexandre Vassalotti alexandre at peadrop.com
Wed Dec 26 22:24:57 CET 2007


I started to play again with the _bytesio and _stringio modules I
created, during last summer. Right now, I am mostly porting my changes
to the current trunk. If all goes well, the modules should be ready to
merged in the trunk by this week. (question: How should this be done?
Should I just bundle a set of patches and put on the tracker?)

However, I found a little problem which I am not sure how to fix
properly. Early during the interpreter initialization process, the
_bytesio and _stringio modules seems to be unavailable for some
unknown reason. And since io.py is imported before the modules become
available, this causes io.py to always use the Python version of
BytesIO and StringIO. So my question is, how should I override
io.BytesIO and io.StringIO with their optimized C version? My first
thought is to override the module in site.py, but I am not sure yet if
this the right thing to do.

Cheers and happy holidays,
-- Alexandre


More information about the Python-3000 mailing list