Changeset 55

Show
Ignore:
Timestamp:
12/12/06 18:11:46 (2 years ago)
Author:
KirkMcDonald
Message:

Bugfixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/infrastructure/pyd/def.d

    r54 r55  
    3535private PyMethodDef[][char[]] module_methods; 
    3636private PyObject*[char[]] pyd_modules; 
     37 
     38private void ready_module_methods(char[] modulename) { 
     39    PyMethodDef empty; 
     40    if (!(modulename in module_methods)) { 
     41        module_methods[modulename] = (PyMethodDef[]).init; 
     42        module_methods[modulename] ~= empty; 
     43    } 
     44} 
    3745 
    3846PyObject* Pyd_Module_p(char[] modulename="") { 
     
    8189    pragma(msg, "def: " ~ name); 
    8290    PyMethodDef empty; 
    83     if (!(modulename in module_methods)) { 
    84         module_methods[modulename] = (PyMethodDef[]).init; 
    85         module_methods[modulename] ~= empty; 
    86     } 
     91    ready_module_methods(modulename); 
    8792    PyMethodDef[]* list = &module_methods[modulename]; 
    8893 
     
    99104PyObject* module_init(char[] name) { 
    100105    //_loadPythonSupport(); 
     106    ready_module_methods(""); 
    101107    pyd_modules[""] = Py_InitModule((name ~ \0).ptr, module_methods[""].ptr); 
    102108    return pyd_modules[""]; 
     
    107113 */ 
    108114PyObject* add_module(char[] name) { 
     115    ready_module_methods(name); 
    109116    pyd_modules[name] = Py_InitModule((name ~ \0).ptr, module_methods[name].ptr); 
    110117    return pyd_modules[name]; 
  • trunk/infrastructure/pyd/exception.d

    r54 r55  
    8787} 
    8888 
     89alias exception_catcher!(PyObject*) exception_catcher_PyObjectPtr; 
     90alias exception_catcher!(int) exception_catcher_int; 
     91alias exception_catcher!(void) exception_catcher_void; 
     92 
    8993/** 
    9094 * This simple exception class holds a Python exception.