homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: zipfile.py fails if zlib.so module fails to build.
Type: behavior Stage: resolved
Components: Build Versions: Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Shared modules built with Modules/Setup are not found when run from build directory
View: 17095
Assigned To: Nosy List: Alex.LordThorsen, John.Malmberg, ezio.melotti, ned.deily
Priority: normal Keywords:

Created on 2014年08月16日 21:29 by John.Malmberg, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Messages (3)
msg225417 - (view) Author: John Malmberg (John.Malmberg) * Date: 2014年08月16日 21:29
If the zlib.so fails to build while building python, subsequent runs of setup.py fail, which prevents a trying again to build zlib.so after the issue is fixed unless all the .so modules built are deleted.
 File "/PRJ_ROOT/CPYTHON/Lib/zipfile.py", line 20, in <module>
 crc32 = zlib.crc32
AttributeError: module 'zlib' has no attribute 'crc32'
make: *** [sharedmods] Error 1
zipfile.py is trying to test for a missing zlib.so by checking if the import fails.
The problem is that while the zlib module did not get built, the import of it succeeds because the directory is now in the module path at this
point in the build.
Using -v on Python shows the import succeeding.
Python 3.5.0a0 (default, Aug 13 2014, 19:13:13) [C] on openvms0
Type "help", "copyright", "credits" or "license" for more information.
 >>> import zlib
# possible namespace for /PRJ_ROOT/CPYTHON/Modules/zlib
import 'zlib' # None.
In order to get setup.py to work in this case, the following patch is
needed for zipfile.py
--- /src_root/cpython/Lib/zipfile.py Mon Jun 16 18:00:20 2014
+++ /vms_root/cpython/Lib/zipfile.py Thu Aug 14 20:39:47 2014
@@ -18,7 +18,7 @@
 try:
 import zlib # We may need its compression method
 crc32 = zlib.crc32
-except ImportError:
+except (ImportError, AttributeError):
 zlib = None
 crc32 = binascii.crc32
This is not a complete solution for zlib.so module not building. The run_tests.py also fails when zlib.so is not present.
Setup.py reports that zlib.so is an optional module, so not being build should not cause the setup.py to fail.
msg226544 - (view) Author: Alex LordThorsen (Alex.LordThorsen) * Date: 2014年09月07日 21:03
Just adding that I have also run into this problem.
msg226550 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014年09月08日 00:28
This problem has been introduced by the initial changes for Issue17095. That issue has been re-opened and the resolution will be covered there.
History
Date User Action Args
2022年04月11日 14:58:07adminsetgithub: 66408
2014年09月08日 00:28:28ned.deilysetstatus: open -> closed

superseder: Shared modules built with Modules/Setup are not found when run from build directory

nosy: + ned.deily
messages: + msg226550
resolution: duplicate
stage: needs patch -> resolved
2014年09月07日 21:03:01Alex.LordThorsensetnosy: + Alex.LordThorsen
messages: + msg226544
2014年08月17日 18:15:50ezio.melottisetnosy: + ezio.melotti

type: behavior
stage: needs patch
2014年08月16日 21:29:12John.Malmbergcreate

AltStyle によって変換されたページ (->オリジナル) /