[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-dev
Subject:    [Python-Dev] Python3 C extension how to support dir()
From:       Barry Scott <barry () barrys-emacs ! org>
Date:       2017-04-23 20:53:00
Message-ID: 8A56393C-8D50-4D89-AC74-105F1510A7AE () barrys-emacs ! org
[Download RAW message or body]

I first ask this on python users. But I think the only people that can answer are the core developers.

I have a python3 C++ extension that works written using the PyCXX C++ interface.

But dir(obj) does not return the list of member variables.

With the python2 version supporting the __members__ variable was all that was needed.
But __members__ been removed from python3.

How should I support dir() from the C API?

I cannot use tp_members, not appropiate to the code I'm writing.
If I provide __dir__ I then hit the problem I need the C API version of:

	all_attr = super( mytype, obj ).__dir__();
	all_attr.extend( mytype_variable_names );
	return all_attr

I'm not getting inspiration from the python 3.6 sources for this problem.

I did find the object_dir function in typeobject.c, but that has not helped
get me move forward.

What is the the patten that I should implement?

Barry
PyCXX

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/python-dev-marcsub-zyf4%40marc.info
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic