File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -502,6 +502,16 @@ namespace objects
502502 );
503503 }
504504
505+ str qualname (const char *name)
506+ {
507+ #if PY_VERSION_HEX >= 0x03030000
508+ if (PyObject_HasAttrString (scope ().ptr (), " __qualname__" )) {
509+ return str (" %s.%s" % make_tuple (scope ().attr (" __qualname__" ), name));
510+ }
511+ #endif
512+ return str (name);
513+ }
514+
505515 namespace
506516 {
507517 // Find a registered class object corresponding to id. Return a
@@ -564,6 +574,9 @@ namespace objects
564574
565575 object m = module_prefix ();
566576 if (m) d[" __module__" ] = m;
577+ #if PY_VERSION_HEX >= 0x03030000
578+ d[" __qualname__" ] = qualname (name);
579+ #endif
567580
568581 if (doc != 0 )
569582 d[" __doc__" ] = doc;
Original file line number Diff line number Diff line change 1414 'X'
1515
1616 >>> X.Y
17- <class 'nested_ext.Y'>
17+ <class 'nested_ext.X. Y'>
1818
1919 >>> X.Y.__module__
2020 'nested_ext'
You can’t perform that action at this time.
0 commit comments