-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Py_Finalize() function, why it does not finalise Python?? #98524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
Thanks kumaraditya303 CPython does have memory leaks, it does not need to be tested with numpy, that was just another sample of memoryt leaks. By just executing:
you get memory leaks. But these days the CPyton "core developers"coalition is committee to close every thread that talks about CPython memory leaks taken any escuse as reason, this time numpy. |
Because memory leaks in legacy code left for older plugins. CPython now confidently transitions from global variables that actually cause memory leaks (because nobody cleaned objects that are supposed to die with the program anyway) to dynamically allocated structures destroyed with a single, simple and thus always presented function call. These structures are "heap types" and "support of multiple interpreters inside the same process". Unfortunately for all of us such a transition is a mess that will be here for a long time until everything involved (both all CPython modules and every third party module) gets converted so nothing uses that legacy code anymore. In the worst case it can be akin to Python 2-to-3 transition lasting for a decade. So this problem is well known (so reports repeating over and over again are closed) and is being steadely resolved, but not as fast as desired. |
It is a known problem and the work is ongoing, if you want to help read https://peps.python.org/pep-0687/ and work on it, creating issues for the same thing over and over is not helpful. |
The following code shows a bug in Py_Finalize(). It does not finalize python interpreter, the second round fires an error.
Thanks in advance to all of those of you that want's a better python
Alexei
Python code (copy it and save it as a .py file)
[Python code]
import numpy as np
The variable <char *pcharPathName> change it to the proper pathname of the python code. Test it
[c]
The 2nd round reports the following:
[ERROR Report]
Traceback (most recent call last):
File "", line 3, in
File "C:\Python\Python311\Lib\site-packages\numpy_init_.py", line 140, in
from . import core
File "C:\Python\Python311\Lib\site-packages\numpy\core_init_.py", line 23, in
from . import multiarray
File "C:\Python\Python311\Lib\site-packages\numpy\core\multiarray.py", line 10, in
from . import overrides
File "C:\Python\Python311\Lib\site-packages\numpy\core\overrides.py", line 6, in
from numpy.core._multiarray_umath import (
SystemError: D:_w\1\s\Objects\structseq.c:476: bad argument to internal function
The text was updated successfully, but these errors were encountered: