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 627878 - tests: Port to new introspection tests
tests: Port to new introspection tests
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-24 19:33 UTC by Colin Walters
Modified: 2010-09-03 16:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: Port to new introspection tests (27.85 KB, patch)
2010-08-24 19:34 UTC, Colin Walters
accepted-commit_after_freeze Details | Review
remove reliance on _PyUnicode_AsString (51.64 KB, patch)
2010-08-30 23:09 UTC, johnp
none Details | Review
use PyObject_SetAttrString, not PyDict_SetItemString when setting __gtype__ (1.55 KB, patch)
2010-09-03 16:12 UTC, johnp
none Details | Review

Description Colin Walters 2010-08-24 19:33:58 UTC
Everything is renamed "Regress", and both it and GIMarshallingTests
are now in source form, so we compile them.

The scanner now adds "static methods" to objects, structs, and unions,
so update the test code to use those.

In the tests, remove broken (inout) cases - the person writing these
tests misunderstood the semantics of (inout).  It's not acceptable for
a C API to mutate e.g. a GSList* passed in, or unref an object.

The invocation code needed to be updated for this - remove some
broken hacks.
Comment 1 Colin Walters 2010-08-24 19:34:00 UTC
Created attachment 168675 [details] [review]
tests: Port to new introspection tests
Comment 2 johnp 2010-08-24 21:41:59 UTC
Comment on attachment 168675 [details] [review]
tests: Port to new introspection tests

Looks good, test pass.  Feel free to commit once the gobject-introspect branch gets merged into master (using commit_after_freeze to denote this)
Comment 3 johnp 2010-08-30 23:09:04 UTC
Created attachment 169135 [details] [review]
remove reliance on _PyUnicode_AsString

* _PyUnicode_AsString dumps the internal buffer of a PyUnicode object
  which is not garunteed to hold any values (it is a cache)
* there is a reason why the method is prefixed with an underscore
  which marks it as internal
* since unicode objects need to be converted to byte strings in order
  to get their underlying byte arrays we need to handle errors that
  might happen during the conversion process
* because of the conversions process there is no easy way to map Python 2.x
  string method "AsString" to Python 3.x unicode methods so we must handle
  it with ifdefs
Comment 4 Colin Walters 2010-08-31 22:22:35 UTC
Comment on attachment 169135 [details] [review]
remove reliance on _PyUnicode_AsString

Did you mean to attach this patch here?  Doesn't seem to have to do with this bug.
Comment 5 Colin Walters 2010-08-31 22:22:48 UTC
Pushed to master.
Comment 6 johnp 2010-09-03 16:12:17 UTC
Created attachment 169440 [details] [review]
use PyObject_SetAttrString, not PyDict_SetItemString when setting __gtype__

* When registering a gtype wrapper we used to set tp_dict directly. This works
  in python 2 but python 3 seems to handle attributes in a slightly different
  way where the tp_dict and attr get out of sync.  By setting the attr
  directly we avoid this issue.
* Note that there are many more places where we set __gtype__ using tp_dict
  however for objects which are not instantiated yet we have to set tp_dict
  directly.
* Since this one change fixes a lot of failed tests, for now we ignore the
  other places where we set __gtype__.  If we run into more issues dealing
  with __gtype__ we can take a closer look later.
Comment 7 johnp 2010-09-03 16:29:40 UTC
doh, wrong bug # when using git-bz to push patches.  That teaches me to rely on shell history.