New submission from Larry Hastings:
So here's a strange one.
I want to do some mysterious experiments with CPython. So I disabled refcount
changes in CPython.
I changed Py_INCR and Py_DECR so they expand to nothing. I had to change some
other macros to match (SETREF, XSETREF, and the Py_RETURN_* ones) to fix some
compiler errors and warnings. Also, to prevent the str object from making
in-place edits, I changed _Py_NewReference so that the initial reference count
for all objects is 2.
CPython builds, then gets to the "generate-posix-vars" step and fails with this
output:
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Fatal Python error: Py_Initialize: Unable to get the locale encoding
Traceback (most recent call last):
File "<frozen importlib._bootstrap_external>", line 1078, in
_path_importer_cache
KeyError: '/usr/local/lib/python36.zip'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 979, in _find_and_load
File "<frozen importlib._bootstrap>", line 964, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 903, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1137, in find_spec
File "<frozen importlib._bootstrap_external>", line 1108, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1080, in
_path_importer_cache
File "<frozen importlib._bootstrap_external>", line 1056, in _path_hooks
File "<frozen importlib._bootstrap_external>", line 1302, in
path_hook_for_FileFinder
File "<frozen importlib._bootstrap_external>", line 96, in _path_isdir
File "<frozen importlib._bootstrap_external>", line 81, in _path_is_mode_type
File "<frozen importlib._bootstrap_external>", line 75, in _path_stat
AttributeError: module 'posix' has no attribute 'stat'
Aborted (core dumped)
generate-posix-vars failed
Makefile:598: recipe for target 'pybuilddir.txt' failed
make: *** [pybuilddir.txt] Error 1
I'm stumped. Why should CPython be dependent on reference counts actually
changing? I figured I'd just leak memory like crazy, not change behavior.
Attached is my patch against current trunk (1ceb91974dc4) in case you want to
try it yourself. Testing was done on Ubuntu 15.10 64-bit, gcc 5.2.1.
----------
components: Interpreter Core
files: larry.turn.off.refcounts.1.diff.txt
messages: 264541
nosy: brett.cannon, larry
priority: low
severity: normal
stage: needs patch
status: open
title: CPython doesn't work when you disable refcounting
type: behavior
Added file: http://bugs.python.org/file42660/larry.turn.off.refcounts.1.diff.txt
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26891>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com