Commit Graph

100 Commits

Author SHA1 Message Date
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
Victor Stinner 028dd97dfb Issue #9425: zipimporter_repr() uses unicode 2010-08-17 00:04:48 +00:00
Victor Stinner 60fe8d902d Issue #9425: get_data() uses an unicode path 2010-08-16 23:48:11 +00:00
Victor Stinner 2460a43a65 Issue #9425: read_directory() is fully unicode compliant
zipimport is now able to load a module with an unencodable filename.
2010-08-16 17:54:28 +00:00
Victor Stinner 2b8dab7050 Issue #9425: zipimporter_init() is fully unicode compliant 2010-08-14 14:54:10 +00:00
Brian Curtin 823de00286 Merged revisions 83009 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83009 | brian.curtin | 2010-07-20 20:44:19 -0500 (Tue, 20 Jul 2010) | 2 lines

  Fix #9316. if/is grammar corrections.
........
2010-07-21 01:46:44 +00:00
Brian Curtin 3283973949 Fix #9316. if/is grammar corrections. 2010-07-21 01:44:19 +00:00
Antoine Pitrou 7f14f0d8a0 Recorded merge of revisions 81032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines

  Recorded merge of revisions 81029 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

    Untabify C files. Will watch buildbots.
  ........
................
2010-05-09 16:14:21 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Victor Stinner 38c36f8576 Merged revisions 78875 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r78875 | victor.stinner | 2010-03-12 18:00:41 +0100 (ven., 12 mars 2010) | 5 lines

  Issue #6697: use %U format instead of _PyUnicode_AsString(), because
  _PyUnicode_AsString() was not checked for error (NULL).

  The unicode string is no more truncated to 200 or 400 *bytes*.
........
2010-03-21 21:05:53 +00:00
Victor Stinner 3f1af5c42e Issue #6697: use %U format instead of _PyUnicode_AsString(), because
_PyUnicode_AsString() was not checked for error (NULL).

The unicode string is no more truncated to 200 or 400 *bytes*.
2010-03-12 17:00:41 +00:00
Georg Brandl 7f8ed815db Fix a warning. 2009-05-17 08:20:45 +00:00