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: Module not callable in script_helper.py
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Claudiu.Popa, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2014-06-15 09:18 by Claudiu.Popa, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
script_helper_fix.patch Claudiu.Popa, 2014-06-15 09:18 review
Messages (3)
msg220622 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2014-06-15 09:18
Using make_zip_pkg from script_helper with compiled=True will lead to the following failure:

Traceback (most recent call last):
  File "D:\Projects\cpython\lib\test\test_cmd_line_script.py", line 305, in test_module_in_subpackage_in_zipfile
    zip_name, run_name = _make_test_zip_pkg(script_dir, 'test_zip', 'test_pkg', 'script', depth=2)
  File "D:\Projects\cpython\lib\test\test_cmd_line_script.py", line 86, in _make_test_zip_pkg
    source, depth, compiled=True)
  File "D:\Projects\cpython\lib\test\script_helper.py", line 158, in make_zip_pkg
    init_name = py_compile(init_name, doraise=True)
TypeError: 'module' object is not callable

The attached patch fixes this.
msg221125 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-06-20 21:49
New changeset 108a23d02b84 by Terry Jan Reedy in branch '3.4':
Issue #21770: Call function instead of module. Patch by Claudiu Popa.
http://hg.python.org/cpython/rev/108a23d02b84
msg221127 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-06-20 22:06
It took me a few minutes to realized that you patched test_cmd_line_script.py to get the failure. When I did that, both 
 test_module_in_package_in_zipfile and
 test_module_in_subpackage_in_zipfile
failed with TypeError in the call to _make_test_zip_pkg.

After reverting test_cmd_line_script.py, importing your patch, and re-patching test_cmd_line_script.py, both methods still fail, but only later in the _check_script call. This means that the earlier call succeeded.

2.7 did not need patching because in the same spot, script_helper.make_zip_pkg calls the following dubious function instead of directly calling py_compile(.compile). Someone should have copied the first line of the body instead re-typing it.

def compile_script(script_name):
    py_compile.compile(script_name, doraise=True)
    if __debug__:
        compiled_name = script_name + 'c'
    else:
        compiled_name = script_name + 'o'
    return compiled_name
History
Date User Action Args
2022-04-11 14:58:04adminsetgithub: 65969
2014-06-20 22:06:02terry.reedysetstatus: open -> closed

type: behavior
assignee: terry.reedy
versions: + Python 3.4
nosy: + terry.reedy

messages: + msg221127
resolution: fixed
stage: resolved
2014-06-20 21:49:50python-devsetnosy: + python-dev
messages: + msg221125
2014-06-15 09:18:06Claudiu.Popacreate