Opened 4 years ago
Closed 4 years ago
#4841 closed defect (fixed)
Atomic molc.cpp uses deprecated Python 3.9 calls
Reported by: | Tom Goddard | Owned by: | pett |
---|---|---|---|
Priority: | moderate | Milestone: | |
Component: | Structure Analysis | Version: | |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
make install
../../../ChimeraX.app/Contents/bin/ChimeraX --nogui --safemode --exit --cmd "devel install . user false exit true "
Executing: devel install . user false exit true
Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules winreg, win32api or win32con are installed.
C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g
compile options: '-std=c++11 -stdlib=libc++ -DDYNAMIC_LIBRARY=1 -I/Users/goddard/ucsf/chimerax/src/bundles/atomic/../../../ChimeraX.app/Contents/include -I/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include -I/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/chimerax/atomic_lib/include -I/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/chimerax/arrays/include -I/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c'
gcc: atomic_cpp/molc.cpp
atomic_cpp/molc.cpp:832:37: warning: 'PyEval_CallObjectWithKeywords' is deprecated
[-Wdeprecated-declarations]
if (disable) Py_XDECREF(PyEval_CallObject(disable, NULL));
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/ceval.h:24:5: note:
expanded from macro 'PyEval_CallObject'
PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/ceval.h:17:1: note:
'PyEval_CallObjectWithKeywords' has been explicitly marked deprecated here
Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note:
expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) attribute((deprecated))
atomic_cpp/molc.cpp:851:36: warning: 'PyEval_CallObjectWithKeywords' is deprecated
[-Wdeprecated-declarations]
if (enable) Py_XDECREF(PyEval_CallObject(enable, NULL));
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/ceval.h:24:5: note:
expanded from macro 'PyEval_CallObject'
PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/ceval.h:17:1: note:
'PyEval_CallObjectWithKeywords' has been explicitly marked deprecated here
Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note:
expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) attribute((deprecated))
atomic_cpp/molc.cpp:2750:25: warning: '_PyUnicode_get_wstr_length' is deprecated
[-Wdeprecated-declarations]
auto size = PyUnicode_GET_DATA_SIZE(py_ic);
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:268:6: note:
expanded from macro 'PyUnicode_GET_DATA_SIZE'
(PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:261:7: note:
expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op) : \
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note:
expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note:
'_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note:
expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) attribute((deprecated))
atomic_cpp/molc.cpp:2750:25: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
auto size = PyUnicode_GET_DATA_SIZE(py_ic);
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:268:6: note:
expanded from macro 'PyUnicode_GET_DATA_SIZE'
(PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:262:14: note:
expanded from macro 'PyUnicode_GET_SIZE'
((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note:
'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note:
expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) attribute((deprecated))
atomic_cpp/molc.cpp:2750:25: warning: '_PyUnicode_get_wstr_length' is deprecated
[-Wdeprecated-declarations]
auto size = PyUnicode_GET_DATA_SIZE(py_ic);
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:268:6: note:
expanded from macro 'PyUnicode_GET_DATA_SIZE'
(PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:264:8: note:
expanded from macro 'PyUnicode_GET_SIZE'
PyUnicode_WSTR_LENGTH(op)))
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note:
expanded from macro 'PyUnicode_WSTR_LENGTH'
#define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note:
'_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note:
expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) attribute((deprecated))
atomic_cpp/molc.cpp:2757:23: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
val = PyUnicode_AS_DATA(py_ic)[0];
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:283:21: note:
expanded from macro 'PyUnicode_AS_DATA'
((const char *)(PyUnicode_AS_UNICODE(op)))
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:279:7: note:
expanded from macro 'PyUnicode_AS_UNICODE'
PyUnicode_AsUnicode(_PyObject_CAST(op)))
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note:
'PyUnicode_AsUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note:
expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) attribute((deprecated))
6 warnings generated.
Attachments (1)
Change History (6)
comment:1 by , 4 years ago
Cc: | removed |
---|---|
Owner: | changed from | to
comment:2 by , 4 years ago
Status: | assigned → accepted |
---|
Well, PyEval_CallObject was certainly documented when I used it. It's not like I go looking for internal Python APIs to use! Nonetheless, I will fix it.
follow-up: 3 comment:3 by , 4 years ago
Not sure PyEval_CallObject was ever documented, but it does appear in programming examples.
comment:4 by , 4 years ago
I want to replace PyEval_CallObject() with PyObject_CallNoArgs(), which isn't available until 3.9 -- so when we go to 3.9 I will apply the attached patch.
by , 4 years ago
comment:5 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
The molc.cpp code is using
PyEval_CallObject()
PyUnicode_GET_DATA_SIZE()
PyUnicode_AS_DATA()
The first PyEval_CallObject() is not a documented API and this Python issue https://bugs.python.org/issue29548 says to use PyObject_Call(). The second two calls were deprecated in Python 3.3.
Eric added all these for insertion code and idatm methods so he can fix them.