[issue9858] Python and C implementations of io are out of sync

Daniel Stutzbach report at bugs.python.org
Wed Sep 15 18:01:37 CEST 2010


Daniel Stutzbach <daniel at stutzbachenterprises.com> added the comment:

On Wed, Sep 15, 2010 at 10:51 AM, Benjamin Peterson
<report at bugs.python.org>wrote:

> I'm not sure if this pickling stuff matters as long as they both pickle.
>

I'm not sure either.  Do other Python implementations try to maintain a
compatible pickle format with CPython?  If so, I think CPython's C and
Python versions should also pickle to the same format.

> Yes, all the code expects an AttributeError on name is it's not
> present. For example, FileIO only sets its name attribute if it is
> passed a filename and not an fd.
>

Actually, FileIO sets the name attribute to the file descriptor if it isn't
passed a name:

1

----------
Added file: http://bugs.python.org/file18890/unnamed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9858>
_______________________________________
-------------- next part --------------
<div class="gmail_quote">On Wed, Sep 15, 2010 at 10:51 AM, Benjamin Peterson <span dir="ltr">&lt;<a href="mailto:report at bugs.python.org">report at bugs.python.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

I&#39;m not sure if this pickling stuff matters as long as they both pickle.<br></blockquote><div><br>I&#39;m not sure either.  Do other Python implementations try to maintain a compatible pickle format with CPython?  If so, I think CPython&#39;s C and Python versions should also pickle to the same format.<br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Yes, all the code expects an AttributeError on name is it&#39;s not<br>
present. For example, FileIO only sets its name attribute if it is<br>
passed a filename and not an fd.<br></blockquote><div><br>Actually, FileIO sets the name attribute to the file descriptor if it isn&#39;t passed a name:<br><br>&gt;&gt;&gt; f = io.FileIO(1)<br>&gt;&gt;&gt; <a href="http://f.name">f.name</a><br>
1<br></div></div>


More information about the Python-bugs-list mailing list