From 0558a205a37a2570cba43acebbe94d50643024d1 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 26 Oct 1990 15:00:11 +0000 Subject: Added getmodulename() public interface. --- Include/moduleobject.h | 1 + Objects/moduleobject.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/Include/moduleobject.h b/Include/moduleobject.h index 442ca11..99d3d52 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -7,3 +7,4 @@ extern typeobject Moduletype; extern object *newmoduleobject PROTO((char *)); extern object *getmoduledict PROTO((object *)); extern int setmoduledict PROTO((object *, object *)); +extern char *getmodulename PROTO((object *)); diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 09bbae9..22a793f 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -62,6 +62,17 @@ setmoduledict(m, v) return 0; } +char * +getmodulename(m) + object *m; +{ + if (!is_moduleobject(m)) { + err_badarg(); + return NULL; + } + return getstringvalue(((moduleobject *)m) -> md_name); +} + /* Methods */ static void -- cgit v0.12