Commit Graph

136 Commits

Author SHA1 Message Date
Serhiy Storchaka
d5db57396b Issue #19883: Fixed possible integer overflows in zipimport. 2016-01-28 21:30:16 +02:00
Benjamin Peterson
d52513cb22 merge 3.4 2016-01-21 22:03:55 -08:00
Benjamin Peterson
b1db758061 reject negative data_size 2016-01-21 22:02:46 -08:00
Benjamin Peterson
47b8ba22e3 merge 3.4 (#26171) 2016-01-20 22:25:06 -08:00
Benjamin Peterson
c4032da201 prevent buffer overflow in get_data (closes #26171) 2016-01-20 22:23:44 -08:00
Benjamin Peterson
d4d7737c3f merge 3.4 2016-01-20 22:07:43 -08:00
Benjamin Peterson
ef9cf08352 fix refleak in error condition 2016-01-20 22:06:43 -08:00
Brett Cannon
56aae8f304 Issue #17633: Improve support for namespace packages with zipimport.
Previously zipimport mistakenly limited namespace support to only the
top-level of the zipfile when it should have supported an arbitrary
depth.

Thanks to Phil Connel for the bug report and initial patch and Mike
Romberg for the final patch.
2016-01-15 11:22:19 -08:00
Serhiy Storchaka
5a57ade58e Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
2015-12-24 10:35:59 +02:00
Brett Cannon
f299abdafa Issue #23731: Implement PEP 488.
The concept of .pyo files no longer exists. Now .pyc files have an
optional `opt-` tag which specifies if any extra optimizations beyond
the peepholer were applied.
2015-04-13 14:21:02 -04:00
Victor Stinner
fbd6f9ed12 Issue #23696: Chain ZipImportError to the OSError 2015-03-20 10:52:25 +01:00
Victor Stinner
5200f55024 Issue #19428: Handle PyMarshal_Read*() errors in run_pyc_file()
Detect also earlier PyMarshal_Read*() errors in zipimport.
2015-03-18 13:56:25 +01:00
Victor Stinner
e42ccd2bfd Issue #23694: Enhance _Py_fopen(), it now raises an exception on error
* If fopen() fails, OSError is raised with the original filename object.
* The GIL is now released while calling fopen()
2015-03-18 01:39:23 +01:00
Serhiy Storchaka
1a1ff29659 Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows.  Added few missed PyErr_NoMemory().
2015-02-16 13:28:22 +02:00
Benjamin Peterson
34c1540009 merge backout for #20621 2014-02-16 14:17:28 -05:00
Benjamin Peterson
766e10c4a8 merge 3.3 2014-01-09 09:36:23 -06:00
Benjamin Peterson
21e7d4cd5e fix zipimport ref leak 2014-01-09 09:36:10 -06:00
Gregory P. Smith
2e385e2592 Fixes issue #19081: When a zipimport .zip file in sys.path being imported from
is modified during the lifetime of the Python process after zipimport has
already cached the zip's table of contents we detect this and recover
rather than read bad data from the .zip (causing odd import errors).
2014-01-07 18:34:23 -08:00
Gregory P. Smith
2bcbc14117 Fixes Issue #19081: When a zipimport .zip file in sys.path being imported from
is modified during the lifetime of the Python process after zipimport has
already cached the zip's table of contents we detect this and recover
rather than read bad data from the .zip (causing odd import errors).
2014-01-07 18:30:07 -08:00
Victor Stinner
651f9f77f3 Issue #19515: Remove duplicated identifiers in zipimport.c 2013-11-12 21:44:18 +01:00
Victor Stinner
af8b7e8233 Issue #18408: Fix zipimport, handle PyUnicode_Substring() and get_subname() failures 2013-10-29 01:46:24 +01:00
Victor Stinner
73660af6af Issue #19428: zipimport now handles errors when reading truncated or invalid
ZIP archive.
2013-10-29 01:43:44 +01:00
Victor Stinner
daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Brett Cannon
83358c9f13 Grammatical mistake in a comment 2013-06-20 21:30:32 -04:00
Serhiy Storchaka
0e6b7b5cd2 Issue #8745: Small speed up zipimport on Windows. Patch by Catalin Iacob. 2013-02-16 17:43:45 +02:00
Jesus Cea
fb22f542d2 MERGE: Closes #15897: zipimport.c doesn't check return value of fseek() 2012-10-03 03:00:37 +02:00
Jesus Cea
09bf7a799d Closes #15897: zipimport.c doesn't check return value of fseek() 2012-10-03 02:13:05 +02:00
Christian Heimes
1b5c76a283 Fixed two memory leaks in make_filename() in zipimport.c. The allocated buffer wasn't cleaned up in two error cases. CID 486832 2012-09-10 02:00:34 +02:00
Stefan Krah
000fde9651 Closes #15737: Fix potential NULL dereference in zipimport.c. 2012-08-20 14:14:49 +02:00
Benjamin Peterson
46c214d893 capitialize enum members 2012-05-25 10:22:29 -07:00
Benjamin Peterson
18eac4a1d6 use PyDict_Contains 2012-05-25 00:24:42 -07:00
Benjamin Peterson
a6a7a1accf return NULL on error 2012-05-25 00:22:04 -07:00
Benjamin Peterson
2d12e1458f actually return the result 2012-05-25 00:19:40 -07:00
Benjamin Peterson
5ed7bd79df simplify and rewrite the zipimport part of 702009f3c0b1 a bit 2012-05-24 22:54:15 -07:00
Benjamin Peterson
209e04c201 plug ref leak 2012-05-24 22:35:39 -07:00
Eric V. Smith
984b11f88f issue 14660: Implement PEP 420, namespace packages. 2012-05-24 20:21:04 -04:00
Gregory P. Smith
cc6abd56b8 Fix zipimport.c's read_directory() to use appropriate types for the values
being read from the header vs the values being used by fseek and ftell
(Py_ssize_t for those).  Updates the Py_BuildValue format string to match
(including several existing wrong 'i's that should have been 'l's).
2012-01-30 15:55:29 -08:00
Gregory P. Smith
ab32066e65 Fix zip_import.c's read_directory() to use appropriate types for the values
being read from the header vs the values being used by fseek and ftell
(Py_ssize_t for those) and how they are computed.  Py_ssize_t is used for
actual file offsets so that files greater than 2gigs could be supported.
Updates the Py_BuildValue format string to match (including several existing
wrong 'i's that should have been 'l's).
2012-01-30 15:17:33 -08:00
Victor Stinner
bd206e27a4 Handle correctly _Py_fopen() error: don't replace the exception 2011-12-18 21:04:17 +01:00
Antoine Pitrou
5136ac0ca2 Issue #13645: pyc files now contain the size of the corresponding source
code, to avoid timestamp collisions (especially on filesystems with a low
timestamp resolution) when checking for freshness of the bytecode.
2012-01-13 18:52:16 +01:00
Victor Stinner
3573476271 (Merge 3.2) Handle correctly _Py_fopen() error: don't replace the exception 2011-12-18 21:05:22 +01:00
Victor Stinner
bd0850b857 import.c now catchs _Py_stat() exceptions
_Py_stat() now returns -2 if an exception was raised.
2011-12-18 20:47:30 +01:00
Martin v. Löwis
5156f2ca9a Drop unused variable. 2011-10-31 09:05:10 +01:00
Martin v. Löwis
cfa6129276 Fix typo. 2011-10-31 09:01:22 +01:00
Martin v. Löwis
a72e78b3b1 Replace Py_UCS4_ API with Unicode API. 2011-10-31 08:33:37 +01:00
Martin v. Löwis
bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Victor Stinner
3f528f0c1b Fix a compiler warning in zipimport 2011-10-11 22:28:56 +02:00
Martin v. Löwis
1ee1b6fe0d Use identifier API for PyObject_GetAttrString. 2011-10-10 18:11:30 +02:00
Georg Brandl
4cb0de246c Rename new macros to conform to naming rules (function macros have "Py" prefix, not "PY"). 2011-09-28 21:49:49 +02:00
Martin v. Löwis
d63a3b8beb Implement PEP 393. 2011-09-28 07:41:54 +02:00