Bug 531082 - RFE: add detection of Python 3 bytecode
RFE: add detection of Python 3 bytecode
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: file (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Daniel Novotny
Fedora Extras Quality Assurance
:
Depends On:
Blocks: Python3F13 809898
  Show dependency treegraph
 
Reported: 2009-10-26 16:14 EDT by Dave Malcolm
Modified: 2012-04-04 11:49 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 557608 809898 (view as bug list)
Environment:
Last Closed: 2009-10-27 08:51:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Add bytecode values for Python 3.0 and 3.1 (1.04 KB, patch)
2009-10-26 16:14 EDT, Dave Malcolm
no flags Details | Diff

  None (edit)
Description Dave Malcolm 2009-10-26 16:14:20 EDT
Created attachment 366152 [details]
Add bytecode values for Python 3.0 and 3.1

Description of problem:
Attached is a patch that adds support for Python 3.0 and Python 3.1 bytecode files to the .pyc/.pyo support.

With this file:
$ file /usr/lib/python3.1/re.pyo
/usr/lib/python3.1/re.pyo: python 3.1 byte-compiled

Caveat: only tested with 3.1; I calculated up the value for 3.0 from the source in python's py3k branch's Python/import.c:
[snip]
       Python 3.0a5: 3130 (lexical exception stacking, including POP_EXCEPT)
[snip]
       Python 3.1a0: 3150 (optimize conditional branches:
			   introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE)
[snip]

Note that the value has 1 added to it in py3k's _PyImport_Init,
giving:
  python 3.0: magic=3131 = 0x0c3b (hex) =  0x3b 0x0c 0xc0 0xd0a (header)
and 
  python 3.1: magic=3151 = 0x0c4f (hex) =  0x4f 0x0c 0x0d 0x0a (header)
Comment 1 Dave Malcolm 2009-10-26 16:17:38 EDT
>  python 3.0: magic=3131 = 0x0c3b (hex) =  0x3b 0x0c 0xc0 0xd0a (header)
should read:
>  python 3.0: magic=3131 = 0x0c3b (hex) =  0x3b 0x0c 0xc0 0x0a (header)
Comment 2 Dave Malcolm 2009-10-26 16:50:27 EDT
I've sent the patch to the upstream mailing list (file@mx.gw.com), but it's current stuck in the moderator queue as I'm not yet subscribed (they seem to require human intervention for approving subscriptions)
Comment 3 Daniel Novotny 2009-10-27 08:51:03 EDT
hello Dave, thanks for the patch, added in file-5.03-11.fc13

I am subscribed to the list, so if your post doesn't show up there I can send the patch from my address.
Comment 4 Daniel Novotny 2009-10-27 10:04:57 EDT
...now I see your mail in the upstream mailing list
Comment 5 Dave Malcolm 2009-10-27 10:15:00 EDT
(In reply to comment #4)
> ...now I see your mail in the upstream mailing list  
http://mx.gw.com/pipermail/file/2009/000483.html

Note You need to log in before you can comment on or make changes to this bug.