python / cpython

The Python programming language
https://www.python.org
Other
63.55k stars 30.45k forks source link

Modify co_filename in frozen programs #33234

Closed 8b9e7e07-4219-4888-b494-3b044b438c92 closed 23 years ago

8b9e7e07-4219-4888-b494-3b044b438c92 commented 24 years ago
BPO 401702
Nosy @gvanrossum
Files
  • None: None
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/gvanrossum' closed_at = created_at = labels = [] title = 'Modify co_filename in frozen programs' updated_at = user = 'https://bugs.python.org/lhudson' ``` bugs.python.org fields: ```python activity = actor = 'gvanrossum' assignee = 'gvanrossum' closed = True closed_date = None closer = None components = ['Demos and Tools'] creation = creator = 'lhudson' dependencies = [] files = ['2845'] hgrepos = [] issue_num = 401702 keywords = ['patch'] message_count = 12.0 messages = ['34502', '34503', '34504', '34505', '34506', '34507', '34508', '34509', '34510', '34511', '34512', '34513'] nosy_count = 3.0 nosy_names = ['gvanrossum', 'jhylton', 'lhudson'] pr_nums = [] priority = 'normal' resolution = 'accepted' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue401702' versions = [] ```

    8b9e7e07-4219-4888-b494-3b044b438c92 commented 24 years ago
    gvanrossum commented 24 years ago

    I like the idea, but I have a few suggestions.

    gvanrossum commented 24 years ago

    Thanks for the new patch! I'll assign this to Jeremy for further review and to carry it to completion. (Jeremy, if you're swamped, please find someone else to do it.)

    Re normpath: my mistake -- I meant normcase.

    gvanrossum commented 23 years ago

    I'm taking this, on the assumption that Mark's too busy and freeze is our shared responsibility.

    gvanrossum commented 23 years ago

    No time to review this before the 2.1a1 release; I'll do this for 2.1a2.

    03bde425-37ce-4291-88bd-d6cecc46a30e commented 24 years ago

    This sounds like a reasonable enough feature, but we are in feature freeze for Python 2.0.

    03bde425-37ce-4291-88bd-d6cecc46a30e commented 23 years ago

    (somewhat) randomly reassigned; don't have time to look at this

    8b9e7e07-4219-4888-b494-3b044b438c92 commented 24 years ago

    A new feature for freeze.

    This patch was developed primarily to reduce the size of the frozen binary. It is particularly useful when freezing for 'small' platforms, such as Palm OS, where you really want to save that last miserable byte.

    A limitation of this patch is that it does not provide any feedback about the replacements being made. As the path matching is case-sensitive this may lead to unexpected behaviour for DOS and Windows people, eg > freeze.py -r C:\Python\Lib\=py\ goats.py should probably be: > freeze.py -r c:\python\lib\=py\ goats.py

    8b9e7e07-4219-4888-b494-3b044b438c92 commented 24 years ago

    A recursive code object transformer has been implemented as a member of the ModuleFinder.

    Case sensitivity issue:
    normpath strips trailing '/' or '\\' which reduces the flexibility of the 
    path replacement.  It also does not seem to solve the case-sensitivity problem:
        D:\>python
        Python 2.0 (#8, Oct 17 2000, 15:27:24) [MSC 32 bit (Intel)] on win32
        Type "copyright", "credits" or "license" for more information.
        >>> import os
        >>> os.path.normpath("c:\\python\\lib\\")
        'c:\\python\\lib'
        >>> os.path.normpath("c:\\python\\Lib\\")
        'c:\\python\\Lib'
        >>> 
    ModuleFinder's debugging system is used to report the status of each unique path encountered.

    Temporary file: marshal.dump() and marshal.load() only work with file objects, not file-like objects. Now that new code objects are being created there is no longer any reason to re-marshal so this problem disappears.

    gvanrossum commented 23 years ago

    Logged In: YES user_id=6380

    Shit. Missed the deadline again. Will try before b2... :-(

    gvanrossum commented 23 years ago

    Logged In: YES user_id=6380

    Sure, I see no problem with this patch. I'll see if I can check it in.

    If someone else who likes to hack freeze would have it, please go ahead!

    gvanrossum commented 23 years ago

    Logged In: YES user_id=6380

    Applied. Closing now.