[Python-checkins] python/dist/src/Modules bz2module.c,NONE,1.1

niemeyer@users.sourceforge.net niemeyer@users.sourceforge.net
Tue, 05 Nov 2002 08:50:08 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv13902/Modules

Added Files:
	bz2module.c 
Log Message:
Patch implementing bz2 module.

* setup.py
  (PyBuildExt.detect_modules): Included bz2 module detection.

* Modules/bz2module.c
* Lib/test/test_bz2.py
* Doc/lib/libbz2.tex
  Included files implementing, testing, and documenting bz2 module.

* Doc/Makefile.deps
* Doc/lib/lib.tex
  Include references to libbz2.tex.

* Misc/NEWS
  (Library): Mention distutils' c++ linkage patch, and new bz2 module.


--- NEW FILE: bz2module.c ---
/*

python-bz2 - python bz2 library interface

Copyright (c) 2002  Gustavo Niemeyer <niemeyer@conectiva.com>
Copyright (c) 2002  Python Software Foundation; All Rights Reserved

*/

#include <stdio.h>
#include <bzlib.h>
#include "Python.h"
#include "structmember.h"

#ifdef WITH_THREAD
#include "pythread.h"
#endif

static char __author__[] =
[...2060 lines suppressed...]
	BZ2File_Type.ob_type = &PyType_Type;
	BZ2File_Type.tp_base = &PyFile_Type;
	BZ2File_Type.tp_new = PyFile_Type.tp_new;

	BZ2Comp_Type.ob_type = &PyType_Type;
	BZ2Decomp_Type.ob_type = &PyType_Type;

	m = Py_InitModule3("bz2", bz2_methods, bz2__doc__);

	PyModule_AddObject(m, "__author__", PyString_FromString(__author__));

	Py_INCREF(&BZ2File_Type);
	PyModule_AddObject(m, "BZ2File", (PyObject *)&BZ2File_Type);

	Py_INCREF(&BZ2Comp_Type);
	PyModule_AddObject(m, "BZ2Compressor", (PyObject *)&BZ2Comp_Type);

	Py_INCREF(&BZ2Decomp_Type);
	PyModule_AddObject(m, "BZ2Decompressor", (PyObject *)&BZ2Decomp_Type);
}