File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,6 +181,21 @@ static PyMethodDef dl_methods[] = {
181181 {NULL , NULL } /* sentinel */
182182};
183183
184+ /* From socketmodule.c
185+ * Convenience routine to export an integer value.
186+ *
187+ * Errors are silently ignored, for better or for worse...
188+ */
189+ static void
190+ insint (PyObject * d , char * name , int value )
191+ {
192+ PyObject * v = PyInt_FromLong ((long ) value );
193+ if (!v || PyDict_SetItemString (d , name , v ))
194+ PyErr_Clear ();
195+
196+ Py_XDECREF (v );
197+ }
198+
184199void
185200initdl (void )
186201{
@@ -202,8 +217,29 @@ initdl(void)
202217 PyDict_SetItemString (d , "error" , x );
203218 x = PyInt_FromLong ((long )RTLD_LAZY );
204219 PyDict_SetItemString (d , "RTLD_LAZY" , x );
220+ #define INSINT (X ) insint(d,#X,X)
205221#ifdef RTLD_NOW
206- x = PyInt_FromLong ((long )RTLD_NOW );
207- PyDict_SetItemString (d , "RTLD_NOW" , x );
222+ INSINT (RTLD_NOW );
223+ #endif
224+ #ifdef RTLD_NOLOAD
225+ INSINT (RTLD_NOLOAD );
226+ #endif
227+ #ifdef RTLD_GLOBAL
228+ INSINT (RTLD_GLOBAL );
229+ #endif
230+ #ifdef RTLD_LOCAL
231+ INSINT (RTLD_LOCAL );
232+ #endif
233+ #ifdef RTLD_PARENT
234+ INSINT (RTLD_PARENT );
235+ #endif
236+ #ifdef RTLD_GROUP
237+ INSINT (RTLD_GROUP );
238+ #endif
239+ #ifdef RTLD_WORLD
240+ INSINT (RTLD_WORLD );
241+ #endif
242+ #ifdef RTLD_NODELETE
243+ INSINT (RTLD_NODELETE );
208244#endif
209245}
You can’t perform that action at this time.
0 commit comments