Commit Graph

35 Commits

Author SHA1 Message Date
Benjamin Peterson f387e96768 remove tests for #19081 2014-02-16 14:48:26 -05:00
Benjamin Peterson e9aab0fb98 backout #19081 to fix #20621 2014-02-16 14:20:14 -05:00
Gregory P. Smith 9ca520a09c Remove unneeded use of globals() and locals() in test on imports
introduced with the issue19081 tests.
2014-01-28 00:29:46 -08:00
Gregory P. Smith 1a47955255 Refactor the new test for issue19081 to exec import statements into a
test_ns dict instead of the actual globals() and locals().  Suggested
after review by Thomas Wouters.
2014-01-27 22:06:51 -08:00
Gregory P. Smith 027ab39014 Issue #19081: Remove the zipimporter.files reference as the zip TOC
caches are module global in the zip_directory_cache. When it is
updated due to a changed zip file, all zipimporter instances need to
see the same updates TOC cache.  This fixes the bug for the overlooked
submodule import case from the earlier round of changes.  Includes
tests that would fail otherwise.

It also refactors zipimporter_init in the process to make it a bit
easier to read and understand.  Less reuse of the same variable for
multiple purposes and the local path buffer is malloc'ed instead
of consuming a large MAXPATHLEN+2 chunk stack space.
2014-01-27 00:15:10 -08:00
Gregory P. Smith f5dee4ddbd normalize whitespace from prior issue19081 fix commit. 2014-01-06 09:51:32 -08:00
Gregory P. Smith b48c5d5107 Fixes issue19081: When a zipimport .zip file in sys.path being imported
from is modified during the lifetime of the Python process after
zipimport has already opened and cached the zip's table of contents
it now fstat's the file after opening it upon every attempt to access
anything within and will re-read the table of contents if the .zip file
inode, size or mtime have changed.

It would've been nicer to hold any .zip file used by zipimport open for the
duration of the process but that would be more invasive and add an additional
open file descriptor to all zipimport using processes.  It also would likely
not fix the problem on Windows due to different filesystem semantics.
2014-01-06 09:46:46 -08:00
Zachary Ware 1f70221b86 Issue #19572: More silently skipped tests explicitly skipped. 2013-12-10 14:09:20 -06:00
Victor Stinner f58f1c33c1 Issue #12124: zipimport doesn't keep a reference to zlib.decompress() anymore
to be able to unload the module.
2011-05-21 02:13:22 +02:00
Ezio Melotti 2623a37852 Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line

  #9424: Replace deprecated assert* methods in the Python test suite.
........
2010-11-21 13:34:58 +00:00
Georg Brandl d10d8ee2a1 Fix various missing import/unbound name errors. 2010-02-06 23:18:00 +00:00
Ezio Melotti aa98058cc4 use assert[Not]In where appropriate 2010-01-23 23:04:36 +00:00
Ezio Melotti 1036a7f7e1 #6026 - fix tests that failed without zlib 2009-09-12 14:43:43 +00:00
Benjamin Peterson 5c8da86f3a convert usage of fail* to assert* 2009-06-30 22:57:08 +00:00
Nick Coghlan 0194f5bc98 Issue #4512 closeout: Make ZipImport.get_filename() a public method 2009-02-08 03:17:00 +00:00
Nick Coghlan a2053475bb Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details. 2008-12-14 10:54:50 +00:00
Georg Brandl 6a57c08dc8 #1326: document and test zipimporter.archive and zipimporter.prefix. 2008-05-11 15:05:13 +00:00
Georg Brandl e260ba2d33 #1325: Add docs and tests for zipimporter.archive and zipimporter.prefix. 2008-01-06 16:49:50 +00:00
Tim Peters 413c9226d2 Whitespace normalization. 2006-04-11 01:44:26 +00:00
Phillip J. Eby 4703211080 Updated the warnings, linecache, inspect, traceback, site, and doctest modules
to work correctly with modules imported from zipfiles or via other PEP 302
__loader__ objects.  Tests and doc updates are included.
2006-04-11 01:07:43 +00:00
Tim Peters 68f2d000e9 Repaired new test failures on Windows:
- The path separator isn't "/" on Windows.

- Leaving behind a read-only file causes cascades
  of bogus failures on Windows.
2006-01-23 22:19:24 +00:00
Tim Peters bc29c1a4cc Whitespace normalization. 2006-01-23 21:28:42 +00:00
Neal Norwitz dbc95f4222 Disable this test until I can test on big-endian machines and get passing 2006-01-23 08:48:03 +00:00
Neal Norwitz b155b62f54 Test zipimporter a bit more. Also get working with -R :: option for finding ref leaks 2006-01-23 07:52:13 +00:00
Just van Rossum 5949854200 Fix for [ 765456 ]: testAFakeZlib failed on platforms that use a
statically linked zlib module, but since the problem it tests can't
exist on these systems, simply skip it then. Will backport.
2003-11-18 23:00:55 +00:00
Thomas Heller 354e3d90d3 Change the zipimport implementation to accept files containing
arbitrary bytes before the actual zip compatible archive.  Zipfiles
containing comments at the end of the file are still not supported.

Add a testcase to test_zipimport, and update NEWS.

This closes sf #775637 and sf #669036.
2003-07-22 18:10:15 +00:00
Martin v. Löwis a94568a753 Patch #734231: Update RiscOS support. In particular, correct
riscospath.extsep, and use os.extsep throughout.
2003-05-10 07:36:56 +00:00
Walter Dörwald 21d3a32b99 Combine the functionality of test_support.run_unittest()
and test_support.run_classtests() into run_unittest()
and use it wherever possible.

Also don't use "from test.test_support import ...", but
"from test import test_support" in a few spots.

From SF patch #662807.
2003-05-01 17:45:56 +00:00
Tim Peters f2715e0764 Whitespace normalization. 2003-02-19 02:35:07 +00:00
Neal Norwitz 5c1ba53f8c Use correct function name to PyArg_ParseTuple("is_package").
Fix off-by-1 error in normalize_line_endings():
  when *p == '\0' the NUL was copied into q and q was auto-incremented,
  the loop was broken out of,
  then a newline was appended followed by a NUL.
  So the function, in effect, was strcpy() but added two extra chars
  which was caught by obmalloc in debug mode, since there was only
  room for 1 additional newline.

Get test working under regrtest (added test_main).
2003-02-17 18:05:20 +00:00
Just van Rossum 6706c4d5fd cleaned up Jack's Mac OS9 changes 2003-01-09 22:27:10 +00:00
Jack Jansen 472e7db5c0 Various tweaks to make the test work on the Mac. 2003-01-08 16:37:03 +00:00
Just van Rossum 9a3129c148 Fix for bug #661136
Lesson learned: kids should not be allowed to use API's starting
with an underscore :-/
zipimport in 2.3a1 is even more broken than I thought: I attemped
to _PyString_Resize a string created by PyString_FromStringAndSize,
which fails for strings with length 0 or 1 since the latter returns
an interned string in those cases. This would cause a SystemError
with empty source files (and no matching pyc) in the zip archive.
I rewrote the offending code to simply allocate a new buffer and
avoid _PyString_Resize altogether.
Added a test that would've caught the problem.
2003-01-03 11:18:56 +00:00
Just van Rossum d35c6db526 Ugh, zipimport is virtually broken in 2.3a1 :-( It worked by accident in
the test set as it only tested with a zip archive in the current directory,
but it doesn't work at all for packages when the zip archive was specified
as an absolute path. It's a real embarrassing bug: a strchr call should
have been strrchr; fever apparently implies dyslexia.

Second stupid bug: the zipimport test failed with a name error
__importer__ (which I had renamed to __loader__ everywhere but here).
I would've sworn I ran the test after that change but that can't be true.
What I don't understand that noone reported a failing test_zipimport.py
before the release of 2.3a1.
2003-01-02 12:55:48 +00:00
Just van Rossum 52e14d640b PEP 302 + zipimport:
- new import hooks in import.c, exposed in the sys module
- new module called 'zipimport'
- various changes to allow bootstrapping from zip files

I hope I didn't break the Windows build (or anything else for that
matter), but then again, it's been sitting on sf long enough...

Regarding the latest discussions on python-dev: zipimport sets
pkg.__path__ as specified in PEP 273, and likewise, sys.path item such as
/path/to/Archive.zip/subdir/ are supported again.
2002-12-30 22:08:05 +00:00