1#include "Python.h"
2#include "pyobjc-api.h"
3
4#import <Foundation/Foundation.h>
5
6@interface PyObjCTest_Protected : NSObject
7{}
8-(id)publicMethod;
9-(id)_protectedMethod;
10@end
11
12@implementation PyObjCTest_Protected 
13-(id)publicMethod
14{
15	return nil;
16}
17
18-(id)_protectedMethod
19{
20	return nil;
21}
22@end
23
24static PyMethodDef mod_methods[] = {
25	        { 0, 0, 0, 0 }
26};
27
28#if PY_VERSION_HEX >= 0x03000000
29
30static struct PyModuleDef mod_module = {
31	PyModuleDef_HEAD_INIT,
32	"protected",
33	NULL,
34	0,
35	mod_methods,
36	NULL,
37	NULL,
38	NULL,
39	NULL
40};
41
42#define INITERROR() return NULL
43#define INITDONE() return m
44
45PyObject* PyInit_protected(void);
46
47PyObject*
48PyInit_protected(void)
49
50#else
51
52#define INITERROR() return
53#define INITDONE() return
54
55void initprotected(void);
56
57void
58initprotected(void)
59#endif
60{
61	PyObject* m;
62
63#if PY_VERSION_HEX >= 0x03000000
64	m = PyModule_Create(&mod_module);
65#else
66	m = Py_InitModule4("protected", mod_methods,
67		NULL, NULL, PYTHON_API_VERSION);
68#endif
69	if (!m) {
70		INITERROR();
71	}
72
73	if (PyObjC_ImportAPI(m) < 0) {
74		INITERROR();
75	}
76
77	if (PyModule_AddObject(m, "PyObjCTest_Protected", 
78		PyObjCClass_New([PyObjCTest_Protected class])) < 0){
79		INITERROR();
80	}
81	INITDONE();
82}
83