mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-141376: Fix exported symbols (GH-141377)
* gh-141376: Fix exported symbols * _io module: add "_Py_" prefix to "spec" variables. For example, rename bufferedrandom_spec to _Py_bufferedrandom_spec. * typevarobject.c: add "static" to "spec" and "slots" variables. * import.c: add "static" to "pkgcontext" variable. * No longer export textiowrapper_slots
This commit is contained in:
parent
92741c59f8
commit
8435a2278f
11 changed files with 55 additions and 55 deletions
|
|
@ -681,40 +681,40 @@ iomodule_exec(PyObject *m)
|
|||
}
|
||||
|
||||
// Base classes
|
||||
ADD_TYPE(m, state->PyIncrementalNewlineDecoder_Type, &nldecoder_spec, NULL);
|
||||
ADD_TYPE(m, state->PyBytesIOBuffer_Type, &bytesiobuf_spec, NULL);
|
||||
ADD_TYPE(m, state->PyIOBase_Type, &iobase_spec, NULL);
|
||||
ADD_TYPE(m, state->PyIncrementalNewlineDecoder_Type, &_Py_nldecoder_spec, NULL);
|
||||
ADD_TYPE(m, state->PyBytesIOBuffer_Type, &_Py_bytesiobuf_spec, NULL);
|
||||
ADD_TYPE(m, state->PyIOBase_Type, &_Py_iobase_spec, NULL);
|
||||
|
||||
// PyIOBase_Type subclasses
|
||||
ADD_TYPE(m, state->PyTextIOBase_Type, &textiobase_spec,
|
||||
ADD_TYPE(m, state->PyTextIOBase_Type, &_Py_textiobase_spec,
|
||||
state->PyIOBase_Type);
|
||||
ADD_TYPE(m, state->PyBufferedIOBase_Type, &bufferediobase_spec,
|
||||
ADD_TYPE(m, state->PyBufferedIOBase_Type, &_Py_bufferediobase_spec,
|
||||
state->PyIOBase_Type);
|
||||
ADD_TYPE(m, state->PyRawIOBase_Type, &rawiobase_spec,
|
||||
ADD_TYPE(m, state->PyRawIOBase_Type, &_Py_rawiobase_spec,
|
||||
state->PyIOBase_Type);
|
||||
|
||||
// PyBufferedIOBase_Type(PyIOBase_Type) subclasses
|
||||
ADD_TYPE(m, state->PyBytesIO_Type, &bytesio_spec, state->PyBufferedIOBase_Type);
|
||||
ADD_TYPE(m, state->PyBufferedWriter_Type, &bufferedwriter_spec,
|
||||
ADD_TYPE(m, state->PyBytesIO_Type, &_Py_bytesio_spec, state->PyBufferedIOBase_Type);
|
||||
ADD_TYPE(m, state->PyBufferedWriter_Type, &_Py_bufferedwriter_spec,
|
||||
state->PyBufferedIOBase_Type);
|
||||
ADD_TYPE(m, state->PyBufferedReader_Type, &bufferedreader_spec,
|
||||
ADD_TYPE(m, state->PyBufferedReader_Type, &_Py_bufferedreader_spec,
|
||||
state->PyBufferedIOBase_Type);
|
||||
ADD_TYPE(m, state->PyBufferedRWPair_Type, &bufferedrwpair_spec,
|
||||
ADD_TYPE(m, state->PyBufferedRWPair_Type, &_Py_bufferedrwpair_spec,
|
||||
state->PyBufferedIOBase_Type);
|
||||
ADD_TYPE(m, state->PyBufferedRandom_Type, &bufferedrandom_spec,
|
||||
ADD_TYPE(m, state->PyBufferedRandom_Type, &_Py_bufferedrandom_spec,
|
||||
state->PyBufferedIOBase_Type);
|
||||
|
||||
// PyRawIOBase_Type(PyIOBase_Type) subclasses
|
||||
ADD_TYPE(m, state->PyFileIO_Type, &fileio_spec, state->PyRawIOBase_Type);
|
||||
ADD_TYPE(m, state->PyFileIO_Type, &_Py_fileio_spec, state->PyRawIOBase_Type);
|
||||
|
||||
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||
ADD_TYPE(m, state->PyWindowsConsoleIO_Type, &winconsoleio_spec,
|
||||
ADD_TYPE(m, state->PyWindowsConsoleIO_Type, &_Py_winconsoleio_spec,
|
||||
state->PyRawIOBase_Type);
|
||||
#endif
|
||||
|
||||
// PyTextIOBase_Type(PyIOBase_Type) subclasses
|
||||
ADD_TYPE(m, state->PyStringIO_Type, &stringio_spec, state->PyTextIOBase_Type);
|
||||
ADD_TYPE(m, state->PyTextIOWrapper_Type, &textiowrapper_spec,
|
||||
ADD_TYPE(m, state->PyStringIO_Type, &_Py_stringio_spec, state->PyTextIOBase_Type);
|
||||
ADD_TYPE(m, state->PyTextIOWrapper_Type, &_Py_textiowrapper_spec,
|
||||
state->PyTextIOBase_Type);
|
||||
|
||||
#undef ADD_TYPE
|
||||
|
|
|
|||
|
|
@ -9,23 +9,23 @@
|
|||
#include "structmember.h"
|
||||
|
||||
/* Type specs */
|
||||
extern PyType_Spec bufferediobase_spec;
|
||||
extern PyType_Spec bufferedrandom_spec;
|
||||
extern PyType_Spec bufferedreader_spec;
|
||||
extern PyType_Spec bufferedrwpair_spec;
|
||||
extern PyType_Spec bufferedwriter_spec;
|
||||
extern PyType_Spec bytesio_spec;
|
||||
extern PyType_Spec bytesiobuf_spec;
|
||||
extern PyType_Spec fileio_spec;
|
||||
extern PyType_Spec iobase_spec;
|
||||
extern PyType_Spec nldecoder_spec;
|
||||
extern PyType_Spec rawiobase_spec;
|
||||
extern PyType_Spec stringio_spec;
|
||||
extern PyType_Spec textiobase_spec;
|
||||
extern PyType_Spec textiowrapper_spec;
|
||||
extern PyType_Spec _Py_bufferediobase_spec;
|
||||
extern PyType_Spec _Py_bufferedrandom_spec;
|
||||
extern PyType_Spec _Py_bufferedreader_spec;
|
||||
extern PyType_Spec _Py_bufferedrwpair_spec;
|
||||
extern PyType_Spec _Py_bufferedwriter_spec;
|
||||
extern PyType_Spec _Py_bytesio_spec;
|
||||
extern PyType_Spec _Py_bytesiobuf_spec;
|
||||
extern PyType_Spec _Py_fileio_spec;
|
||||
extern PyType_Spec _Py_iobase_spec;
|
||||
extern PyType_Spec _Py_nldecoder_spec;
|
||||
extern PyType_Spec _Py_rawiobase_spec;
|
||||
extern PyType_Spec _Py_stringio_spec;
|
||||
extern PyType_Spec _Py_textiobase_spec;
|
||||
extern PyType_Spec _Py_textiowrapper_spec;
|
||||
|
||||
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||
extern PyType_Spec winconsoleio_spec;
|
||||
extern PyType_Spec _Py_winconsoleio_spec;
|
||||
#endif
|
||||
|
||||
/* These functions are used as METH_NOARGS methods, are normally called
|
||||
|
|
|
|||
|
|
@ -2537,7 +2537,7 @@ static PyType_Slot bufferediobase_slots[] = {
|
|||
};
|
||||
|
||||
/* Do not set Py_TPFLAGS_HAVE_GC so that tp_traverse and tp_clear are inherited */
|
||||
PyType_Spec bufferediobase_spec = {
|
||||
PyType_Spec _Py_bufferediobase_spec = {
|
||||
.name = "_io._BufferedIOBase",
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
|
||||
Py_TPFLAGS_IMMUTABLETYPE),
|
||||
|
|
@ -2600,7 +2600,7 @@ static PyType_Slot bufferedreader_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec bufferedreader_spec = {
|
||||
PyType_Spec _Py_bufferedreader_spec = {
|
||||
.name = "_io.BufferedReader",
|
||||
.basicsize = sizeof(buffered),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
@ -2658,7 +2658,7 @@ static PyType_Slot bufferedwriter_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec bufferedwriter_spec = {
|
||||
PyType_Spec _Py_bufferedwriter_spec = {
|
||||
.name = "_io.BufferedWriter",
|
||||
.basicsize = sizeof(buffered),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
@ -2708,7 +2708,7 @@ static PyType_Slot bufferedrwpair_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec bufferedrwpair_spec = {
|
||||
PyType_Spec _Py_bufferedrwpair_spec = {
|
||||
.name = "_io.BufferedRWPair",
|
||||
.basicsize = sizeof(rwpair),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
@ -2776,7 +2776,7 @@ static PyType_Slot bufferedrandom_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec bufferedrandom_spec = {
|
||||
PyType_Spec _Py_bufferedrandom_spec = {
|
||||
.name = "_io.BufferedRandom",
|
||||
.basicsize = sizeof(buffered),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
|
|||
|
|
@ -1156,7 +1156,7 @@ static PyType_Slot bytesio_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec bytesio_spec = {
|
||||
PyType_Spec _Py_bytesio_spec = {
|
||||
.name = "_io.BytesIO",
|
||||
.basicsize = sizeof(bytesio),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
@ -1246,7 +1246,7 @@ static PyType_Slot bytesiobuf_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec bytesiobuf_spec = {
|
||||
PyType_Spec _Py_bytesiobuf_spec = {
|
||||
.name = "_io._BytesIOBuffer",
|
||||
.basicsize = sizeof(bytesiobuf),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
|
|||
|
|
@ -1329,7 +1329,7 @@ static PyType_Slot fileio_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec fileio_spec = {
|
||||
PyType_Spec _Py_fileio_spec = {
|
||||
.name = "_io.FileIO",
|
||||
.basicsize = sizeof(fileio),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
|
|||
|
|
@ -885,7 +885,7 @@ static PyType_Slot iobase_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec iobase_spec = {
|
||||
PyType_Spec _Py_iobase_spec = {
|
||||
.name = "_io._IOBase",
|
||||
.basicsize = sizeof(iobase),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
@ -1046,7 +1046,7 @@ static PyType_Slot rawiobase_slots[] = {
|
|||
};
|
||||
|
||||
/* Do not set Py_TPFLAGS_HAVE_GC so that tp_traverse and tp_clear are inherited */
|
||||
PyType_Spec rawiobase_spec = {
|
||||
PyType_Spec _Py_rawiobase_spec = {
|
||||
.name = "_io._RawIOBase",
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
|
||||
Py_TPFLAGS_IMMUTABLETYPE),
|
||||
|
|
|
|||
|
|
@ -1094,7 +1094,7 @@ static PyType_Slot stringio_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec stringio_spec = {
|
||||
PyType_Spec _Py_stringio_spec = {
|
||||
.name = "_io.StringIO",
|
||||
.basicsize = sizeof(stringio),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ static PyType_Slot textiobase_slots[] = {
|
|||
};
|
||||
|
||||
/* Do not set Py_TPFLAGS_HAVE_GC so that tp_traverse and tp_clear are inherited */
|
||||
PyType_Spec textiobase_spec = {
|
||||
PyType_Spec _Py_textiobase_spec = {
|
||||
.name = "_io._TextIOBase",
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
|
||||
Py_TPFLAGS_IMMUTABLETYPE),
|
||||
|
|
@ -3352,7 +3352,7 @@ static PyType_Slot nldecoder_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec nldecoder_spec = {
|
||||
PyType_Spec _Py_nldecoder_spec = {
|
||||
.name = "_io.IncrementalNewlineDecoder",
|
||||
.basicsize = sizeof(nldecoder_object),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
@ -3404,7 +3404,7 @@ static PyGetSetDef textiowrapper_getset[] = {
|
|||
{NULL}
|
||||
};
|
||||
|
||||
PyType_Slot textiowrapper_slots[] = {
|
||||
static PyType_Slot textiowrapper_slots[] = {
|
||||
{Py_tp_dealloc, textiowrapper_dealloc},
|
||||
{Py_tp_repr, textiowrapper_repr},
|
||||
{Py_tp_doc, (void *)_io_TextIOWrapper___init____doc__},
|
||||
|
|
@ -3418,7 +3418,7 @@ PyType_Slot textiowrapper_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec textiowrapper_spec = {
|
||||
PyType_Spec _Py_textiowrapper_spec = {
|
||||
.name = "_io.TextIOWrapper",
|
||||
.basicsize = sizeof(textio),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
|
|||
|
|
@ -1253,7 +1253,7 @@ static PyType_Slot winconsoleio_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec winconsoleio_spec = {
|
||||
PyType_Spec _Py_winconsoleio_spec = {
|
||||
.name = "_io._WindowsConsoleIO",
|
||||
.basicsize = sizeof(winconsoleio),
|
||||
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ static PyType_Slot constevaluator_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec constevaluator_spec = {
|
||||
static PyType_Spec constevaluator_spec = {
|
||||
.name = "_typing._ConstEvaluator",
|
||||
.basicsize = sizeof(constevaluatorobject),
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
|
||||
|
|
@ -930,7 +930,7 @@ static PyType_Slot typevar_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec typevar_spec = {
|
||||
static PyType_Spec typevar_spec = {
|
||||
.name = "typing.TypeVar",
|
||||
.basicsize = sizeof(typevarobject),
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
|
||||
|
|
@ -1078,7 +1078,7 @@ static PyType_Slot paramspecargs_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec paramspecargs_spec = {
|
||||
static PyType_Spec paramspecargs_spec = {
|
||||
.name = "typing.ParamSpecArgs",
|
||||
.basicsize = sizeof(paramspecattrobject),
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
|
||||
|
|
@ -1158,7 +1158,7 @@ static PyType_Slot paramspeckwargs_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec paramspeckwargs_spec = {
|
||||
static PyType_Spec paramspeckwargs_spec = {
|
||||
.name = "typing.ParamSpecKwargs",
|
||||
.basicsize = sizeof(paramspecattrobject),
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
|
||||
|
|
@ -1509,7 +1509,7 @@ static PyType_Slot paramspec_slots[] = {
|
|||
{0, 0},
|
||||
};
|
||||
|
||||
PyType_Spec paramspec_spec = {
|
||||
static PyType_Spec paramspec_spec = {
|
||||
.name = "typing.ParamSpec",
|
||||
.basicsize = sizeof(paramspecobject),
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
|
||||
|
|
@ -1789,7 +1789,7 @@ Note that only TypeVarTuples defined in the global scope can be\n\
|
|||
pickled.\n\
|
||||
");
|
||||
|
||||
PyType_Slot typevartuple_slots[] = {
|
||||
static PyType_Slot typevartuple_slots[] = {
|
||||
{Py_tp_doc, (void *)typevartuple_doc},
|
||||
{Py_tp_members, typevartuple_members},
|
||||
{Py_tp_methods, typevartuple_methods},
|
||||
|
|
@ -1805,7 +1805,7 @@ PyType_Slot typevartuple_slots[] = {
|
|||
{0, 0},
|
||||
};
|
||||
|
||||
PyType_Spec typevartuple_spec = {
|
||||
static PyType_Spec typevartuple_spec = {
|
||||
.name = "typing.TypeVarTuple",
|
||||
.basicsize = sizeof(typevartupleobject),
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_MANAGED_DICT
|
||||
|
|
@ -2347,7 +2347,7 @@ static PyType_Slot generic_slots[] = {
|
|||
{0, NULL},
|
||||
};
|
||||
|
||||
PyType_Spec generic_spec = {
|
||||
static PyType_Spec generic_spec = {
|
||||
.name = "typing.Generic",
|
||||
.basicsize = sizeof(PyObject),
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
|
||||
|
|
|
|||
|
|
@ -804,7 +804,7 @@ _PyImport_ClearModulesByIndex(PyInterpreterState *interp)
|
|||
substitute this (if the name actually matches).
|
||||
*/
|
||||
|
||||
_Py_thread_local const char *pkgcontext = NULL;
|
||||
static _Py_thread_local const char *pkgcontext = NULL;
|
||||
# undef PKGCONTEXT
|
||||
# define PKGCONTEXT pkgcontext
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue