File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -257,6 +257,30 @@ static PyMethodDef fcntl_methods[] = {
257257
258258/* Module initialisation */
259259
260+ static int
261+ ins (d , symbol , value )
262+ PyObject * d ;
263+ char * symbol ;
264+ long value ;
265+ {
266+ PyObject * v = PyInt_FromLong (value );
267+ if (!v || PyDict_SetItemString (d , symbol , v ) < 0 )
268+ return -1 ;
269+
270+ Py_DECREF (v );
271+ return 0 ;
272+ }
273+
274+ static int
275+ all_ins (d )
276+ PyObject * d ;
277+ {
278+ if (ins (d , "LOCK_SH" , (long )LOCK_SH )) return -1 ;
279+ if (ins (d , "LOCK_EX" , (long )LOCK_EX )) return -1 ;
280+ if (ins (d , "LOCK_NB" , (long )LOCK_NB )) return -1 ;
281+ if (ins (d , "LOCK_UN" , (long )LOCK_UN )) return -1 ;
282+ }
283+
260284void
261285initfcntl ()
262286{
@@ -267,6 +291,7 @@ initfcntl()
267291
268292 /* Add some symbolic constants to the module */
269293 d = PyModule_GetDict (m );
294+ all_ins (d );
270295
271296 /* Check for errors */
272297 if (PyErr_Occurred ())
You can’t perform that action at this time.
0 commit comments