Skip to content

Commit

Permalink
assume C extension API for Python 2.7+
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder authored and Petr Viktorin committed Nov 22, 2017
1 parent 773d7fb commit d448fb9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Modules/
* removed obsolete back-ward compability constants from common.h
* build checks whether LDAP_API_VERSION is OpenLDAP 2.4.x
* _ldap.__author__ and _ldap.__license__ also set from ldap.pkginfo
* assume C extension API for Python 2.7+

Lib/
* removed all dependencies on modules string and types
Expand Down
21 changes: 18 additions & 3 deletions Modules/LDAPObject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,11 +1402,10 @@ setattr(LDAPObject* self, char* name, PyObject* value)
PyTypeObject LDAP_Type = {
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
/* see http://www.python.org/doc/FAQ.html#3.24 */
PyObject_HEAD_INIT(NULL)
PyVarObject_HEAD_INIT(NULL, 0)
#else /* ! MS_WINDOWS */
PyObject_HEAD_INIT(&PyType_Type)
PyVarObject_HEAD_INIT(&PyType_Type, 0)
#endif /* MS_WINDOWS */
0, /*ob_size*/
"LDAP", /*tp_name*/
sizeof(LDAPObject), /*tp_basicsize*/
0, /*tp_itemsize*/
Expand All @@ -1421,4 +1420,20 @@ PyTypeObject LDAP_Type = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
0, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
methods, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
};
2 changes: 1 addition & 1 deletion Modules/LDAPObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef struct {
} LDAPObject;

extern PyTypeObject LDAP_Type;
#define LDAPObject_Check(v) ((v)->ob_type == &LDAP_Type)
#define LDAPObject_Check(v) (Py_TYPE(v) == &LDAP_Type)

extern LDAPObject *newLDAPObject( LDAP* );

Expand Down

0 comments on commit d448fb9

Please sign in to comment.