Commit ff98352d authored by Guido van Rossum's avatar Guido van Rossum

Ellipses -> Ellipsis rename (the dictionary really says that it should

be Ellipsis!).
Bumped the API version because a linker-visible symbol is affected.
Old C code will still compile -- there's a b/w compat macro.
Similarly, old Python code will still run, builtin exports both
Ellipses and Ellipsis.
parent 3a706e97
...@@ -52,8 +52,8 @@ extern PyObject *Py_BuildValue(); ...@@ -52,8 +52,8 @@ extern PyObject *Py_BuildValue();
extern int PyArg_VaParse Py_PROTO((PyObject *, char *, va_list)); extern int PyArg_VaParse Py_PROTO((PyObject *, char *, va_list));
extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list)); extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
#define PYTHON_API_VERSION 1005 #define PYTHON_API_VERSION 1006
#define PYTHON_API_STRING "1005" #define PYTHON_API_STRING "1006"
/* The API version is maintained (independently from the Python version) /* The API version is maintained (independently from the Python version)
so we can detect mismatches between the interpreter and dynamically so we can detect mismatches between the interpreter and dynamically
loaded modules. These are diagnosticised by an error message but loaded modules. These are diagnosticised by an error message but
...@@ -67,6 +67,8 @@ extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list)); ...@@ -67,6 +67,8 @@ extern PyObject *Py_VaBuildValue Py_PROTO((char *, va_list));
Please add a line or two to the top of this log for each API Please add a line or two to the top of this log for each API
version change: version change:
11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
30-Jul-1996 GvR Slice and ellipses syntax added 30-Jul-1996 GvR Slice and ellipses syntax added
23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-) 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
extern "C" { extern "C" {
#endif #endif
/* The unique ellipses object "..." */ /* The unique ellipsis object "..." */
extern DL_IMPORT(PyObject) _Py_EllipsesObject; /* Don't use this directly */ extern DL_IMPORT(PyObject) _Py_EllipsisObject; /* Don't use this directly */
#define Py_Ellipses (&_Py_EllipsesObject)
#define Py_Ellipsis (&_Py_EllipsisObject)
#define Py_Ellipses Py_Ellipsis /* For bad spellers like me :-( */
/* Slice object interface */ /* Slice object interface */
......
...@@ -48,6 +48,6 @@ except TypeError: ...@@ -48,6 +48,6 @@ except TypeError:
FrameType = type(sys.exc_traceback.tb_frame) FrameType = type(sys.exc_traceback.tb_frame)
SliceType = type(slice(0)) SliceType = type(slice(0))
EllipsesType = type(Ellipses) EllipsisType = type(Ellipsis)
del sys, _f, _C, _x # Not for export del sys, _f, _C, _x # Not for export
/* /*
Written by Jim Hugunin and Chris Chase. Written by Jim Hugunin and Chris Chase.
This includes both the singular ellipses object and slice objects. This includes both the singular ellipsis object and slice objects.
Guido, feel free to do whatever you want in the way of copyrights Guido, feel free to do whatever you want in the way of copyrights
for this file. for this file.
*/ */
/* /*
Py_Ellipses encodes the '...' rubber index token. It is similar to Py_Ellipsis encodes the '...' rubber index token. It is similar to
the Py_NoneStruct in that there is no way to create other objects of the Py_NoneStruct in that there is no way to create other objects of
this type and there is exactly one in existence. this type and there is exactly one in existence.
*/ */
...@@ -16,16 +16,16 @@ this type and there is exactly one in existence. ...@@ -16,16 +16,16 @@ this type and there is exactly one in existence.
#include "Python.h" #include "Python.h"
static PyObject * static PyObject *
ellipses_repr(op) ellipsis_repr(op)
PyObject *op; PyObject *op;
{ {
return PyString_FromString("Ellipses"); return PyString_FromString("Ellipsis");
} }
static PyTypeObject PyEllipses_Type = { static PyTypeObject PyEllipsis_Type = {
PyObject_HEAD_INIT(&PyType_Type) PyObject_HEAD_INIT(&PyType_Type)
0, 0,
"ellipses", "ellipsis",
0, 0,
0, 0,
0, /*tp_dealloc*/ /*never called*/ 0, /*tp_dealloc*/ /*never called*/
...@@ -33,15 +33,15 @@ static PyTypeObject PyEllipses_Type = { ...@@ -33,15 +33,15 @@ static PyTypeObject PyEllipses_Type = {
0, /*tp_getattr*/ 0, /*tp_getattr*/
0, /*tp_setattr*/ 0, /*tp_setattr*/
0, /*tp_compare*/ 0, /*tp_compare*/
(reprfunc)ellipses_repr, /*tp_repr*/ (reprfunc)ellipsis_repr, /*tp_repr*/
0, /*tp_as_number*/ 0, /*tp_as_number*/
0, /*tp_as_sequence*/ 0, /*tp_as_sequence*/
0, /*tp_as_mapping*/ 0, /*tp_as_mapping*/
0, /*tp_hash */ 0, /*tp_hash */
}; };
PyObject _Py_EllipsesObject = { PyObject _Py_EllipsisObject = {
PyObject_HEAD_INIT(&PyEllipses_Type) PyObject_HEAD_INIT(&PyEllipsis_Type)
}; };
......
...@@ -1632,7 +1632,9 @@ initbuiltin() ...@@ -1632,7 +1632,9 @@ initbuiltin()
INCREF(builtin_dict); INCREF(builtin_dict);
initerrors(); initerrors();
(void) dictinsert(builtin_dict, "None", None); (void) dictinsert(builtin_dict, "None", None);
(void) dictinsert(builtin_dict, "Ellipses", Py_Ellipses); (void) dictinsert(builtin_dict, "Ellipsis", Py_Ellipsis);
/* And once more for bad spellers like me :-( */
(void) dictinsert(builtin_dict, "Ellipses", Py_Ellipsis);
} }
......
...@@ -1032,7 +1032,7 @@ com_subscript(c, n) ...@@ -1032,7 +1032,7 @@ com_subscript(c, n)
ch = CHILD(n,0); ch = CHILD(n,0);
/* check for rubber index */ /* check for rubber index */
if (TYPE(ch) == DOT && TYPE(CHILD(n,1)) == DOT) if (TYPE(ch) == DOT && TYPE(CHILD(n,1)) == DOT)
com_addoparg(c, LOAD_CONST, com_addconst(c, Py_Ellipses)); com_addoparg(c, LOAD_CONST, com_addconst(c, Py_Ellipsis));
else { else {
/* check for slice */ /* check for slice */
if ((TYPE(ch) == COLON || NCH(n) > 1)) if ((TYPE(ch) == COLON || NCH(n) > 1))
......
...@@ -37,7 +37,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -37,7 +37,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define TYPE_NULL '0' #define TYPE_NULL '0'
#define TYPE_NONE 'N' #define TYPE_NONE 'N'
#define TYPE_ELLIPSES '.' #define TYPE_ELLIPSIS '.'
#define TYPE_INT 'i' #define TYPE_INT 'i'
#define TYPE_FLOAT 'f' #define TYPE_FLOAT 'f'
#define TYPE_COMPLEX 'x' #define TYPE_COMPLEX 'x'
...@@ -130,8 +130,8 @@ w_object(v, p) ...@@ -130,8 +130,8 @@ w_object(v, p)
w_byte(TYPE_NULL, p); w_byte(TYPE_NULL, p);
else if (v == None) else if (v == None)
w_byte(TYPE_NONE, p); w_byte(TYPE_NONE, p);
else if (v == Py_Ellipses) else if (v == Py_Ellipsis)
w_byte(TYPE_ELLIPSES, p); w_byte(TYPE_ELLIPSIS, p);
else if (is_intobject(v)) { else if (is_intobject(v)) {
w_byte(TYPE_INT, p); w_byte(TYPE_INT, p);
w_long(getintvalue(v), p); w_long(getintvalue(v), p);
...@@ -325,9 +325,9 @@ r_object(p) ...@@ -325,9 +325,9 @@ r_object(p)
INCREF(None); INCREF(None);
return None; return None;
case TYPE_ELLIPSES: case TYPE_ELLIPSIS:
INCREF(Py_Ellipses); INCREF(Py_Ellipsis);
return Py_Ellipses; return Py_Ellipsis;
case TYPE_INT: case TYPE_INT:
return newintobject(r_long(p)); return newintobject(r_long(p));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment