Skip to content

Commit 1901312

Browse files
author
Arzaroth Lekva
committed
python2 compat hotfix, waiting for better ways to do it
1 parent 78ef0cc commit 1901312

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

rapidxml/c_ext/src/attribute_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static PyMethodDef rapidxml_AttributeObject_methods[] = {
7474

7575
PyTypeObject rapidxml_AttributeType = {
7676
PyVarObject_HEAD_INIT(NULL, 0)
77-
"rapidxml._rapidxml.Attribute", /* tp_name */
77+
"_rapidxml.Attribute", /* tp_name */
7878
sizeof(rapidxml_AttributeObject), /* tp_basicsize */
7979
0, /* tp_itemsize */
8080
0, /* tp_dealloc */

rapidxml/c_ext/src/attributeiterator_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static PyObject* rapidxml_AttributeIteratorObject_iternext(rapidxml_AttributeIte
6060

6161
PyTypeObject rapidxml_AttributeIteratorType = {
6262
PyVarObject_HEAD_INIT(NULL, 0)
63-
"rapidxml._rapidxml.AttributeIterator", /* tp_name */
63+
"_rapidxml.AttributeIterator", /* tp_name */
6464
sizeof(rapidxml_AttributeIteratorObject), /* tp_basicsize */
6565
0, /* tp_itemsize */
6666
reinterpret_cast<destructor>(rapidxml_AttributeIteratorObject_dealloc), /* tp_dealloc */

rapidxml/c_ext/src/base_object.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static PyObject* rapidxml_BaseObject_copy(rapidxml_BaseObject* self,
4848
return NULL;
4949
}
5050
if (!IS_BASE(other)) {
51-
PyErr_SetString(PyExc_TypeError, "Expected instance of rapidxml._rapidxml.Base");
51+
PyErr_SetString(PyExc_TypeError, "Expected instance of _rapidxml.Base");
5252
return NULL;
5353
}
5454
self->underlying_obj = reinterpret_cast<rapidxml_BaseObject*>(other)->underlying_obj;
@@ -64,7 +64,7 @@ static PyObject* rapidxml_BaseObject_richcmp(PyObject* obj1,
6464
bool c;
6565

6666
if (!(IS_BASE(obj1) && IS_BASE(obj2))) {
67-
PyErr_SetString(PyExc_TypeError, "Expected instances of rapidxml._rapidxml.Base");
67+
PyErr_SetString(PyExc_TypeError, "Expected instances of _rapidxml.Base");
6868
return NULL;
6969
}
7070
switch (op) {
@@ -205,7 +205,7 @@ static PyMethodDef rapidxml_BaseObject_methods[] = {
205205

206206
PyTypeObject rapidxml_BaseType = {
207207
PyVarObject_HEAD_INIT(NULL, 0)
208-
"rapidxml._rapidxml.Base", /* tp_name */
208+
"_rapidxml.Base", /* tp_name */
209209
sizeof(rapidxml_BaseObject), /* tp_basicsize */
210210
0, /* tp_itemsize */
211211
reinterpret_cast<destructor>(rapidxml_BaseObject_dealloc), /* tp_dealloc */

rapidxml/c_ext/src/document_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static PyMethodDef rapidxml_DocumentObject_methods[] = {
164164

165165
PyTypeObject rapidxml_DocumentType = {
166166
PyVarObject_HEAD_INIT(NULL, 0)
167-
"rapidxml._rapidxml.Document", /* tp_name */
167+
"_rapidxml.Document", /* tp_name */
168168
sizeof(rapidxml_DocumentObject), /* tp_basicsize */
169169
0, /* tp_itemsize */
170170
reinterpret_cast<destructor>(rapidxml_DocumentObject_dealloc), /* tp_dealloc */

rapidxml/c_ext/src/node_object.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static PyObject* rapidxml_NodeObject_prepend_node(rapidxml_NodeObject* self,
173173
return NULL;
174174
}
175175
if (!IS_NODE(node)) {
176-
PyErr_SetString(PyExc_TypeError, "Expected instance of rapidxml._rapidxml.Node");
176+
PyErr_SetString(PyExc_TypeError, "Expected instance of _rapidxml.Node");
177177
return NULL;
178178
}
179179
static_cast<rapidxml::xml_node<>*>(self->base.underlying_obj)->prepend_node
@@ -195,7 +195,7 @@ static PyObject* rapidxml_NodeObject_append_node(rapidxml_NodeObject* self,
195195
return NULL;
196196
}
197197
if (!IS_NODE(node)) {
198-
PyErr_SetString(PyExc_TypeError, "Expected instance of rapidxml._rapidxml.Node");
198+
PyErr_SetString(PyExc_TypeError, "Expected instance of _rapidxml.Node");
199199
return NULL;
200200
}
201201
static_cast<rapidxml::xml_node<>*>(self->base.underlying_obj)->append_node
@@ -219,7 +219,7 @@ static PyObject* rapidxml_NodeObject_insert_node(rapidxml_NodeObject* self,
219219
return NULL;
220220
}
221221
if (!(IS_NODE(where) && IS_NODE(node))) {
222-
PyErr_SetString(PyExc_TypeError, "Expected instances of rapidxml._rapidxml.Node");
222+
PyErr_SetString(PyExc_TypeError, "Expected instances of _rapidxml.Node");
223223
return NULL;
224224
}
225225
static_cast<rapidxml::xml_node<>*>(self->base.underlying_obj)->insert_node
@@ -263,7 +263,7 @@ static PyObject* rapidxml_NodeObject_remove_node(rapidxml_NodeObject* self,
263263
return NULL;
264264
}
265265
if (!IS_NODE(node)) {
266-
PyErr_SetString(PyExc_TypeError, "Expected instance of rapidxml._rapidxml.Node");
266+
PyErr_SetString(PyExc_TypeError, "Expected instance of _rapidxml.Node");
267267
return NULL;
268268
}
269269
static_cast<rapidxml::xml_node<>*>(self->base.underlying_obj)->remove_node
@@ -293,7 +293,7 @@ static PyObject* rapidxml_NodeObject_prepend_attribute(rapidxml_NodeObject* self
293293
return NULL;
294294
}
295295
if (!IS_ATTR(attribute)) {
296-
PyErr_SetString(PyExc_TypeError, "Expected instance of rapidxml._rapidxml.Attribute");
296+
PyErr_SetString(PyExc_TypeError, "Expected instance of _rapidxml.Attribute");
297297
return NULL;
298298
}
299299
static_cast<rapidxml::xml_node<>*>(self->base.underlying_obj)->prepend_attribute
@@ -315,7 +315,7 @@ static PyObject* rapidxml_NodeObject_append_attribute(rapidxml_NodeObject* self,
315315
return NULL;
316316
}
317317
if (!IS_ATTR(attribute)) {
318-
PyErr_SetString(PyExc_TypeError, "Expected instance of rapidxml._rapidxml.Attribute");
318+
PyErr_SetString(PyExc_TypeError, "Expected instance of _rapidxml.Attribute");
319319
return NULL;
320320
}
321321
static_cast<rapidxml::xml_node<>*>(self->base.underlying_obj)->append_attribute
@@ -339,7 +339,7 @@ static PyObject* rapidxml_NodeObject_insert_attribute(rapidxml_NodeObject* self,
339339
return NULL;
340340
}
341341
if (!(IS_ATTR(where) && IS_ATTR(attribute))) {
342-
PyErr_SetString(PyExc_TypeError, "Expected instances of rapidxml._rapidxml.Attribute");
342+
PyErr_SetString(PyExc_TypeError, "Expected instances of _rapidxml.Attribute");
343343
return NULL;
344344
}
345345
static_cast<rapidxml::xml_node<>*>(self->base.underlying_obj)->insert_attribute
@@ -383,7 +383,7 @@ static PyObject* rapidxml_NodeObject_remove_attribute(rapidxml_NodeObject* self,
383383
return NULL;
384384
}
385385
if (!IS_ATTR(attribute)) {
386-
PyErr_SetString(PyExc_TypeError, "Expected instance of rapidxml._rapidxml.Attribute");
386+
PyErr_SetString(PyExc_TypeError, "Expected instance of _rapidxml.Attribute");
387387
return NULL;
388388
}
389389
static_cast<rapidxml::xml_node<>*>(self->base.underlying_obj)->remove_attribute
@@ -531,7 +531,7 @@ static PyMethodDef rapidxml_NodeObject_methods[] = {
531531

532532
PyTypeObject rapidxml_NodeType = {
533533
PyVarObject_HEAD_INIT(NULL, 0)
534-
"rapidxml._rapidxml.Node", /* tp_name */
534+
"_rapidxml.Node", /* tp_name */
535535
sizeof(rapidxml_NodeObject), /* tp_basicsize */
536536
0, /* tp_itemsize */
537537
0, /* tp_dealloc */

rapidxml/c_ext/src/nodeiterator_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static PyObject* rapidxml_NodeIteratorObject_iternext(rapidxml_NodeIteratorObjec
6060

6161
PyTypeObject rapidxml_NodeIteratorType = {
6262
PyVarObject_HEAD_INIT(NULL, 0)
63-
"rapidxml._rapidxml.NodeIterator", /* tp_name */
63+
"_rapidxml.NodeIterator", /* tp_name */
6464
sizeof(rapidxml_NodeIteratorObject), /* tp_basicsize */
6565
0, /* tp_itemsize */
6666
reinterpret_cast<destructor>(rapidxml_NodeIteratorObject_dealloc), /* tp_dealloc */

rapidxml/c_ext/src/rapidxml_module.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static PyMethodDef module_methods[] = {
2222

2323
static struct PyModuleDef moduledef = {
2424
PyModuleDef_HEAD_INIT,
25-
"rapidxml._rapidxml",
25+
"_rapidxml",
2626
"python module for rapidxml bindings",
2727
-1,
2828
module_methods,
@@ -64,7 +64,7 @@ PyMODINIT_FUNC init_rapidxml(void)
6464
#if PY_MAJOR_VERSION >= 3
6565
module = PyModule_Create(&moduledef);
6666
#else
67-
module = Py_InitModule3("rapidxml._rapidxml",
67+
module = Py_InitModule3("_rapidxml",
6868
module_methods,
6969
"rapidxml module for rapidxml bindings");
7070
#endif
@@ -101,7 +101,7 @@ PyMODINIT_FUNC init_rapidxml(void)
101101
"AttributeIterator",
102102
reinterpret_cast<PyObject *>(&rapidxml_AttributeIteratorType));
103103

104-
rapidxml_RapidXmlError = PyErr_NewException("rapidxml._rapidxml.RapidXmlError",
104+
rapidxml_RapidXmlError = PyErr_NewException("_rapidxml.RapidXmlError",
105105
NULL, NULL);
106106
Py_INCREF(rapidxml_RapidXmlError);
107107
PyModule_AddObject(module,

rapidxml/rapidxml.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
# arzaroth@arzaroth.com
77
#
88

9-
import rapidxml._rapidxml
9+
import _rapidxml
1010

11-
class DictNode(rapidxml._rapidxml.Node):
11+
class DictNode(_rapidxml.Node):
1212
def __init__(self, attribute_prefix='@', cdata_key='#text'):
13-
rapidxml._rapidxml.Node.__init__(self)
13+
_rapidxml.Node.__init__(self)
1414
self.attribute_prefix = attribute_prefix
1515
self.cdata_key = cdata_key
1616

@@ -52,11 +52,11 @@ def __getitem__(self, name):
5252
raise KeyError(name)
5353
return res
5454

55-
class RapidXml(DictNode, rapidxml._rapidxml.Document):
55+
class RapidXml(DictNode, _rapidxml.Document):
5656
def __init__(self,
5757
text="",
5858
from_file=False,
5959
attribute_prefix='@',
6060
cdata_key='#text'):
6161
DictNode.__init__(self, attribute_prefix, cdata_key)
62-
rapidxml._rapidxml.Document.__init__(self, text, from_file)
62+
_rapidxml.Document.__init__(self, text, from_file)

0 commit comments

Comments
 (0)