[issue42594] Provide a way to skip magic-number search in ZipFile(mode='a')

2020-12-07 Thread Bart Robinson


New submission from Bart Robinson :

When a ZipFile object is created with mode='a', the existing file contents are 
checked for the magic number b"PK\005\006" near the end of the file.  If a 
non-zipfile just happens to contain this magic number, it can confuse the 
library into assuming the file is a zipfile when it is not.  It would be great 
if ZipFile.__init__() provided a way to skip the magic-number check and force a 
new central directory to be appended to the file.

This could take the form of an additional named argument like 
ZipFile.__init__(force_append=True), or an additional character in the mode 
string, like 'a+'.  Either of these options should be backward-compatible with 
existing code.

Currently, my company has code that uses monkey-patching to work around the 
lack of this feature in the standard library.  We use mode='a' to append 
metadata to files in existing formats that can contain arbitrary binary data 
and so occasionally include the magic number.

--
components: Library (Lib)
messages: 382691
nosy: Bart Robinson
priority: normal
severity: normal
status: open
title: Provide a way to skip magic-number search in ZipFile(mode='a')
type: enhancement
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue42594>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12450] Use the Grisu algorithms to convert floats to strings

2017-02-19 Thread Bart Robinson

Bart Robinson added the comment:

Six years later, I have accepted Amaury's challenge and created an extension 
module that uses the double-conversion library to generate repr's for floats: 
https://pypi.python.org/pypi/frepr

My rudimentary performance testing gives something like 8X speedup compared to 
the standard float_repr().

Scrutiny and suggestions welcome...

--
nosy: +Bart Robinson

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12450>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com