New submission from cary <c...@dropbox.com>:

Similar to how `-OO` currently strips docstrings from compiled bytecode, it 
would be nice if there were a way to strip annotations as well to further 
compact the bytecode.

Attached is my initial attempt. From some simple manual testing, Python with 
this patch applied will generate the same bytecode (verified with `marshal` and 
`dis`) for two files with the same logic, but with annotations manually removed 
from one of them.

This will probably need some new flag/optimization level rather than relying on 
`-OO` (as it would be a breaking change).

Open to initial reviews of the patch and idea in general, and suggestions on 
how to best thread the option through to the module.

----------
components: Interpreter Core
files: strip_annotations.patch
keywords: patch
messages: 339091
nosy: cary
priority: normal
severity: normal
status: open
title: Adding a way to strip annotations from compiled bytecode
type: enhancement
Added file: https://bugs.python.org/file48237/strip_annotations.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36466>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to