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
Victor Stinner
9a2261a372
zipimport: initialize fullpath to NULL
...
In some cases, fullpath value is used whereas fullpath was not always
initialized. Warning found by the Clang Static Analyzer.
2011-05-26 13:59:41 +02:00
Gregory P. Smith
95c7c46077
avoid a compiler warning. the compiler doesn't know that the static
...
struct guarantees the loop will always be run once to initialize code.
2011-05-21 05:19:42 -07:00
Victor Stinner
21809a6938
(Merge 3.2) Issue #12124 : zipimport doesn't keep a reference to
...
zlib.decompress() anymore to be able to unload the module.
2011-05-20 00:22:39 +02:00
Victor Stinner
4445ec81c1
(Merge 3.1) Issue #12124 : zipimport doesn't keep a reference to
...
zlib.decompress() anymore to be able to unload the module.
2011-05-20 00:18:58 +02:00
Victor Stinner
4925cde1cc
Issue #12124 : zipimport doesn't keep a reference to zlib.decompress() anymore
...
to be able to unload the module.
2011-05-20 00:16:09 +02:00
Ezio Melotti
3b3499ba69
#11565 : Merge with 3.1.
2011-03-16 11:35:38 +02:00
Ezio Melotti
13925008dc
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 11:05:33 +02:00
Ezio Melotti
4969f709cc
#11515 : Merge with 3.1.
2011-03-15 05:59:46 +02:00
Ezio Melotti
42da663e6f
#11515 : fix several typos. Patch by Piotr Kasprzyk.
2011-03-15 05:18:48 +02:00
Victor Stinner
f6b563af2d
Issue #3080 : zipimport has a full unicode suppport
...
- Use Unicode for module paths and names, self->archive and self->prefix
- Format module names and paths use %R instead of '%U' to escape surrogate
characters (PEP 383)
- Use PyImport_ExecCodeModuleObject() instead of PyImport_ExecCodeModuleEx()
- Use PyImport_AddModuleObject() instead of PyImport_AddModule()
2011-03-14 20:46:50 -04:00
Victor Stinner
4ee65a9685
Issue #10955 : zipimport uses ASCII at bootstrap
...
zipimport uses ASCII encoding instead of cp497 to decode filenames, at
bootstrap, if the codec registry is not ready yet. It is still possible to have
non-ASCII filenames using the Unicode flag (UTF-8 encoding) for file entries in
the ZIP file.
2011-01-22 10:30:29 +00:00
Victor Stinner
07298a1f04
zipimport: remove arbitrary length limit from message formats
...
PyErr_Format() and PyUnicode_FromFormat() are able to allocate the right buffer
size and to catch memory allocation failures.
2010-10-18 22:45:54 +00:00
Victor Stinner
9e40fad193
zipimport: document archive encoding; fix indentation
2010-10-18 22:34:46 +00:00
Victor Stinner
965a8a1c5b
Revert r85699 and r85701 (zipimport): fullname is a module name, not a path
...
UTF-8 is just fine for module names.
2010-10-18 21:44:33 +00:00
Victor Stinner
8c8ed0a799
zipimport: fix "can't find module ..." error message
...
I cannot use %U: fullname is a bytes object, not an unicode object. %A format
cannot be used, it adds 'b' (bytes) prefix. So create cant_find_module()
function to decode the filename and raise the error message.
2010-10-18 21:21:02 +00:00
Victor Stinner
0410656b30
zipimport: find_module(), is_package() and get_source() supports surrogates
...
Use PyUnicode_FSConverter to support surrogates in the full name.
2010-10-18 20:44:08 +00:00
Victor Stinner
269aeb7c0d
zipimport: pass path size to make_filename()
...
Don't hardcode path size in make_filename().
2010-10-18 20:40:59 +00:00
Victor Stinner
2a94f4c0ef
get_code_from_data() uses the filesystem encoding to encode the module path,
...
instead of utf-8.
2010-10-18 12:15:34 +00:00
Victor Stinner
d36c8217e1
zipimport: read_directory() uses cp437 or utf-8 (in strict mode), depending on
...
the unicode flag, to decode the filename, instead of the filesystem encoding.
Use the same choice than the zipfile module.
2010-10-18 12:13:46 +00:00
Victor Stinner
08654e18ee
zipimport: get_module_code() returns modpath as a Unicode object
...
... instead of a char*. Encode the module path to the fileystem encoding
(for PyImport_ExecCodeModuleEx) instead of utf-8.
2010-10-18 12:09:02 +00:00
Victor Stinner
26fabe1369
zipimporter_load_module() doesn't destroy mod on error
...
PyImport_AddModule() returns a borrowed reference. Don't display "import ... #
loaded from Zip ..." on error.
2010-10-18 12:03:25 +00:00
Victor Stinner
72f767e601
zipimport: encode the prefix to the fileystem encoding
2010-10-18 11:44:21 +00:00
Victor Stinner
353349caeb
zipimport, get_module_code(): avoid useless _PyUnicode_AsString()
2010-10-18 11:40:40 +00:00
Victor Stinner
c342fca222
zipimport: fix indentation
2010-10-18 11:39:05 +00:00
Victor Stinner
5a7913eb3b
zipimport: catch _PyUnicode_AsString() failure in get_code_from_data()
...
It occurs if the path contains surrogates.
2010-10-16 11:29:07 +00:00