Hi David,

your change to pylib introduces a worse bug thats not acceptable

it really should error out in that case,
since it would enforce a partial code reload of the old code or even a wrong code reload for subpackages

-- Ronny


On 06/22/2012 01:05 PM, David Naylor wrote:
Hi,

I'm experimenting with using non-default library directories by tweeking 
pypy.tool.lib_pypy however I came up with the following error
when translating with pypy:

[translation:ERROR] Error:
[translation:ERROR]  Traceback (most recent call last):
[translation:ERROR]    File "translate.py", line 274, in main
[translation:ERROR]     default_goal='compile')
[translation:ERROR]    File 
"/tmp/home/DragonSA/ports/pypy/work/pypy-pypy-341e1e3821ff/pypy/translator/driver.py",
 line 810, in
from_targetspec
[translation:ERROR]     spec = target(driver, args)
[translation:ERROR]    File "targetpypystandalone.py", line 228, in target
[translation:ERROR]     return self.get_entry_point(config)
[translation:ERROR]    File "targetpypystandalone.py", line 236, in 
get_entry_point
[translation:ERROR]     rebuild = 
import_from_lib_pypy('ctypes_config_cache/rebuild')
[translation:ERROR]    File 
"/tmp/home/DragonSA/ports/pypy/work/pypy-pypy-341e1e3821ff/pypy/tool/lib_pypy.py",
 line 12, in
import_from_lib_pypy
[translation:ERROR]     return modname.pyimport()
[translation:ERROR]    File 
"/tmp/home/DragonSA/ports/pypy/work/pypy-pypy-341e1e3821ff/py/_path/local.py", 
line 531, in pyimport
[translation:ERROR]     mod = __import__(modname, None, None, ['__doc__'])
[translation:ERROR]    File 
"/usr/local/pypy-1.9/lib_pypy/ctypes_config_cache/rebuild.py", line 11, 
in<module>
[translation:ERROR]     execfile(autopath_py, dict(__name__='autopath', 
__file__=autopath_py))
[translation:ERROR]  IOError: [Errno 2] No such file or directory: 
'/usr/local/pypy-1.9/pypy/tool/autopath.py'

This error does not happen when translating with python.

Upon investigation I found that pypy has:
# pypy -c 'import sys; import pypy.tool.lib_pypy; print "ctypes_config_cache" 
in sys.modules.keys()'
True

but python has:
# python -c 'import sys; import pypy.tool.lib_pypy; print "ctypes_config_cache" 
in sys.modules.keys()'
False

also:
# pypy -c 'import sys; import pypy.tool.lib_pypy; print 
sys.modules["ctypes_config_cache"]'
<module 'ctypes_config_cache' from 
'/usr/local/pypy-1.9/lib_pypy/ctypes_config_cache/__init__.pyc'>
note the above always happens regardless of pypy.tool.lib_pypy being modified 
or not.

It appears to me that there are two bugs:
1) pypy ends up importing ctypes_config_cache when it shouldn't???
2) py/_path/local.py doesn't ensure import from correct location

And attached is a patch for fixing (2), which works around (1).

Regards



_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to