]> granicus.if.org Git - python/commit
Fix SF bug #442501: calculate __module__ properly.
authorGuido van Rossum <guido@python.org>
Thu, 16 Aug 2001 09:18:56 +0000 (09:18 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 16 Aug 2001 09:18:56 +0000 (09:18 +0000)
commitc35422109b36d20f409a3a72f60c0c7e2e0bc824
tree361f6efa619212bddc3789f37ddde4ba6142be55
parent83f56cb2dbb0e5df04ae2a6d2847991449cfde6b
Fix SF bug #442501: calculate __module__ properly.

- type_module(), type_name(): if tp_name contains one or more period,
  the part before the last period is __module__, the part after that
  is __name__.  Otherwise, for non-heap types, __module__ is
  "__builtin__".  For heap types, __module__ is looked up in
  tp_defined.

- type_new(): heap types have their __module__ set from
  globals().__name__; a pre-existing __module__ in their dict is not
  overridden.  This is not inherited.

- type_repr(): if __module__ exists and is not "__builtin__", it is
  included in the string representation (just as it already is for
  classes).  For example <type '__main__.C'>.
Objects/typeobject.c