[Python-Dev] Introduction and request for commit access to the sandbox.

Alexandre Vassalotti alexandre at peadrop.com
Tue May 22 22:35:36 CEST 2007


On 5/21/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > With that said, I would to request svn access to the sandbox for my
> > work. I will use this access only for modifying stuff in the directory
> > I will be assigned to. I would like to use the username "avassalotti"
> > and the attached SSH2 public key for this access.
>
> I have added your key. As we have a strict first.last account policy,
> I named it alexandre.vassalotti; please correct me if I misspelled it.

Thanks!

> > One last thing, if you know semantic differences (other than the
> > obvious ones) between the C and Python versions of the modules I need
> > to merge, please let know. This will greatly simplify the merge and
> > reduce the chances of later breaking.
>
> Somebody noticed on c.l.p that, for cPickle,
> a) cPickle will start memo keys at 1; pickle at 0
> b) cPickle will not put things into the memo if their refcount is
>    1, whereas pickle puts everything into the memo.

Noted. I think I found the thread on c.l.p about it:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/68c72a5066e4c9bb/b2bc78f7d8d50320

> Not sure what you'd consider obvious, but I'll mention that cStringIO
> "obviously" is constrained in what data types you can write (namely,
> byte strings only), whereas StringIO allows Unicode strings as well.

Yes. I was already aware of this. I just hope this problem will go
away with the string unification in Python 3000. However, I will need
to deal with this, sooner or later, if I want to port the merge to
2.x.

> Less obviously, StringIO also allows
>
> py> s = StringIO(0)
> py> s.write(10)
> py> s.write(20)
> py> s.getvalue()
> '1020'

That is probably due to the design of cStringIO, which is separated
into two subparts StringI and StringO. So when the constructor of
cStringIO is given a string, it builds an output object, otherwise it
builds an input object:

    static PyObject *
    IO_StringIO(PyObject *self, PyObject *args) {
      PyObject *s=0;

      if (!PyArg_UnpackTuple(args, "StringIO", 0, 1, &s)) return NULL;

      if (s) return newIobject(s);
      return newOobject(128);
    }

As you see, cStringIO's code also needs a good cleanup to make it,
at least, conforms to PEP-7.

-- Alexandre


More information about the Python-Dev mailing list