[New-bugs-announce] [issue35215] Replacing CPython memory allocation

paul report at bugs.python.org
Mon Nov 12 03:50:08 EST 2018


New submission from paul <paul.harvey at rakuten.com>:

Hi all, 

I am trying to replace the version of malloc/free...etc with my own function suit. I am have issues with loading the initial library setup. 

I am looking for wisdom from the community as to why this may be the case.

Facts:
- i just grabbed the latest cpython repo
- my memory suit seem to be working from independent testing on other code
- i am working on linux
- i went into obmalloc.c and replaced the malloc, free, realloc, calloc with my own functions. 
- i changed the mmap/unmap to use my malloc and free in obmalloc.c
- my allocated produces aligned allocations.
- i dump the exceptions text being generated to see what is happening:
EXCEPTION:: module 'sys' has no attribute '__file__'
EXCEPTION:: type object 'BuiltinImporter' has no attribute '_ORIGIN'
EXCEPTION:: module 'sys' has no attribute '__cached__'
EXCEPTION:: module 'sys' has no attribute '__path__'
EXCEPTION:: module 'builtins' has no attribute '__file__'
EXCEPTION:: type object 'BuiltinImporter' has no attribute '_ORIGIN'
EXCEPTION:: module 'builtins' has no attribute '__cached__'
EXCEPTION:: module 'builtins' has no attribute '__path__'
EXCEPTION:: module '_frozen_importlib' has no attribute '__file__'
EXCEPTION:: type object 'FrozenImporter' has no attribute '_ORIGIN'
EXCEPTION:: module '_frozen_importlib' has no attribute '__cached__'
EXCEPTION:: module '_frozen_importlib' has no attribute '__path__'
EXCEPTION:: module '_imp' has no attribute '__file__'
EXCEPTION:: type object 'BuiltinImporter' has no attribute '_ORIGIN'
EXCEPTION:: module '_imp' has no attribute '__cached__'
EXCEPTION:: module '_imp' has no attribute '__path__'
EXCEPTION:: name '_bootstrap' is not defined
EXCEPTION:: name '_bootstrap' is not defined
EXCEPTION:: name '_bootstrap' is not defined
EXCEPTION:: name '_bootstrap' is not defined
Fatal Python error: initfsencoding: failed to get the Python codec of the filesystem encoding
Traceback (most recent call last):
  File "/home/paul/fresh_cpython/debug/../Lib/encodings/__init__.py", line 31, in <module>
  File "<frozen importlib._bootstrap>", line 989, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 773, in exec_module
  File "<frozen importlib._bootstrap_external>", line 909, in get_code
  File "<frozen importlib._bootstrap_external>", line 966, in get_data
OSError: [Errno 14] Bad address
Aborted

----------
components: Library (Lib)
messages: 329725
nosy: paul.harvey at rakuten.com
priority: normal
severity: normal
status: open
title: Replacing CPython memory allocation
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35215>
_______________________________________


More information about the New-bugs-announce mailing list