mirror of https://github.com/python/cpython
bpo-45482: Rename namespaceobject.h to pycore_namespace.h (GH-28975)
Rename Include/namespaceobject.h to Include/internal/pycore_namespace.h. The _testmultiphase extension is now built with the Py_BUILD_CORE_MODULE macro defined to access _PyNamespace_Type. object.c: remove unused "pycore_context.h" include.
This commit is contained in:
parent
a7f8dfd25a
commit
354c35220d
|
@ -77,7 +77,6 @@
|
||||||
#include "warnings.h"
|
#include "warnings.h"
|
||||||
#include "weakrefobject.h"
|
#include "weakrefobject.h"
|
||||||
#include "structseq.h"
|
#include "structseq.h"
|
||||||
#include "namespaceobject.h"
|
|
||||||
#include "cpython/picklebufobject.h"
|
#include "cpython/picklebufobject.h"
|
||||||
#include "cpython/pytime.h"
|
#include "cpython/pytime.h"
|
||||||
#include "codecs.h"
|
#include "codecs.h"
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Simple namespace object interface
|
||||||
|
|
||||||
|
#ifndef Py_INTERNAL_NAMESPACE_H
|
||||||
|
#define Py_INTERNAL_NAMESPACE_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Py_BUILD_CORE
|
||||||
|
# error "this header requires Py_BUILD_CORE define"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PyAPI_DATA(PyTypeObject) _PyNamespace_Type;
|
||||||
|
|
||||||
|
PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif // !Py_INTERNAL_NAMESPACE_H
|
|
@ -1,19 +0,0 @@
|
||||||
|
|
||||||
/* simple namespace object interface */
|
|
||||||
|
|
||||||
#ifndef NAMESPACEOBJECT_H
|
|
||||||
#define NAMESPACEOBJECT_H
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Py_LIMITED_API
|
|
||||||
PyAPI_DATA(PyTypeObject) _PyNamespace_Type;
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds);
|
|
||||||
#endif /* !Py_LIMITED_API */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !NAMESPACEOBJECT_H */
|
|
|
@ -1151,7 +1151,6 @@ PYTHON_HEADERS= \
|
||||||
$(srcdir)/Include/methodobject.h \
|
$(srcdir)/Include/methodobject.h \
|
||||||
$(srcdir)/Include/modsupport.h \
|
$(srcdir)/Include/modsupport.h \
|
||||||
$(srcdir)/Include/moduleobject.h \
|
$(srcdir)/Include/moduleobject.h \
|
||||||
$(srcdir)/Include/namespaceobject.h \
|
|
||||||
$(srcdir)/Include/object.h \
|
$(srcdir)/Include/object.h \
|
||||||
$(srcdir)/Include/objimpl.h \
|
$(srcdir)/Include/objimpl.h \
|
||||||
$(srcdir)/Include/opcode.h \
|
$(srcdir)/Include/opcode.h \
|
||||||
|
@ -1261,6 +1260,7 @@ PYTHON_HEADERS= \
|
||||||
$(srcdir)/Include/internal/pycore_list.h \
|
$(srcdir)/Include/internal/pycore_list.h \
|
||||||
$(srcdir)/Include/internal/pycore_long.h \
|
$(srcdir)/Include/internal/pycore_long.h \
|
||||||
$(srcdir)/Include/internal/pycore_moduleobject.h \
|
$(srcdir)/Include/internal/pycore_moduleobject.h \
|
||||||
|
$(srcdir)/Include/internal/pycore_namespace.h \
|
||||||
$(srcdir)/Include/internal/pycore_object.h \
|
$(srcdir)/Include/internal/pycore_object.h \
|
||||||
$(srcdir)/Include/internal/pycore_pathconfig.h \
|
$(srcdir)/Include/internal/pycore_pathconfig.h \
|
||||||
$(srcdir)/Include/internal/pycore_pyarena.h \
|
$(srcdir)/Include/internal/pycore_pyarena.h \
|
||||||
|
|
|
@ -1167,8 +1167,8 @@ test_get_type_qualname(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
assert(strcmp(PyUnicode_AsUTF8(tp_qualname), "int") == 0);
|
assert(strcmp(PyUnicode_AsUTF8(tp_qualname), "int") == 0);
|
||||||
Py_DECREF(tp_qualname);
|
Py_DECREF(tp_qualname);
|
||||||
|
|
||||||
tp_qualname = PyType_GetQualName(&_PyNamespace_Type);
|
tp_qualname = PyType_GetQualName(&PyODict_Type);
|
||||||
assert(strcmp(PyUnicode_AsUTF8(tp_qualname), "SimpleNamespace") == 0);
|
assert(strcmp(PyUnicode_AsUTF8(tp_qualname), "OrderedDict") == 0);
|
||||||
Py_DECREF(tp_qualname);
|
Py_DECREF(tp_qualname);
|
||||||
|
|
||||||
PyObject *HeapTypeNameType = PyType_FromSpec(&HeapTypeNameType_Spec);
|
PyObject *HeapTypeNameType = PyType_FromSpec(&HeapTypeNameType_Spec);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "pycore_namespace.h" // _PyNamespace_New()
|
||||||
|
|
||||||
/* State for testing module state access from methods */
|
/* State for testing module state access from methods */
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
|
#include "pycore_namespace.h" // _PyNamespace_New()
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// namespace object implementation
|
// namespace object implementation
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "pycore_namespace.h" // _PyNamespace_Type
|
||||||
#include "structmember.h" // PyMemberDef
|
#include "structmember.h" // PyMemberDef
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_call.h" // _PyObject_CallNoArgs()
|
#include "pycore_call.h" // _PyObject_CallNoArgs()
|
||||||
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
|
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
|
||||||
#include "pycore_context.h"
|
#include "pycore_dict.h" // _PyObject_MakeDictFromInstanceAttributes()
|
||||||
#include "pycore_dict.h"
|
|
||||||
#include "pycore_floatobject.h" // _PyFloat_DebugMallocStats()
|
#include "pycore_floatobject.h" // _PyFloat_DebugMallocStats()
|
||||||
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
|
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
|
||||||
|
#include "pycore_namespace.h" // _PyNamespace_Type
|
||||||
#include "pycore_object.h" // _PyType_CheckConsistency()
|
#include "pycore_object.h" // _PyType_CheckConsistency()
|
||||||
#include "pycore_pyerrors.h" // _PyErr_Occurred()
|
#include "pycore_pyerrors.h" // _PyErr_Occurred()
|
||||||
#include "pycore_pylifecycle.h" // _PyTypes_InitSlotDefs()
|
#include "pycore_pylifecycle.h" // _PyTypes_InitSlotDefs()
|
||||||
|
|
|
@ -202,6 +202,7 @@
|
||||||
<ClInclude Include="..\Include\internal\pycore_list.h" />
|
<ClInclude Include="..\Include\internal\pycore_list.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_long.h" />
|
<ClInclude Include="..\Include\internal\pycore_long.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_moduleobject.h" />
|
<ClInclude Include="..\Include\internal\pycore_moduleobject.h" />
|
||||||
|
<ClInclude Include="..\Include\internal\pycore_namespace.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_object.h" />
|
<ClInclude Include="..\Include\internal\pycore_object.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_pathconfig.h" />
|
<ClInclude Include="..\Include\internal\pycore_pathconfig.h" />
|
||||||
<ClInclude Include="..\Include\internal\pycore_pyarena.h" />
|
<ClInclude Include="..\Include\internal\pycore_pyarena.h" />
|
||||||
|
@ -229,7 +230,6 @@
|
||||||
<ClInclude Include="..\Include\methodobject.h" />
|
<ClInclude Include="..\Include\methodobject.h" />
|
||||||
<ClInclude Include="..\Include\modsupport.h" />
|
<ClInclude Include="..\Include\modsupport.h" />
|
||||||
<ClInclude Include="..\Include\moduleobject.h" />
|
<ClInclude Include="..\Include\moduleobject.h" />
|
||||||
<ClInclude Include="..\Include\namespaceobject.h" />
|
|
||||||
<ClInclude Include="..\Include\object.h" />
|
<ClInclude Include="..\Include\object.h" />
|
||||||
<ClInclude Include="..\Include\objimpl.h" />
|
<ClInclude Include="..\Include\objimpl.h" />
|
||||||
<ClInclude Include="..\Include\opcode.h" />
|
<ClInclude Include="..\Include\opcode.h" />
|
||||||
|
|
|
@ -327,9 +327,6 @@
|
||||||
<ClInclude Include="..\Include\pyhash.h">
|
<ClInclude Include="..\Include\pyhash.h">
|
||||||
<Filter>Include</Filter>
|
<Filter>Include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\Include\namespaceobject.h">
|
|
||||||
<Filter>Include</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\Modules\hashtable.h">
|
<ClInclude Include="..\Modules\hashtable.h">
|
||||||
<Filter>Modules</Filter>
|
<Filter>Modules</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -558,6 +555,9 @@
|
||||||
<ClInclude Include="..\Include\internal\pycore_moduleobject.h">
|
<ClInclude Include="..\Include\internal\pycore_moduleobject.h">
|
||||||
<Filter>Include\internal</Filter>
|
<Filter>Include\internal</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Include\internal\pycore_namespace.h">
|
||||||
|
<Filter>Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\Include\internal\pycore_object.h">
|
<ClInclude Include="..\Include\internal\pycore_object.h">
|
||||||
<Filter>Include\internal</Filter>
|
<Filter>Include\internal</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#include "pycore_import.h" // _PyImport_BootstrapImp()
|
#include "pycore_import.h" // _PyImport_BootstrapImp()
|
||||||
#include "pycore_initconfig.h"
|
#include "pycore_initconfig.h" // _PyStatus_OK()
|
||||||
#include "pycore_pyerrors.h"
|
#include "pycore_interp.h" // _PyInterpreterState_ClearModules()
|
||||||
#include "pycore_pyhash.h"
|
#include "pycore_namespace.h" // _PyNamespace_Type
|
||||||
|
#include "pycore_pyerrors.h" // _PyErr_SetString()
|
||||||
|
#include "pycore_pyhash.h" // _Py_KeyedHash()
|
||||||
#include "pycore_pylifecycle.h"
|
#include "pycore_pylifecycle.h"
|
||||||
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
|
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
|
||||||
#include "pycore_interp.h" // _PyInterpreterState_ClearModules()
|
|
||||||
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
||||||
#include "pycore_sysmodule.h"
|
#include "pycore_sysmodule.h" // _PySys_Audit()
|
||||||
#include "marshal.h"
|
#include "marshal.h" // PyMarshal_ReadObjectFromString()
|
||||||
#include "code.h"
|
#include "importdl.h" // _PyImport_DynLoadFiletab
|
||||||
#include "importdl.h"
|
#include "pydtrace.h" // PyDTrace_IMPORT_FIND_LOAD_START_ENABLED()
|
||||||
#include "pydtrace.h"
|
#include <stdbool.h> // bool
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
|
@ -20,6 +20,7 @@ Data members:
|
||||||
#include "pycore_code.h" // _Py_QuickenedCount
|
#include "pycore_code.h" // _Py_QuickenedCount
|
||||||
#include "pycore_frame.h" // InterpreterFrame
|
#include "pycore_frame.h" // InterpreterFrame
|
||||||
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
|
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
|
||||||
|
#include "pycore_namespace.h" // _PyNamespace_New()
|
||||||
#include "pycore_object.h" // _PyObject_IS_GC()
|
#include "pycore_object.h" // _PyObject_IS_GC()
|
||||||
#include "pycore_pathconfig.h" // _PyPathConfig_ComputeSysPath0()
|
#include "pycore_pathconfig.h" // _PyPathConfig_ComputeSysPath0()
|
||||||
#include "pycore_pyerrors.h" // _PyErr_Fetch()
|
#include "pycore_pyerrors.h" // _PyErr_Fetch()
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -1043,7 +1043,8 @@ class PyBuildExt(build_ext):
|
||||||
self.add(Extension('_testimportmultiple', ['_testimportmultiple.c']))
|
self.add(Extension('_testimportmultiple', ['_testimportmultiple.c']))
|
||||||
|
|
||||||
# Test multi-phase extension module init (PEP 489)
|
# Test multi-phase extension module init (PEP 489)
|
||||||
self.add(Extension('_testmultiphase', ['_testmultiphase.c']))
|
self.add(Extension('_testmultiphase', ['_testmultiphase.c'],
|
||||||
|
extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
|
||||||
|
|
||||||
# Fuzz tests.
|
# Fuzz tests.
|
||||||
self.add(Extension('_xxtestfuzz',
|
self.add(Extension('_xxtestfuzz',
|
||||||
|
|
Loading…
Reference in New Issue