Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3f257e

Browse files
committed
Marc-Andre Lemburg <[email protected]>:
Include <> -> "". Removed some left over code at the end of the file. Patch by Bill Tutt.
1 parent 90321ec commit e3f257e

1 file changed

Lines changed: 1 addition & 60 deletions

File tree

Tools/perfecthash/perfect_hash.py

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def __init__(self, cchMax, f1, f2, G, cHashElements, cKeys, maxHashValue):
291291

292292
def generate_header(self, structName):
293293
header = """
294-
#include <Python.h>
294+
#include "Python.h"
295295
#include <stdlib.h>
296296
297297
/* --- C API ----------------------------------------------------*/
@@ -603,62 +603,3 @@ def generate_hash(keys, caseInsensitive=0,
603603
sys.stderr.write('initial multipler: %s\n' % c)
604604

605605
return PerfectHash(cchMaxKey, f1, f2, G, N, len(keys), maxHashValue)
606-
607-
"""
608-
static
609-
PyObject *codec_tuple(PyObject *unicode,
610-
int len)
611-
{
612-
PyObject *v,*w;
613-
614-
if (unicode == NULL)
615-
return NULL;
616-
v = PyTuple_New(2);
617-
if (v == NULL) {
618-
Py_DECREF(unicode);
619-
return NULL;
620-
}
621-
PyTuple_SET_ITEM(v,0,unicode);
622-
w = PyInt_FromLong(len);
623-
if (w == NULL) {
624-
Py_DECREF(v);
625-
return NULL;
626-
}
627-
PyTuple_SET_ITEM(v,1,w);
628-
return v;
629-
}
630-
631-
static PyObject *
632-
ucn_decode(PyObject *self,
633-
PyObject *args)
634-
{
635-
const char *data;
636-
int size;
637-
const char *errors = NULL;
638-
PyObject *mapping = NULL;
639-
640-
if (!PyArg_ParseTuple(args, "t#|z:ucn_decode",
641-
&data, &size, &errors))
642-
return NULL;
643-
if (mapping == Py_None)
644-
mapping = NULL;
645-
646-
return codec_tuple(PyUnicode_DecodeNamedUnicodeEscape(data, size, errors),
647-
size);
648-
}
649-
650-
651-
static PyMethodDef _codecs_functions[] = {
652-
{ "ucn_decode", ucn_decode, 1 },
653-
};
654-
655-
DL_EXPORT(void)
656-
init_ucn()
657-
{
658-
Py_InitModule("_ucn", _codecs_functions);
659-
}
660-
661-
"""
662-
663-
664-

0 commit comments

Comments
 (0)