bpo-32035: Update zipfile doc by srcecde · Pull Request #4698 · python/cpython (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation7 Commits42 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

srcecde

@srcecde

@the-knights-who-say-ni

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@srcecde srcecde changed the titleissue #32035: Update zipfile doc bpo-32035: Update zipfile doc

Dec 4, 2017

@srcecde srcecde changed the titlebpo-32035: Update zipfile doc bpo-32035: Update zipfile doc skip news

Dec 4, 2017

@srcecde srcecde changed the titlebpo-32035: Update zipfile doc skip news bpo-32035: Update zipfile doc

Dec 4, 2017

@terryjreedy

Patches are in 3.7.0a3 even if this update is not.

@terryjreedy

When tk event handling is driven by IDLE's run loop, a confusing and distracting queue.EMPTY traceback context is no longer added to tk event exception tracebacks. The traceback is now the same as when event handling is driven by user code. Patch based on a suggestion by Serhiy Storchaka.

@ericvsmith

@terryjreedy

vadmium

name it will be given in the archive, or a :class:`ZipInfo` instance. If it's
an instance, at least the filename, date, and time must be given. If it's a
Write the string or bytes *data* to the archive; if it is a *str*, it should be encoded as UTF-8.
*zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc string wording works better IMO; see https://hg.python.org/cpython/rev/19196cce1431. In particular “bytes instance” makes more sense than “the bytes _data_”, and “it is encoded” is clearer; “it should be encoded” sounds like the responsibility of the caller.

@Mariatta @ned-deily

@ilevkivskyi @ned-deily

@ned-deily

@nascheme

…to some fields (#4685)

@srcecde

@srcecde

@ned-deily

@ned-deily

@ned-deily

The undecodable file name cannot be created on macOS APFS file systems.

@JulienPalard @Mariatta

@srcecde

@ned-deily

@ned-deily

@ned-deily

@vstinner

@ericvsmith

@ned-deily

@vstinner

Remove also the initstr variable, unused since the commit e69f0df pushed in 2012: "bpo-13959: Re-implement imp.find_module() in Lib/imp.py"

@vstinner

@CuriousLearner @vstinner

@vstinner

PyImport_ExtendInittab() now uses PyMem_RawRealloc() rather than PyMem_Realloc(). PyImport_ExtendInittab() can be called before Py_Initialize() whereas only the PyMem_Raw allocator is supposed to be used before Py_Initialize().

Add _PyImport_Fini2() to release the memory allocated by PyImport_ExtendInittab() at exit. PyImport_ExtendInittab() now forces the usage of the default raw allocator, to be able to release memory in _PyImport_Fini2().

Don't export these functions anymore to be C API, only to Py_BUILD_CORE:

@datalogics-robb @ambv

@ericvsmith

@zooba

@pablogsal @vstinner

@srcecde

@srcecde

@srcecde

@srcecde

@srcecde

serhiy-storchaka

name it will be given in the archive, or a :class:`ZipInfo` instance. If it's
an instance, at least the filename, date, and time must be given. If it's a
name, the date and time is set to the current date and time.
Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this line too long?

ZipFile.write() writes a file into archive. ZipFile.writestr() writes a bytes data or a string.

an instance, at least the filename, date, and time must be given. If it's a
name, the date and time is set to the current date and time.
Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance;
if it is a *str*, it is encoded as UTF-8.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this looks correct. str instance is not encoded. It is just a sequence of character, and how it is represented internally is an implementation detail.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. Thanks for the update.

name, the date and time is set to the current date and time.
Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance;
if it is a *str*, it is encoded as UTF-8.
*zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid unneeded rewrapping. Wrap only long lines that you have changed in any way.

@srcecde

serhiy-storchaka

name it will be given in the archive, or a :class:`ZipInfo` instance. If it's
an instance, at least the filename, date, and time must be given. If it's a
name, the date and time is set to the current date and time.
`ZipFile.write()` writes a file into archive. `ZipFile.writestr()` writes a bytes data or a string.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't mean that you should include my words verbatim. ZipFile.write() is documented in the description of ZipFile.write().

The existing documentation is mostly good. The only problem is that the term "string" is used in wider meaning that includes byte strings, but this is not clear. Just document what actually does this method.

@srcecde