Message79325
| Author |
vstinner |
| Recipients |
amaury.forgeotdarc, vstinner |
| Date |
2009年01月07日.11:46:49 |
| SpamBayes Score |
0.076419905 |
| Marked as misclassified |
No |
| Message-id |
<1231328810.61.0.792806559105.issue4862@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> This is because the zero in seek(0) is a "cookie"
> which contains both the position and the decoder state.
> Unfortunately, state=0 means 'endianness has been determined:
> native order'.
The problem is maybe that TextIOWrapper._pack_cookie() can create a
cookie=0. Example to create a non-null value, replace:
def _pack_cookie(self, position, ...):
return (position | (dec_flags<<64) | ...
def _unpack_cookie(self, bigint):
rest, position = divmod(bigint, 1<<64)
...
by
def _pack_cookie(self, position, ...):
return (1 | (position<<1) | (dec_flags<<65) | ...
def _unpack_cookie(self, bigint):
if not (bigint & 1):
raise ValueError("invalid cookie")
bigint >>= 1
rest, position = divmod(bigint, 1<<64)
...
Why the cookie is an integer and not an object with attributes? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年01月07日 11:46:50 | vstinner | set | recipients:
+ vstinner, amaury.forgeotdarc |
| 2009年01月07日 11:46:50 | vstinner | set | messageid: <1231328810.61.0.792806559105.issue4862@psf.upfronthosting.co.za> |
| 2009年01月07日 11:46:50 | vstinner | link | issue4862 messages |
| 2009年01月07日 11:46:49 | vstinner | create |
|