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 }})
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 changed the title
issue #32035: Update zipfile doc bpo-32035: Update zipfile doc
srcecde changed the title
bpo-32035: Update zipfile doc bpo-32035: Update zipfile doc skip news
srcecde changed the title
bpo-32035: Update zipfile doc skip news bpo-32035: Update zipfile doc
Patches are in 3.7.0a3 even if this update is not.
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.
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.
…to some fields (#4685)
Rather than raise TypeError, warn and call list() on the value.
Fix tests, revise NEWS and whatsnew text.
Revise documentation, a string is okay as well.
Ensure 'requires' and 'obsoletes' are real lists.
Test that requires and obsoletes are turned to lists.
The undecodable file name cannot be created on macOS APFS file systems.
- Simplify _PyCoreConfig_INIT, _PyMainInterpreterConfig_INIT, _PyPathConfig_INIT macros: no need to set fields to 0/NULL, it's redundant (the C language sets them to 0/NULL for us).
- Fix typo: pymain_run_statup() => pymain_run_startup()
- Remove a few XXX/TODO
Remove also the initstr variable, unused since the commit e69f0df pushed in 2012: "bpo-13959: Re-implement imp.find_module() in Lib/imp.py"
- Py_Main() now starts by reading Py_xxx configuration variables to only work on its own private structure, and then later writes back the configuration into these variables.
- Replace Py_GETENV() with pymain_get_env_var() which ignores empty variables.
- Add _PyCoreConfig.dump_refs
- Add _PyCoreConfig.malloc_stats
- _PyObject_DebugMallocStats() is now responsible to check if debug hooks are installed. The function returns 1 if stats were written, or 0 if the hooks are disabled. Mark _PyMem_PymallocEnabled() as static.
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:
- _PyExc_Fini()
- _PyImport_Fini()
- _PyGC_DumpShutdownStats()
- _PyGC_Fini()
- _PyType_Fini()
- _Py_HashRandomization_Fini()
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.
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.