[pypy-svn] r55235 - in pypy/dist/pypy: lib module/sys
fijal at codespeak.net
fijal at codespeak.net
Mon May 26 05:15:00 CEST 2008
Author: fijal
Date: Mon May 26 05:14:57 2008
New Revision: 55235
Modified:
pypy/dist/pypy/lib/imp.py
pypy/dist/pypy/module/sys/__init__.py
pypy/dist/pypy/module/sys/version.py
Log:
A hack to present correct magic number at applevel
Modified: pypy/dist/pypy/lib/imp.py
==============================================================================
--- pypy/dist/pypy/lib/imp.py (original)
+++ pypy/dist/pypy/lib/imp.py Mon May 26 05:14:57 2008
@@ -21,7 +21,8 @@
def get_magic():
"""Return the magic number for .pyc or .pyo files."""
- return 'm\xf2\r\n' # XXX hard-coded: the magic of Python 2.4.1
+ import struct
+ return struct.pack('L', sys._magic())
def get_suffixes():
"""Return a list of (suffix, mode, type) tuples describing the files
Modified: pypy/dist/pypy/module/sys/__init__.py
==============================================================================
--- pypy/dist/pypy/module/sys/__init__.py (original)
+++ pypy/dist/pypy/module/sys/__init__.py Mon May 26 05:14:57 2008
@@ -67,7 +67,9 @@
#'subversion' : added in Python 2.5
'getdefaultencoding' : 'interp_encoding.getdefaultencoding',
- 'setdefaultencoding' : 'interp_encoding.setdefaultencoding',
+ 'setdefaultencoding' : 'interp_encoding.setdefaultencoding',
+ # XXX hack
+ '_magic' : 'version._magic',
}
appleveldefs = {
#'displayhook' : 'app.displayhook',
Modified: pypy/dist/pypy/module/sys/version.py
==============================================================================
--- pypy/dist/pypy/module/sys/version.py (original)
+++ pypy/dist/pypy/module/sys/version.py Mon May 26 05:14:57 2008
@@ -63,6 +63,10 @@
d[ver[3]] << 4 |
subver)
+def _magic(space):
+ from pypy.module.__builtin__.importing import get_pyc_magic
+ return space.wrap(get_pyc_magic(space))
+
def svn_revision():
"Return the last-changed svn revision number."
# NB. we hack the number directly out of the .svn directory to avoid
More information about the Pypy-commit
mailing list