After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 741802 - Support __all__ = [ 'TypeName' ]
Support __all__ = [ 'TypeName' ]
Status: RESOLVED FIXED
Product: libpeas
Classification: Platform
Component: python
git master
Other Linux
: Normal normal
: ---
Assigned To: libpeas-maint
libpeas-maint
Depends on:
Blocks:
 
 
Reported: 2014-12-20 09:04 UTC by Garrett Regier
Modified: 2015-02-04 14:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Support Python plugins that define __all__ (1.75 KB, patch)
2015-01-21 01:27 UTC, Garrett Regier
committed Details | Review

Description Garrett Regier 2014-12-20 09:04:56 UTC
Instead of going through every local in the plugin just check those in __all__.

This would also speed up creating extensions.
Comment 1 Garrett Regier 2015-01-21 01:27:38 UTC
Created attachment 295059 [details] [review]
Support Python plugins that define __all__

Instead of going through every local in the plugin just check those in __all__, if defined.

----

This is quite a bit easier now that we can write it directly in Python!
Comment 2 Ignacio Casal Quinteiro (nacho) 2015-01-21 08:44:02 UTC
Review of attachment 295059 [details] [review]:

See comment. Apart from that go ahead

::: loaders/python/peas-python-internal.py
@@ +136,3 @@
+
+        except AttributeError:
+            keys = module.__dict__

can this also fail? if yes add a warning?
Comment 3 Garrett Regier 2015-01-23 08:33:37 UTC
(In reply to comment #2)
> Review of attachment 295059 [details] [review]:
> 
> See comment. Apart from that go ahead
> 
> ::: loaders/python/peas-python-internal.py
> @@ +136,3 @@
> +
> +        except AttributeError:
> +            keys = module.__dict__
> 
> can this also fail? if yes add a warning?

Nope, it is read-only according to the source.

https://github.com/python/cpython/blob/master/Objects/moduleobject.c#L19
Comment 4 Ignacio Casal Quinteiro (nacho) 2015-01-23 08:43:54 UTC
ok go ahead then
Comment 5 Garrett Regier 2015-02-04 14:35:19 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.