Danny Yoo added the comment:
Alternatively, change the representation of flag values from integers to some
class extension that supports the common bitwise operators.
As a very rough sketch:
>>> class FlagInt(int):
... def __or__(self, other):
... return FlagInt(int(se
Danny Yoo added the comment:
Ugh. I suddenly realize that this is complicated by the fact that flag values
are themselves represented as integers, and Python's type system isn't rich
enough to label flag values as a distinct type for the purposes.
It may be worthwhile to add a warning
New submission from Danny Yoo:
This comes from diagnosing a beginner's question on Python-tutor.
https://mail.python.org/pipermail/tutor/2016-December/110066.html
It appears that re.sub is not checking whether the count argument is integer or
not, and silently accepts a nonsensical argument
Danny Yoo added the comment:
Unfortunately, fixing just zlib.crc32 isn't quite enough for our purposes. We
still will see OverflowErrow in zipfile if compression is selected.
Demonstration code:
import zipfile
## Possible workaround: monkey
New submission from Danny Yoo:
Reproduction steps:
---
$ python2.7 -c import zlib;zlib.crc32('a'*(131))
Traceback (most recent call last):
File string, line 1, in module
OverflowError: size does not fit in an int
---
We ran into this bug in zlib.crc32 when using zipfile.writestr
Changes by Danny Yoo danny...@google.com:
--
title: zlib.crc32 raises OverflowError at argument-parsing time on large
strings - Within zipfile, use of zlib.crc32 raises OverflowError at
argument-parsing time on large strings
___
Python tracker rep