]> granicus.if.org Git - python/commitdiff
Export MPZType -- the type of mpz objects....
authorFred Drake <fdrake@acm.org>
Fri, 3 Apr 1998 15:33:43 +0000 (15:33 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 3 Apr 1998 15:33:43 +0000 (15:33 +0000)
Modules/mpzmodule.c

index ae4243af08717aec8627d849b19fcf78de97d464..0400605ed662da56702f1cb49d01123260153f29 100644 (file)
@@ -1825,12 +1825,15 @@ void mp_free( ptr, size )
 void
 initmpz()
 {
+       PyObject *module;
+       PyObject *dict;
+
 #ifdef MPZ_DEBUG
        fputs( "initmpz() called...\n", stderr );
 #endif /* def MPZ_DEBUG */
 
        mp_set_memory_functions( mp_allocate, mp_reallocate, mp_free );
-       (void)Py_InitModule("mpz", mpz_functions);
+       module = Py_InitModule("mpz", mpz_functions);
 
        /* create some frequently used constants */
        if ((mpz_value_zero = newmpzobject()) == NULL)
@@ -1845,6 +1848,11 @@ initmpz()
                Py_FatalError("initmpz: can't initialize mpz constants");
        mpz_set_si(&mpz_value_mone->mpz, (long)-1);
 
+       dict = PyModule_GetDict(module);
+       if (dict != NULL) {
+               PyDict_SetItemString(dict, "MPZType", (PyObject*)&MPZtype);
+       }
+
 } /* initmpz() */
 #ifdef MAKEDUMMYINT
 int _mpz_dummy_int;    /* XXX otherwise, we're .bss-less (DYNLOAD->Jack?) */